Skip to content

Instantly share code, notes, and snippets.

@igorT
Created July 26, 2011 06:40
Show Gist options
  • Save igorT/1106132 to your computer and use it in GitHub Desktop.
Save igorT/1106132 to your computer and use it in GitHub Desktop.
# GET /locations/new¬
# GET /locations/new.xml¬
def new¬
@location = Location.new¬
3.times {@location.location_images.build} ¬
respond_to do |format|¬
format.html # new.html.erb¬
format.xml { render :xml => @location }¬
end¬
end¬
¬
# GET /locations/1/edit¬
def edit¬
@location = Location.find(params[:id])¬
3.times { @location.location_images.build }¬
end¬
¬
# POST /locations¬
# POST /locations.xml¬
def create¬
@location = Location.new(params[:location])¬
¬
respond_to do |format|¬
if @location.save¬
format.html { redirect_to(@location, :notice => 'Location was successfully created.') }¬
format.xml { render :xml => @location, :status => :created, :location => @location }¬
else¬
format.html { render :action => "new" }¬
format.xml { render :xml => @location.errors, :status => :unprocessable_entity }¬
end¬
end¬
end¬
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment