Class: Georeferences::GoogleMapsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Georeferences::GoogleMapsController
- Defined in:
- app/controllers/georeferences/google_maps_controller.rb
Instance Method Summary collapse
-
#create ⇒ Object
POST /georeferences/google_maps POST /georeferences/google_maps.json.
- #georeference_params ⇒ Object private
-
#new ⇒ Object
GET /georeferences/google_maps/new.
-
#set_data_model ⇒ Object
private
Over-ride the default model setting for this subclass.
Methods included from DataControllerConfiguration::ProjectDataControllerConfiguration
Instance Method Details
#create ⇒ Object
POST /georeferences/google_maps POST /georeferences/google_maps.json
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/georeferences/google_maps_controller.rb', line 14 def create @georeference = Georeference::GoogleMap.new(georeference_params) respond_to do |format| if @georeference.save format.html do flash[:notice] = 'Georeference was successfully created.' if params[:commit_and_next] redirect_to new_georeferences_google_map_path( georeference: { collecting_event_id: @georeference.collecting_event.next_without_georeference }) else redirect_to collecting_event_path(@georeference.collecting_event) end end format.json { render action: 'show', status: :created } else format.html { render :new } format.json { render json: @georeference.errors, status: :unprocessable_entity } end end end |
#georeference_params ⇒ Object (private)
39 40 41 42 43 44 45 46 |
# File 'app/controllers/georeferences/google_maps_controller.rb', line 39 def georeference_params params.require(:georeference).permit(:collecting_event_id, :type, :is_public, :geo_type, geographic_item_attributes: [:shape] ) end |
#new ⇒ Object
GET /georeferences/google_maps/new
5 6 7 8 9 10 |
# File 'app/controllers/georeferences/google_maps_controller.rb', line 5 def new p = georeference_params p[:collecting_event] = CollectingEvent.new if p['collecting_event_id'].blank? p[:geographic_item] = GeographicItem.new # not required in present state - if p['geographic_item_id'].blank? @georeference = Georeference::GoogleMap.new(p) end |
#set_data_model ⇒ Object (private)
Over-ride the default model setting for this subclass
49 50 51 |
# File 'app/controllers/georeferences/google_maps_controller.rb', line 49 def set_data_model @data_model = Georeference::GoogleMap end |