Hi! I am quite new to Ruby on Rails and I am loving it so far. I have to work on a project with MongoDB and I noticed a few tutorials tell us to generate a new app without the ActiveRecord. I wonder if it''s the best solution… Why isn''t a good idea to use ActiveRecord with Mongo? Maybe in the future, if we need to change the database, wouldn''t it just the case of changing the database settings if we use ActiveRecord? I think there would be some gems that would make the bridge between ActiveRecord <-> MongoDB transparent as they do with MySQL or Postgres. Innocent me? Also, because it''s schemeless, I am a bit lost when it comes to the workflow. Migrations are no longer necessary, right? So what would be the best workflow? We are probably going to use MongoID, but maybe MongoMapper. So, let''s say… Should I create a model, configure the model accordingly to MongoID and then controller? Or scaffold / scaffold_controller (never used this one)? (To be honest I never knew what was better if scaffold or model and controller.) Hope I am not asking too much! Thanks. Thiago. -- 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. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/q5Q-hICaYsoJ. For more options, visit https://groups.google.com/groups/opt_out.
On Wednesday, October 10, 2012 5:03:25 PM UTC+1, Thiago Rossi wrote:> > Hi! > > I am quite new to Ruby on Rails and I am loving it so far. I have to work > on a project with MongoDB and I noticed a few tutorials tell us to generate > a new app without the ActiveRecord. I wonder if it''s the best solution… Why > isn''t a good idea to use ActiveRecord with Mongo? Maybe in the future, if > we need to change the database, wouldn''t it just the case of changing the > database settings if we use ActiveRecord? I think there would be some gems > that would make the bridge between ActiveRecord <-> MongoDB transparent as > they do with MySQL or Postgres. Innocent me? > > ActiveRecord is tied to the relational world at a a very deep level - itjust can''t talk to mongo and is unlikely ever to. Some other ORMs (such as data mapper) can handle both sql and nosql databases. Even with an ORM than handles both, my personal experience is that you can end up imposing your old relational habits on your non relational database which is non optimal.> Also, because it''s schemeless, I am a bit lost when it comes to the > workflow. Migrations are no longer necessary, right? So what would be the > best workflow? > > You no longer have schema update migrations (eg adding columns). You willoccasionally need to add indexes and you will still need data migrations if you change how store for your data (for example if you switch data from individual objects to embedded objects)> We are probably going to use MongoID, but maybe MongoMapper. So, let''s > say… Should I create a model, configure the model accordingly to MongoID > and then controller? Or scaffold / scaffold_controller (never used this > one)? (To be honest I never knew what was better if scaffold or model and > controller.) > > The controller / forms should be pretty much the same - that''s the pointof the ActiveModel interface that Active Record, MongoMapper, Mongoid conform to. Fred> >-- 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. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/KwDj-fu10iwJ. For more options, visit https://groups.google.com/groups/opt_out.
I think I didn''t realise ActiveRecord and ActiveModel were different things. Thank you! Migration was a good way to solve that problem with schemes being update, but when it becomes famous we stop using it. LOL On Wednesday, 10 October 2012 21:48:16 UTC+1, Frederick Cheung wrote:> > > > On Wednesday, October 10, 2012 5:03:25 PM UTC+1, Thiago Rossi wrote: >> >> Hi! >> >> I am quite new to Ruby on Rails and I am loving it so far. I have to work >> on a project with MongoDB and I noticed a few tutorials tell us to generate >> a new app without the ActiveRecord. I wonder if it''s the best solution… Why >> isn''t a good idea to use ActiveRecord with Mongo? Maybe in the future, if >> we need to change the database, wouldn''t it just the case of changing the >> database settings if we use ActiveRecord? I think there would be some gems >> that would make the bridge between ActiveRecord <-> MongoDB transparent as >> they do with MySQL or Postgres. Innocent me? >> >> ActiveRecord is tied to the relational world at a a very deep level - it > just can''t talk to mongo and is unlikely ever to. Some other ORMs (such as > data mapper) can handle both sql and nosql databases. Even with an ORM than > handles both, my personal experience is that you can end up imposing your > old relational habits on your non relational database which is non optimal. > > >> Also, because it''s schemeless, I am a bit lost when it comes to the >> workflow. Migrations are no longer necessary, right? So what would be the >> best workflow? >> >> You no longer have schema update migrations (eg adding columns). You will > occasionally need to add indexes and you will still need data migrations if > you change how store for your data (for example if you switch data from > individual objects to embedded objects) > > > >> We are probably going to use MongoID, but maybe MongoMapper. So, let''s >> say… Should I create a model, configure the model accordingly to MongoID >> and then controller? Or scaffold / scaffold_controller (never used this >> one)? (To be honest I never knew what was better if scaffold or model and >> controller.) >> >> The controller / forms should be pretty much the same - that''s the point > of the ActiveModel interface that Active Record, MongoMapper, Mongoid > conform to. > > Fred > >> >>-- 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. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/9qq7crD5rXkJ. For more options, visit https://groups.google.com/groups/opt_out.