hi chaps - i''ve got a project where I have very limited resources on the device rails runs on (raspberry pi) - basically i have rails server running… then periodically i fire off rails runner Model.method (from an external program on the device)…. all works fine but it''s terribly slow - I think it''s because every time runner fires it''s starting up a whole new rails environment - is that assumption correct ? After that - what''s a better way ? I mean I could use delayed job right ? but I don''t see how that would help as the environment would still have to be loaded each time - that right ? -- 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-/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-US.
Try create just a ruby script and include ''rubygems'' and ''active_record'': |#!/path/to/ruby ||require''rubygems''| |require''active_record''| You must include all the models you need also. Then give execute permission to your script: |chmod a+x myscript.rb| -- Nielson Rolim nielson.rolim-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org On 01-07-2012 08:15, bingo bob wrote:> hi chaps - i''ve got a project where I have very limited resources on the > device rails runs on (raspberry pi) - basically i have rails server > running… then periodically i fire off rails runner Model.method (from > an external program on the device)…. all works fine but it''s terribly > slow - I think it''s because every time runner fires it''s starting up a > whole new rails environment - is that assumption correct ? > > After that - what''s a better way ? > > I mean I could use delayed job right ? but I don''t see how that would > help as the environment would still have to be loaded each time - that > right ? >-- 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-US.
On Jul 1, 2012, at 5:37 AM, Nielson Rolim wrote:> Try create just a ruby script and include ''rubygems'' and ''active_record'':You might also want (for the connection follow what''s in your database.yml): ActiveRecord::Base.establish_connection({ adapter: ... }) And you might want to require logger, and: ActiveRecord::Base.logger = Logger.new(STDOUT) -- Scott Ribe scott_ribe-ZCQMRMivIIdUL8GK/JU1Wg@public.gmane.org http://www.elevated-dev.com/ (303) 722-0567 voice -- 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-US.