Created
July 26, 2011 06:40
-
-
Save igorT/1106132 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
# 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