Module: Devise::Generators::OrmHelpers
- Defined in:
- lib/generators/devise/orm_helpers.rb
Instance Method Summary collapse
- #model_contents ⇒ Object
- #needs_attr_accessible? ⇒ Boolean
- #rails_3? ⇒ Boolean
- #strong_parameters_enabled? ⇒ Boolean
Instance Method Details
#model_contents ⇒ Object
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/generators/devise/orm_helpers.rb', line 4 def model_contents buffer = <<-CONTENT # Include default devise modules. Others available are: # :confirmable, :lockable, :timeoutable and :omniauthable devise :database_authenticatable, :registerable, :recoverable, :rememberable, :trackable, :validatable CONTENT buffer += <<-CONTENT if needs_attr_accessible? # Setup accessible (or protected) attributes for your model attr_accessible :email, :password, :password_confirmation, :remember_me CONTENT buffer end |
#needs_attr_accessible? ⇒ Boolean
20 21 22 |
# File 'lib/generators/devise/orm_helpers.rb', line 20 def needs_attr_accessible? rails_3? && !strong_parameters_enabled? end |
#rails_3? ⇒ Boolean
24 25 26 |
# File 'lib/generators/devise/orm_helpers.rb', line 24 def rails_3? Rails::VERSION::MAJOR == 3 end |
#strong_parameters_enabled? ⇒ Boolean
28 29 30 |
# File 'lib/generators/devise/orm_helpers.rb', line 28 def strong_parameters_enabled? defined?(ActionController::StrongParameters) end |