I’m a Django/Catalyst user that’s evaluating Rails … I need a Ruby
framework, and I’m trying to see if learning Rails is worth it or I
should just go for Sinatra + various libs available.
Django has a couple of things I like …
- the Forms API
In Django I like that it’s being decoupled from models … form
objects have fields with validation rules that also can contain html
rendering logic … you can use them just to validate a request and
that validation can contain business rules that don’t make sense to
have in the actual models. But the forms API can also infer those
validation rules straight from models, so you have DRY.
Looking at Rails tutorials I can’t find this decoupling. Validation
rules are placed straight into models … like
“validates_confirmation_of :password”.
So I was wondering about Rails3 … seeing there’s a new ActiveModel
abstraction of the ActiveRecord interface, can I use that to have the
desired effect?
Also, where can I find some good and up to date tutorials on Rails3 ?
- ORM lazyness
I like that Django’s ORM and in DBIx::Class, the resultsets
constructed are lazy. I see that in Rails 3 there’s a new Query
API … http://m.onkey.org/2010/1/22/active-record-query-interface
Is that ready for use, is it development?
Or should I just use something like Sequel … can that be plugged-in
to Rails?
Thanks,
–
Alex
On Thu, May 27, 2010 at 8:01 AM, Alexandru N. [email protected] wrote:
rendering logic … you can use them just to validate a request and
that validation can contain business rules that don’t make sense to
have in the actual models. But the forms API can also infer those
validation rules straight from models, so you have DRY.
Looking at Rails tutorials I can’t find this decoupling. Validation
rules are placed straight into models … like
“validates_confirmation_of :password”.
I don’t know anything about Django, and I don’t really understand what
you are trying to do. Business logic is meant to be “straight into
models”.
So I was wondering about Rails3 … seeing there’s a new ActiveModel
abstraction of the ActiveRecord interface, can I use that to have the
desired effect?
No. With this abstraction, validations are available for non
ActiveRecord models, but the validations still have to be in the
model.
Also, where can I find some good and up to date tutorials on Rails3 ?
http://edgeguides.rubyonrails.org Not sure the guides are all up to date
though.
- ORM lazyness
I like that Django’s ORM and in DBIx::Class, the resultsets
constructed are lazy. I see that in Rails 3 there’s a new Query
API … http://m.onkey.org/2010/1/22/active-record-query-interface
Is that ready for use, is it development?
Or should I just use something like Sequel … can that be plugged-in
to Rails?
There is no stable release of Rails 3 yet, as we are still at beta 3.
But this new API is very much ready for use.
–
Gael Muller