Search code examples
cucumbersubdomainapotomo

How to override url_for_event in Apotomo to always include a parameter?


To get to run Cucumber with my app and subdomains, I read that I should add default parameters to the default_url_options.

However, I can't seem to find a way to add default parameters to the url_for_event helper that Apotomo gives. I believe this would be the first (if not the only) step to getting integration tests, Apotomo, and subdomains to work.


Solution

  • I got an answer from Paul Hagstrom in the Apotomo mailing list:

    class YourBaseWidget < Apotomo::Widget 
      def default_url_options 
        ... 
      end 
    end 
    
    class YourOtherWidgets < YourBaseWidget 
      ... 
    end
    

    This works a lot like how most of your Rails controllers inherit from ApplicationController. Thus, anything you apply to ApplicationController will apply, by inheritance, to your child controllers.