Skip to content

Instantly share code, notes, and snippets.

@danreedy
Created April 20, 2011 17:40
Show Gist options
  • Save danreedy/932095 to your computer and use it in GitHub Desktop.
Save danreedy/932095 to your computer and use it in GitHub Desktop.
Original Places Controller create method
def create
@place = Place.new(params[:place])
new_was_successful = @place.save
if new_was_successful
respond_with(@place) do |format|
format.html { redirect_to( @place, :notice => "Great, this coke was saved!" ) }
record = SimpleGeo::Record.new({
:id => @place.id,
:created => Time.now,
:lon => params[:place][:longitude],
:lat => params[:place][:latitude],
:layer => 'com.getcoke.testdata',
:properties => {
:name => params[:place][:"place_name"],
:notes => params[:place][:notes],
:address => params[:place][:address],
:city => params[:place][:city],
:state => params[:place][:state],
:zip => params[:place][:zip]
}
})
SimpleGeo::Client.add_record(record)
end
else
render :action => :new
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment