Module: ActiveRecord::HelperMethods::ModelHelperMethods

Defined in:
lib/active_record/helper_methods/model_helper_methods.rb

Instance Method Summary collapse

Instance Method Details

#add_accessor_methods(column:, values:) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/active_record/helper_methods/model_helper_methods.rb', line 15

def add_accessor_methods(column:, values:)
  validate_params(column: column, values: values)

  values.each do |value|
    define_accessor_method(column, value)
  end
end

#add_finder_methods(column:, values:) ⇒ Object



23
24
25
26
27
28
29
# File 'lib/active_record/helper_methods/model_helper_methods.rb', line 23

def add_finder_methods(column:, values:)
  validate_params(column: column, values: values)

  values.each do |value|
    define_finder_method(column, value)
  end
end

#add_helper_methods(column:, values:) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/active_record/helper_methods/model_helper_methods.rb', line 6

def add_helper_methods(column:, values:)
  validate_params(column: column, values: values)

  values.each do |value|
    define_accessor_method(column, value)
    define_finder_method(column, value)
  end
end