How can I load fixture data in the Rails Console for quick testing? -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Sun, 2008-07-06 at 18:04 +0200, Bharat Ruparel 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 --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Hi Craig. Wouldn''t "rake db:fixtures:load FIXTURES=rights" give you the same result (with less typing)? Best. Mike On Jul 6, 2008, at 1:11 PM, Craig White wrote:> > On Sun, 2008-07-06 at 18:04 +0200, Bharat Ruparel 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 > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Craig White
2008-Jul-06 19:55 UTC
Re: ****[Rails] Re: ****[Rails] Fixture data in the rails console
probably...I''m i the console anyway deleting the current contents of the table and updating it. Craig On Sun, 2008-07-06 at 15:20 -0400, Michael Breen wrote:> Hi Craig. > Wouldn''t "rake db:fixtures:load FIXTURES=rights" give you the same > result (with less typing)? > > Best. > Mike > > On Jul 6, 2008, at 1:11 PM, Craig White wrote: > > > > > On Sun, 2008-07-06 at 18:04 +0200, Bharat Ruparel 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 > > > > > > > > > > >--~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Bharat Ruparel
2008-Jul-06 20:30 UTC
Re: ****[Rails] Re: ****[Rails] Fixture data in the rails co
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 -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---