Rails 3 and RJS

I am using rails 3.0.0.beta p>

Is there any new syntax for writing RJS, here is an example

  def remote_create
    @photo = Photo.new(params[:photo])

    respond_to do |format|
      if @photo.save
        # add @photo 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
+5
source share
2 answers

here is the screencast http://railscasts.com/episodes/205-unobtrusive-javascript

UPDATE April 2011: RJS retrieved for Rails 3.1

prototype rails will be a gem when Rails 3.1 is missing

Applications using RJS should add this line to their Gemfile, working with the Rails Wizard before release 3.1:

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

Further information on ruby ​​on rails can be found in this article.

github rail prototypes

+11
source

- rails 3 irt rjs, railscasts.com - 3 , - , / js , .

0

All Articles