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



38
39
40
41
42
# File 'lib/gtfs_engine/concerns/controllers/gtfs.rb', line 38

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



33
34
35
36
# File 'lib/gtfs_engine/concerns/controllers/gtfs.rb', line 33

def gtfs_id(id=nil)
  @gtfs_id = id unless id.nil?
  @gtfs_id or 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



46
47
48
49
50
# File 'lib/gtfs_engine/concerns/controllers/gtfs.rb', line 46

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