159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
|
# File 'app/controllers/ish_manager/maps_controller.rb', line 159
def update
authorize! :update, @map
if params[:image]
image = ::Ish::ImageAsset.new :image => params[:image]
@map.image = image
image.save
end
@map.config = JSON.parse map_params[:config]
if map_marker_params.present?
markers = Marker.where( destination: @map )
markers.each do |m|
map_marker_params.each do |k, v|
m.update_attribute(k, v)
end
end
end
if map_params[:parent_slug].present?
@map.parent = ::Gameui::Map.find_by({ slug: map_params[:parent_slug] })
else
@map.parent = nil
end
respond_to do |format|
if @map.update(map_params)
format.html do redirect_to edit_map_path(@map), notice: 'Map was successfully updated.'
end
else
format.html do
render :edit
end
end
end
end
|