Skip to content

Instantly share code, notes, and snippets.

@joshuamiller
Forked from lukesh/gist:753527
Created December 23, 2010 21:30
Show Gist options
  • Save joshuamiller/753565 to your computer and use it in GitHub Desktop.
Save joshuamiller/753565 to your computer and use it in GitHub Desktop.
def create
respond_to do |format|
if @my_model.save
format.json do
render :json => @my_model.to_json(:methods => [:owner_name]) #owner_name is a method that returns owner.display_name
end
end
format html { ... }
else
format.json { errors... }
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment