Ruby on Rails Tuesday, June 28, 2011

This may look like a quick and dirty way to do this, but might work with minimal effort.

Also, this will work only in the scenario where create and update never have their own views - this would be the case most often, but just wanted to highlight it

def asset_path_fragment
  css_action = case controller.action_name
    when "create"
      "new"
    when "update"
      "edit"
    else
      controller.action_name
    end
  "#{controller.controller_name}/#{css_action}"
end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/ODWhML8b1JkJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment