Hi,
So as I’ve said before, I’m coming to Rails from ColdFusion. In
ColdFusion 8, there is are strong, albeit somewhat templated AJAX
features.
What sort of options are out there for AJAX with Rails?
Thanks,
Ron
Hi,
So as I’ve said before, I’m coming to Rails from ColdFusion. In
ColdFusion 8, there is are strong, albeit somewhat templated AJAX
features.
What sort of options are out there for AJAX with Rails?
Thanks,
Ron
Ron wrote:
What sort of options are out there for AJAX with Rails?
http://www.google.com/search?q=rails+ajax
“Lots”
The “keyword” you may want to look into is “rjs templates”. These are
ruby templates that allow you to “render” ajax actions and javascript
effects. Other useful keywords to look into:
Also, look here:
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html
http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper.html
It may take a little bit of time to become familiar but it is
surprisingly easy to use javascript and ajax rails.
def create
@post = Post.new(params[:post])
respond_to do |format|
if @post.save
format.js # renders create.js.rjs template
else
#…
end
end
end
page.insert_html :bottom, ‘posts-list’, :partial => “post_item”, :object
=> @post
That is a quick example of how easy it is to set up an rjs action. That
is the basic code for having someone create a post which shows up on
screen using ajax to load the new post.
Definately check out:
Unobstrusive Javascript for Rails. Awesome plugin that allows for
applying those principles with rjs.
Hi Ron, coming from CF myself, I’ve faced the same issues. I
originally tried using RJS (baked into rails), but it left me with the
same feeling of using cfform tags. I’m also a fan of unobtrusive
javascript and I couldn’t find an easy way to use those principles
with rjs.
Currently, I’m creating a new app that uses dojo toolkit. It’s an app
all done on one page (the public/index.html file) that uses all the
rails controllers as json providers.
I like not being tied to one library.
On 12 Mar 2008, at 00:44, Nathan E. wrote:
Definately check out:
Unobstrusive Javascript for Rails. Awesome plugin that allows for
applying those principles with rjs.
It’s not supported anymore, Dan W. posted his reasons and he’s
perfectly right. Use LowPro instead and do it in Javascript itself.
Using Rails 2 it’s perfectly possible to generate javascript with erb
parsing and combining that with LowPro, you have a pretty powerful
tool at hand.
Best regards
Peter De Berdt
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs