While I was trying to port one application from Rail 2 to Rails 3 I’ve
noticed that helper methods used for rewriting URL paths are not
called. Methods are defined in app/helpers/url_helper.rb:
module UrlHelper
def story_pah(story)
“/story/#{story.title}”
end
end
This method, when called inside of view instead of:
story/1
creates path
story/story_title.
I order to double check this I’ve create two new applications. One in
Rails 2 and the other in Rails 3. After that I created scaffold for
Story:
Rails 2: script/generate scaffold Story title:string body:string
Rails 3: rails g scaffold Story title:string body:string
Finally I created app/helpers/url_helper.rb with above method in both
applications. In app/views/stories/index.html.erb file line:
creates: story/story_title in Rails 2 and story/1 path in Rails 3.
Obviously method story_path is not called in Rails 3. Any hint why
this happens would be appreciated.
Regards,
Boško Ivanišević