saasbook

edit_update_with_respond_to.rb

Mar 13th, 2014
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 0.25 KB | None | 0 0
  1. def update
  2.   @movie = Movie.find params[:id]
  3.   @movie.update_attributes!(params[:movie])
  4.   respond_to do |client_wants|
  5.     client_wants.html {  redirect_to movie_path(@movie)  } # as before
  6.     client_wants.xml  {  render :xml => @movie.to_xml    }
  7.   end
  8. end
Add Comment
Please, Sign In to add comment