Method: Osm::Event#add_column
- Defined in:
- lib/osm/event.rb
#add_column(api, name, label = '', required = false) ⇒ Boolean
Add a column to the event in OSM
450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 |
# File 'lib/osm/event.rb', line 450 def add_column(api, name, label='', required=false) require_ability_to(api, :write, :events, section_id) raise Osm::ArgumentIsInvalid, 'name is invalid' if name.blank? data = api.perform_query("events.php?action=addColumn§ionid=#{section_id}&eventid=#{id}", { 'columnName' => name, 'parentLabel' => label, 'parentRequire' => (required ? 1 : 0), }) # The cached events for the section will be out of date - remove them cache_delete(api, ['events', section_id]) cache_delete(api, ['event', id]) cache_delete(api, ['event_attendance', id]) self.columns = self.class.new_event_from_data(data).columns return data.is_a?(Hash) && (data['eventid'].to_i == id) end |