EncyclopediaOfLife/eol — comment on commit ef7b6563f13254bf99b4ecb17943ef29ce61e2a1
File:  line 0
By lwalley:

I can't think of a reason why a before_filter would not work in this case. There may be some redundancy with that approach e.g. if the controller is ends up redirecting to another action instead of rendering the view.

With regards to best practices i.e. not using before_filters to instantiate variables people do suggest using helper methods instead e.g. http://railscasts.com/episodes/259-decent-exposure but there isn't any reason why I can't call the helper method at the beginning of the controller action (instead of afterwards from the view) and then use the params instead of request.url - I want the use of rel canonical to be more cautiously anyway, i.e. move it out of the application layout.