Rails 3 and RJS

Posted by Denis on Stack Overflow See other posts from Stack Overflow or by Denis
Published on 2010-03-13T17:45:37Z Indexed on 2010/03/13 17:55 UTC
Read the original article Hit count: 768

Filed under:
|
|
|

Hi,

I use the rails 3.0.0.beta

Is there any new syntax to write RJS, here is an example

  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

© Stack Overflow or respective owner

Related posts about ruby

Related posts about ruby-on-rails