Class: Seedie::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/seedie/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



7
8
9
10
# File 'lib/seedie/configuration.rb', line 7

def initialize
  @default_count = nil
  @custom_attributes = {}
end

Instance Attribute Details

#custom_attributesObject

Returns the value of attribute custom_attributes.



5
6
7
# File 'lib/seedie/configuration.rb', line 5

def custom_attributes
  @custom_attributes
end

#default_countObject

Returns the value of attribute default_count.



5
6
7
# File 'lib/seedie/configuration.rb', line 5

def default_count
  @default_count
end

Instance Method Details

#prepare_custom_attributes_for(*models) ⇒ Object

Prepares the custom_attributes hash for the specified models.

This method ensures that the necessary keys exist in the custom_attributes hash. This prevents NoMethodError when setting model-specific custom attributes.

Example usage: config.prepare_custom_attributes_for :user, :account

Then this will work: config.custom_attributes[:name] = “Name” config.custom_attributes[:email] = “[email protected]



24
25
26
27
28
# File 'lib/seedie/configuration.rb', line 24

def prepare_custom_attributes_for(*models)
  models.inject(@custom_attributes) do |hash, key|
    hash[key] ||= {}
  end
end