This fun site I'm working on, it's got thousands o...
# support
g
This fun site I'm working on, it's got thousands of tax rates (all based on zip code, I know it's not ideal, that's how the existing site is set up, that's what I have to make work on solidus, too). It's so many that trying to load the page in the admin times out. I can add in pagination to
tax_rates_controller.rb
as a proof of concept, but I know that's not the right way to go about it. What's the best way to extend / override an existing controller action to add some additional functionality? I've seen some articles talking about overrides, some use decorators. I'm sure it's super easy to do, I just haven't seen the right explanation for it so it hasn't "clicked" in my head yet
j
Yeah, using decorators (which the Rails engine guides call "overrides") would be the way to do this. You can decorate the given controller and either add additional before_action callbacks or even redefine existing ones.
g
Thanks so much for all the help, learning a new language / framework often means learning a new way to describe things, appreciate y'all being so patient 😄
sg thumbs up 1
j
Always happy to help. This is definitely one of the weirder things (that helps make Solidus so flexible). Most languages you can't just open up existing classes and redefine methods and stuff like you can in Ruby, so it's often a pretty foreign concept for people coming from other ecosystems.
g
Agreed, I'm dipping my toes into defacing, too, which seems incredibly cool but I'm sure I'll have questions about at some point XD
j
Yeah, very powerful, but somewhat upsetting when you find out how it does what it does. 😅 (Hint: it involves converting ERB tags into XML elements and then converting them back.)
💯 1
g
Eww, I feel dirty just thinking about it xD