Can someone remind me of the incantation to use ActiveRecord in a plain ruby program for the versions specified. I''m not having any luck searching with google and I keep getting: `require'': no such file to load -- activerecord (LoadError) Not sure if this is a dependency or file path problem. Thanks -- 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.
> Can someone remind me of the incantation to use ActiveRecord in a > plain ruby program for the versions specified. I''m not having any luck > searching with google and I keep getting: > > `require'': no such file to load -- activerecord (LoadError) >have you tried: require ''rubygems'' require ''active_record'' D:\>irb irb(main):001:0> require ''rubygems'' => true irb(main):002:0> require ''active_record'' => true irb(main):003:0> exit D:\>rails -v Rails 3.0.1 -- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
require ''active_record'' ? On Wed, Oct 27, 2010 at 2:09 PM, dwormuth <dwormuth-cIpcPs7DjqbWs/AcZQh2Cw@public.gmane.org> wrote:> Can someone remind me of the incantation to use ActiveRecord in a > plain ruby program for the versions specified. I''m not having any luck > searching with google and I keep getting: > > `require'': no such file to load -- activerecord (LoadError) > > Not sure if this is a dependency or file path problem. > > Thanks > > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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 tried this too, but when I put it in an .rb file, I get the error above. -- 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.
Assuming there is a table named "posts", this code will work: require ''rubygems'' gem ''activerecord'', ''3.0.1'' require ''active_record'' ActiveRecord::Base.establish_connection( :adapter => "sqlite3", :database => "/users/dwormuth/sites/rails/testrails/db/ development.sqlite3" ) class Post < ActiveRecord::Base end post = Post.find(1) puts post.name puts "It worked" On Oct 27, 8:37 pm, dwormuth <dworm...-cIpcPs7DjqbWs/AcZQh2Cw@public.gmane.org> wrote:> I tried this too, but when I put it in an .rb file, I get the error > above.-- 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@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.