Rails 3和RJS

我使用rails 3.0.0.beta

是否有任何新的语法来编写RJS,这是一个例子

def remote_create @photo = Photo.new(params[:photo]) respond_to do |format| if @photo.save # add @photo's thumbnail to last import tag format.js { render :update do |page| page.insert_html :bottom, 'polaroids' , :partial => 'polaroid', :locals => {:photo => @photo} end } else #... end end end 

这是截屏videohttp://railscasts.com/episodes/205-unobtrusive-javascript

更新2011年4月:正在为Rails 3.1提取RJS

当Rails 3.1出局时,prototype-rails将成为一个gem

使用RJS的应用程序必须将此行添加到他们的Gemfile,同时在3.1版本之前使用Rails master:

 gem 'prototype-rails', :git => 'git://github.com/rails/prototype-rails.git' 

有关ruby on rails的更多信息可以在本文中找到

github上的prototype-rails

不确定rails 3 irt rjs的任何语法更改,但我建议跟随railscasts.com – 他一直在发布rails 3的所有新function的video,如果有任何关于如何渲染/处理js的更新我是他肯定会做一集。