Hi Folks, I am newbie to RoR, and I was looking for a way to do the following: 1. Run a service that provides a RESTful API. 2. Use the rails ORM (it is really convenient) 3. Keep the models up to date with data from another source on the system (in addition to updates to the models via rails controllers). Now, RoR is great for 1 and 2. For 3, I am thinking of writing a daemon, but the daemon needs access to the database (possibly via the Rails ORM). Another constraint is that I am using a JRuby-based system. Has anybody attempted something like this before? What have you used? Please share your experiences. Thanks, Radhesh -- 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.
Hassan Schroeder
2010-Jun-24 23:07 UTC
Re: Rails models + database updates from outside rails
On Thu, Jun 24, 2010 at 2:00 PM, Radhesh Kamath <rmk.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> I am newbie to RoR, and I was looking for a way to do the following:> 3. Keep the models up to date with data from another source on the > system (in addition to updates to the models via rails controllers). > > Now, RoR is great for 1 and 2. For 3, I am thinking of writing a > daemon, but the daemon needs access to the database (possibly via the > Rails ORM).You almost certainly want to use the same ORM to access the DB so the same business logic (validations, etc.) is used. Your use case is pretty vague, but sure, daemon, cron job, whatever works. :-)> Another constraint is that I am using a JRuby-based system.Shouldn''t matter.> Has anybody attempted something like this before?No different than using script/runner for one-offs or cron jobs, or the Rails console, etc. FWIW, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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.
Radhesh Kamath
2010-Jun-25 05:00 UTC
Re: Rails models + database updates from outside rails
On Thu, Jun 24, 2010 at 4:07 PM, Hassan Schroeder <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> On Thu, Jun 24, 2010 at 2:00 PM, Radhesh Kamath <rmk.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> I am newbie to RoR, and I was looking for a way to do the following: > >> 3. Keep the models up to date with data from another source on the >> system (in addition to updates to the models via rails controllers). >> >> Now, RoR is great for 1 and 2. For 3, I am thinking of writing a >> daemon, but the daemon needs access to the database (possibly via the >> Rails ORM). > > You almost certainly want to use the same ORM to access the DB > so the same business logic (validations, etc.) is used. > > Your use case is pretty vague, but sure, daemon, cron job, whatever > works. :-) >So a daemon goes into the lib directory and can be started whenever Rails starts?>> Another constraint is that I am using a JRuby-based system.I heard that the ''daemon'' ruby gem works only for MRI and not on JRuby, is that true?> > Shouldn''t matter. > >> Has anybody attempted something like this before? > > No different than using script/runner for one-offs or cron jobs, or the > Rails console, etc. > > FWIW, > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > twitter: @hassan > > -- > 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. > >-- 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.
Hassan Schroeder
2010-Jun-25 14:15 UTC
Re: Rails models + database updates from outside rails
On Thu, Jun 24, 2010 at 10:00 PM, Radhesh Kamath <rmk.list-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> So a daemon goes into the lib directory and can be started whenever > Rails starts?If that''s what you want to do, sure.>>> Another constraint is that I am using a JRuby-based system. > > I heard that the ''daemon'' ruby gem works only for MRI and not on > JRuby, is that true?Yes, but googling "jruby daemon process" will get you lots of possible alternatives. -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org twitter: @hassan -- 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.