module ActiveFixture::Loader::ClassMethods
Public Instance Methods
fixture_path(clazz)
click to toggle source
# File lib/active_fixture/loader.rb, line 28 def fixture_path(clazz) "#{Rails.root}/config/fixtures/#{clazz.name.underscore.pluralize}.yml" end
has_fixture?(clazz)
click to toggle source
# File lib/active_fixture/loader.rb, line 24 def has_fixture?(clazz) File.exist? fixture_path(clazz) end
inherited(base)
click to toggle source
# File lib/active_fixture/loader.rb, line 13 def inherited(base) self.load_fixtures(base) end
load_fixtures(clazz)
click to toggle source
# File lib/active_fixture/loader.rb, line 17 def load_fixtures(clazz) if has_fixture?(clazz) source = YAML.load_file(fixture_path(clazz)).with_indifferent_access clazz.fixtures = source[clazz.name.underscore.pluralize] end end