Class: RailsI18nManager::Forms::Base
- Inherits:
-
Object
- Object
- RailsI18nManager::Forms::Base
- Includes:
- ActiveModel::Validations
- Defined in:
- app/lib/rails_i18n_manager/forms/base.rb
Direct Known Subclasses
Instance Method Summary collapse
-
#initialize(attrs = {}) ⇒ Base
constructor
A new instance of Base.
- #model_name ⇒ Object
- #to_key ⇒ Object
Constructor Details
#initialize(attrs = {}) ⇒ Base
Returns a new instance of Base.
6 7 8 9 10 11 12 |
# File 'app/lib/rails_i18n_manager/forms/base.rb', line 6 def initialize(attrs={}) attrs ||= {} attrs.each do |k,v| self.send("#{k}=", v) ### Use send so that it checks that attr_accessor has already defined the method so its a valid attribute end end |
Instance Method Details
#model_name ⇒ Object
18 19 20 21 |
# File 'app/lib/rails_i18n_manager/forms/base.rb', line 18 def model_name sanitized_class_name = self.class.name.to_s.gsub("Forms::", '').gsub(/Form$/, '') ActiveModel::Name.new(self, self.class.superclass, sanitized_class_name) end |
#to_key ⇒ Object
14 15 16 |
# File 'app/lib/rails_i18n_manager/forms/base.rb', line 14 def to_key nil end |