Module: GtfsEngine::Concerns::Controllers::Gtfs::ClassMethods

Defined in:
lib/gtfs_engine/concerns/controllers/gtfs.rb

Instance Method Summary collapse

Instance Method Details

#filters(*attrs) ⇒ Object



22
23
24
25
26
# File 'lib/gtfs_engine/concerns/controllers/gtfs.rb', line 22

def filters(*attrs)
  attrs.flatten!
  @filters = attrs unless attrs.empty?
  @filters ||= []
end

#gtfs_id(id = nil) ⇒ Symbol

Returns the unique key for this GTFS association.

Returns:

  • (Symbol)

    the unique key for this GTFS association



17
18
19
20
# File 'lib/gtfs_engine/concerns/controllers/gtfs.rb', line 17

def gtfs_id(id = nil)
  @gtfs_id = id unless id.nil?
  @gtfs_id || controller_name.singularize.foreign_key
end

#record_classClass

Returns the ActiveRecord::Base class associated with this controller.

Returns:

  • (Class)

    the ActiveRecord::Base class associated with this controller



30
31
32
33
34
# File 'lib/gtfs_engine/concerns/controllers/gtfs.rb', line 30

def record_class
  @record_class ||= begin
    "#{name.deconstantize}::#{controller_name.classify}".constantize
  end
end