Ruby on Rails
Tuesday, June 28, 2011
No, in the solution I suggested the decision about which assets to use is made in the template and can't depend on the controller name/action. There's no way that I know of to determine the template name in the same way via a helper function.
The only other option that might be useful for you would be to have combined CSS/JS files for some actions where this type of thing can occur like with update/edit and set the ID or class of the <body> tag based on the template rendered. You could then target selectors in your assets to ensure the correct behavior, but this might end up being more effort than a simpler solution.
-- On Tue, Jun 28, 2011 at 4:52 PM, Chris Braddock <braddock.chris@gmail.com> wrote:
Hmm, maybe I'm confused. Even if I used your solution verbatim I think I'm still stuck with the problem as update.html.erb would not be used (edit.html.erb would).To recap, what you're suggesting is essentially what I'm doing -- except instead of hard-coding "people/update" I'm using a helper method that uses controller.controller_name + "/" + controller.action_name to generate that part of the path.So far so good, but when I use "render :edit" in the "update" action, I've got my problem (I'm requesting the wrong action's assets).--To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/2LGOmrUizjYJ.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
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.
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
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.
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment