How can I load fixture data in the Rails Console for quick testing?
On Sun, 2008-07-06 at 18:04 +0200, Bharat R. wrote:
How can I load fixture data in the Rails Console for quick testing?
I do this to populate my ‘rights’ table…
require 'active_record/fixtures'
directory = File.join(File.dirname(__FILE__), "test/fixtures")
Fixtures.create_fixtures(directory, "rights")
Craig
Hi Craig.
Wouldn’t “rake db:fixtures:load FIXTURES=rights” give you the same
result (with less typing)?
Best.
Mike
probably…I’m i the console anyway deleting the current contents of the
table and updating it.
Craig
Sorry gentlemen. I should be more precise in asking my questions. This
is very useful information. However, what I meant to ask is how do I
populate a class instance from the fixture data in Rails console without
going to the database. Is there a more direct way of doing that?
Thanks.
Bharat