Within the RJS template is there a way to specify when the visual_effect
I’m trying not to repeat the :before and :success blind_down
visual_effect statements throughout my views.
It seems like the rjs templates can only take visual effects statements
in the form of
page.visual_effect :blind_up, ‘divname’. I can’t figure out how to add
:before or :success to this statement.
By :before do you mean :loading?
If so, all these pre-response phases must be encoded in the view.
To avoid repeating your effect calls you can put them in your own
to your function in your remote calls.
RJS is just an easy way to build an executable response
sequence to Ajax requests. So to restrict execution of the
RJS effects to :success you need to ensure that this RJS is only
built if everything went OK, and if it didn’t, to either render
some other RJS, or to set the response status to 500, render nothing,
and signal failure in some way e.g.:
:failure => "alert('Remote function failed')"
We develop, watch us RoR, in numbers too big to ignore.