Created
April 5, 2011 06:26
-
-
Save amster/903121 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
def create | |
@my_model = MyModel.new(params[:my_model]) | |
respond_to do |format| | |
if @my_model.save | |
format.html { redirect_to(my_models_path, :notice => 'Success') } | |
format.js { render :json => { :success => true, :message => "Success"} } | |
format.xml { render :xml => @my_model, :status => :created, :location => @my_model } | |
else | |
format.html { render :action => "new" } | |
format.js { render :json => { :success => false, :message => "Fail"} } | |
format.xml { render :xml => @my_model.errors, :status => :created, :location => @my_model } | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment