Method: Fixie::Model#fixture_db_name

Defined in:
lib/fixie.rb

#fixture_db_nameSymbol

This method determines which database is used to load the fixture. The default implementation is to check the class to see if it has a namespace, like ‘Foo::Bar’, and if it does, return :foo. If it does not have a namespace, it will return :default.

You should override this method if you have multiple databases in your app and you have a different way of determining the DB name based on the class.

Returns:

  • (Symbol)

    The db name for this class



180
181
182
183
184
185
186
# File 'lib/fixie.rb', line 180

def fixture_db_name
  if match_data = name.match(/([^:]+)::/)
    match_data[1].to_sym
  else
    :default
  end
end