Method: Osm::FlexiRecord::Column#delete
- Defined in:
- lib/osm/flexi_record.rb
#delete(api) ⇒ Boolean
Delete a column in OSM
191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 |
# File 'lib/osm/flexi_record.rb', line 191 def delete(api) require_ability_to(api, :write, :flexi, flexi_record.section_id) raise Osm::Forbidden, 'this column is not editable' unless self.editable data = api.perform_query("extras.php?action=deleteColumn§ionid=#{flexi_record.section_id}&extraid=#{flexi_record.id}", { 'columnId' => self.id, }) if (data.is_a?(Hash) && data.has_key?('config')) ActiveSupport::JSON.decode(data['config']).each do |f| if f['id'] == self.id # It wasn't deleted return false end end end # The cached columns for the flexi record will be out of date - remove them cache_delete(api, ['flexi_record_columns', flexi_record.id]) return true end |