Skip to content

Instantly share code, notes, and snippets.

@malomalo
Created July 29, 2009 01:12
Show Gist options
  • Save malomalo/157795 to your computer and use it in GitHub Desktop.
Save malomalo/157795 to your computer and use it in GitHub Desktop.
def create
@store = Store.new(params[:store])
respond_to do |format|
if @store.save
flash[:notice] = 'Store was successfully created.'
format.html { redirect_to(@store) }
format.xml { render :xml => @store, :status => :created, :location => @store }
format.js {
render :json => {:success=>true,:content=>"<div><strong>found </strong></div>"}
}
else
format.html { render :action => "new" }
format.xml { render :xml => @store.errors, :status => :unprocessable_entity }
format.js do
render :json => {:success=>false,:content=>"Could not save the store"}
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment