RailsCasts Pro episodes are now free!
Learn more or hide this
Resources
gem 'best_in_place'
//= require jquery.purr //= require best_in_place
jQuery -> $('.best_in_place').best_in_place()
<p> <b>Name:</b> <%= best_in_place @user, :name %> </p> <p> <b>Email:</b> <%= best_in_place @user, :email %> </p> <p> <b>Gender:</b> <%= best_in_place @user, :gender, type: :select, collection: [["Male", "Male"], ["Female", "Female"], ["", "Unspecified"]] %> </p> <p> <b>Public profile:</b> <%= best_in_place @user, :public_profile, type: :checkbox, collection: %w[No Yes] %> </p> <p> <%= best_in_place @user, :bio, type: :textarea %> </p>
respond_to :html, :json def update @user = User.find(params[:id]) @user.update_attributes(params[:user]) respond_with @user end
.purr { position: fixed; top: 30px; right: 100px; width: 250px; padding: 20px; background-color: #FCC; border: solid 2px #C66; &:first-letter { text-transform: uppercase; } }