Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #17 from pivotalzergling/master

Use `unscoped` to get all the things
  • Loading branch information...
commit 0635feff3afb7a8dcd57184b28fa416eee9c9492 2 parents 44335da + 1cc6ad6
@rdy authored
View
2  lib/fixture_builder/builder.rb
@@ -89,7 +89,7 @@ def dump_tables
fixtures = tables.inject([]) do |files, table_name|
table_klass = table_name.classify.constantize rescue nil
if table_klass
- rows = table_klass.all.collect(&:attributes)
+ rows = table_klass.unscoped { table_klass.all.collect(&:attributes) }
else
rows = ActiveRecord::Base.connection.select_all(select_sql % ActiveRecord::Base.connection.quote_table_name(table_name))
end
View
2  test/legacy_fixture_mode_fixture_generation_test.rb
@@ -10,6 +10,7 @@ def setup
fbuilder.legacy_fixtures = Dir[test_path("legacy_fixtures/*.yml"), test_path("other_legacy_fixture_set/*.yml")]
fbuilder.factory do
MagicalCreature.create(:name => "frank", :species => "unicorn")
+ MagicalCreature.create(:name => "loch ness monster", :species => "sea creature", :deleted => true)
end
end
@@ -38,6 +39,7 @@ def test_invalid_legacy_fixtures_created
def test_new_fixtures_are_created
assert_equal "frank", @@magical_creatures['frank']['name']
assert_equal "unicorn", @@magical_creatures['frank']['species']
+ assert_equal "loch ness monster", @@magical_creatures['loch_ness_monster']['name']
end
def test_legacy_fixtures_retain_fixture_name
View
2  test/test_helper.rb
@@ -26,6 +26,7 @@ def create_fixtures(*table_names, &block)
class MagicalCreature < ActiveRecord::Base
validates_presence_of :name, :species
+ default_scope :conditions => { :deleted => false }
end
def create_and_blow_away_old_db
@@ -38,6 +39,7 @@ def create_and_blow_away_old_db
ActiveRecord::Base.connection.create_table(:magical_creatures, :force => true) do |t|
t.column :name, :string
t.column :species, :string
+ t.column :deleted, :boolean, :default => false, :null => false
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.