Module: Devise::Generators::OrmHelpers

Defined in:
lib/generators/wirecard/orm_helpers.rb

Instance Method Summary collapse

Instance Method Details

#model_contentsObject


4
5
6
7
8
9
10
11
12
13
14
# File 'lib/generators/wirecard/orm_helpers.rb', line 4

def model_contents
  buffer = <<-CONTENT


CONTENT
  buffer += <<-CONTENT if needs_attr_accessible?


CONTENT
  buffer
end

#needs_attr_accessible?Boolean

Returns:

  • (Boolean)

16
17
18
# File 'lib/generators/wirecard/orm_helpers.rb', line 16

def needs_attr_accessible?
  rails_3? && !strong_parameters_enabled?
end

#rails_3?Boolean

Returns:

  • (Boolean)

20
21
22
# File 'lib/generators/wirecard/orm_helpers.rb', line 20

def rails_3?
  Rails::VERSION::MAJOR == 3
end

#strong_parameters_enabled?Boolean

Returns:

  • (Boolean)

24
25
26
# File 'lib/generators/wirecard/orm_helpers.rb', line 24

def strong_parameters_enabled?
  defined?(ActionController::StrongParameters)
end