Im using a lot of RJS in the application i am developing.
I was hoping to get some inputs about some best practices when using
RJS.
when doing very simple things like, shaking an empty field when
validating,
i just do it in the controller.
like this:
render :update do |page|
page.visual_effect :shake, “link_asset_link_url”
page.visual_effect :highlight, “link_asset_link_url”
end
and when doing more stuff, i put it in an rjs file.
Is the first one a no no? Since im not doing it the MVC way?
render :update do |page|
page.visual_effect :shake, "link_asset_link_url"
page.visual_effect :highlight, "link_asset_link_url"
end
and when doing more stuff, i put it in an rjs file.
Is the first one a no no? Since im not doing it the MVC way?
May i know some of your opinions here?
I like to keep my RJS in actual RJS templates, just so I know where it
all is. Having some of it in a controller and some of it in an RJS
template seems disorganized to me. I suppose the same argument could
be raised for keeping it all in the controller rather than in RJS
templates, and I’d probably be ok with that too if I didn’t already
have tons of it in templates. Ok… maybe not “tons” but certainly
more than I want to move.