Module: GtfsEngine::Concerns::Controllers::Gtfs::ClassMethods
- Defined in:
- lib/gtfs_engine/concerns/controllers/gtfs.rb
Instance Method Summary collapse
- #filters(*attrs) ⇒ Object
-
#gtfs_id(id = nil) ⇒ Symbol
The unique key for this GTFS association.
-
#record_class ⇒ Class
The
ActiveRecord::Baseclass associated with this controller.
Instance Method Details
#filters(*attrs) ⇒ Object
40 41 42 43 44 |
# File 'lib/gtfs_engine/concerns/controllers/gtfs.rb', line 40 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.
34 35 36 37 |
# File 'lib/gtfs_engine/concerns/controllers/gtfs.rb', line 34 def gtfs_id(id=nil) @gtfs_id = id unless id.nil? @gtfs_id or controller_name.singularize.foreign_key end |
#record_class ⇒ Class
Returns the ActiveRecord::Base class associated with this controller.
49 50 51 52 53 |
# File 'lib/gtfs_engine/concerns/controllers/gtfs.rb', line 49 def record_class @record_class ||= begin "#{name.deconstantize}::#{controller_name.classify}".constantize end end |