#45 RJS Tips
Jun 15, 2007 | 7 minutes |
Ajax
This episode is packed with little RJS goodies. Learn the different ways to access an element, how to add "if" conditions and how to apply an effect to multiple elements.
- Download:
- mp4Full Size H.264 Video (11.2 MB)
- m4vSmaller H.264 Video (7.82 MB)
- webmFull Size VP8 Video (20.5 MB)
- ogvFull Size Theora Video (13.3 MB)
Oh,very nice and cool!~
let's see
Thanks for all your screencasts, Ryan. I always learn something even if English is not my primary language. Speak more slowly perhaps ? (joke).
link_to_funtion is nice! I hope you soon will produce some screencasts that deal with helper methods.
Thanks Ryan for another great Railscast.
Please keep them coming.
Busy as a bee, Ryan? Love the snippets.
@carmelyne, glad you like it. :)
I actually had the feature done a few days ago, I just didn't upload it until last night. It was still a chore retyping all the code.
I should probably keep the code in a subversion repository as well and add a "tag" for each episode. Hmmm.
Another great cast!
Thanks for reading the feedback.
dynamic update with rjs will be a great cast if you can. Thanks again Ryan.
Hey Ryan great ca$t, I was wondering if this was the bes appraoach to update a div with something like this:
<% @brands.each do |brand| %>
<%= link_to_remote(image_tag(brand.filename),:url => {:action => 'show_description', :id => brand}, :class => "description") %>
<%- end %>
pretty much passing the :id of brand to a partial how would one go about that?
@Phillip, that looks like it will work. If it doesn't you may want to post about this on railsforum.com.
lovin' the casts thanks Ryan. Just a small comment about manipulating DOMs using element proxies. There is one advantage of calling the DOM methods directly over page is that many DOM objects can be affect in one call like:
<code>
page.toggle :image_div, :text_div
</code>
vs.
<code>
page[:image_div].toggle
page[:text_div].toggle
</code>
How does the controller look like?
How does it know to render the rjs?
@morb, it isn't necessary to define the action in the controller. Rails will automatically look for a template with the name of the action (do_magic.rjs) and just render that. Nothing significant is in the controller.
Hi,
can somebody help me to test this:
page[:review_name].value = "this is cool"
with assert_select_rjs, or any other method will be appreciated.
Thanks
i think so be good
its so far so be good!
Hello.
How to change link_to_remote to work in Rails 3.0?
link_to 'Do magic', :remote => true, ??
How to call rjs file, to perform some onclick action?
Hi .. Superb blog post, I have book marked this internet site so ideally I see much more on this subject in the foreseeable future ! Very Good .. http://iqwfg.com
Can you make a new one, applying to the rails 3, please?
Don't touch rjs with a ten foot pole any more. It's completely deprecated and will break.