3 ms·
I hate those auto-generated find methods as well. So i don't use them. I don't understand why this negatively impacts your experience. +1 on the lack of suppor
by gfunk911 16y ago
I hate those auto-generated find methods as well. So i don't use them. I don't understand why this negatively impacts your experience.
+1 on the lack of support for views. You can kludge things together, but its not pleasant.
You're making the associations sound much more complex than they are. Once an association relationship becomes too complex, you always have the option of just declaring simpler association and stitching together the complexity manually. Maybe I'm completely wrong, but in most places i do feel that Rails degrades reasonably, so that you always have the option of doing something the more verbose/manual way. In something like asp.net, I find that it either just works, or you're up st creek.
- xentronium 16y agoMain reason they used those find_by / find_all_by methods is that there's no good way to shortly express one-field finder. Compare DM: Article.first(:author => person) AR: Article.first(:conditions => {:author_id => person.id}) AR shortcut: Article.find_by_author_id(person.id) AREL: Article.where(:author => person).first # not sure about that
- didip 16y agoThis is one thing that surprise me about Rails 3: AREL: Article.where(:author => person).first Why the sudden departure? Arel looks familiar to SqlAlchemy, Hibernate Query Language, and Sequel. And far from everything is an object in ActiveRecord. And why reinvent the wheel? http://sequel.rubyforge.org/ http://sequel.rubyforge.org/ have exists for a while now.
- xentronium 16y agoIt's been a long debate, and yes, it's almost like sequel. Actually, ARel positions itself into the same niche as sequel, i.e. low-level toolkit to build frameworks on. In my opinion, sequel is an absolute kick-ass sort of thing, it's just that ultra-cool if you have time and will to hack. Further reading: http://sequel.heroku.com/2010/02/06/arel-sequel-differences-part-1/ http://sequel.heroku.com/2010/02/06/arel-sequel-differences-... http://sequel.heroku.com/2010/02/10/arel-sequel-differences-part-2/ http://sequel.heroku.com/2010/02/10/arel-sequel-differences-... http://sequel.heroku.com/2010/02/23/the-benefits-without-the-costs/ http://sequel.heroku.com/2010/02/23/the-benefits-without-the... http://magicscalingsprinkles.wordpress.com/2010/01/28/why-i-wrote-arel/ http://magicscalingsprinkles.wordpress.com/2010/01/28/why-i-... -- note comments bout sequel