I need to create a temporary, in memory, Sqlite3 database... plus I want all the AR goodness to go with. Oh, and I don''t want to affect existing AR models or schemas. I''m close, but I don''t know how to create a schema just for my temporary database so that it won''t affect other model''s schemas. In other words, I only want this schema/model to be active during a single method execution. class PlsTemp < ActiveRecord::Base; end PlsTemp.establish_connection(:adapter => "sqlite3", :database => ":memory:" ) How to I create the schema for PlsTemp? -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
I gave up. Not sure this can even be done in AR, at least not without a fair amount of custom sql. Went with creating a temporary table in production database (postgresql). Not as fast as sqlite/memory, but acceptable. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On Jan 19, 2010, at 10:47 PM, Karl Smith wrote:> > I gave up. Not sure this can even be done in AR, at least not without > a fair amount of custom sql. > > Went with creating a temporary table in production database > (postgresql). Not as fast as sqlite/memory, but acceptable.Have you considered ActiveRecord::Migration? You might also look at the code for the db:schema:load rake task. HTH -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.