Created
April 30, 2012 19:31
-
-
Save tghastings/2561876 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## show.html.erb | |
<p> | |
<b>Title:</b> | |
<%= editable_field @project, :title %> | |
</p> | |
<p> | |
##project_controller.rb | |
def update | |
@project = Project.find(params[:id]) | |
@project.update_attributes!(params[:project]) | |
respond_to do |format| | |
if request.xhr? | |
# *** repond with the new value *** | |
render :text => params[:project].values.first | |
else | |
redirect_to(@project, :notice => 'P was successfully updated.') | |
end | |
end | |
end | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment