Method: Governor::Mapping#initialize
- Defined in:
- lib/governor/mapping.rb
#initialize(resource, options = {}) ⇒ Mapping
Returns a new instance of Mapping.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/governor/mapping.rb', line 6 def initialize(resource, = {}) @plural = ([:as] ? "#{[:as]}_#{resource}" : resource).to_sym @singular = ([:singular] || @plural.to_s.singularize).to_sym @class_name = ([:class_name] || resource.to_s.classify).to_s @ref = defined?(ActiveSupport::Dependencies::ClassCache) ? ActiveSupport::Dependencies::Reference.store(@class_name) : ActiveSupport::Dependencies.ref(@class_name) @path = ([:path] || resource).to_s @path_prefix = [:path_prefix] @controller = [:controller] || 'governor/articles' end |