# Question on Rails 3 : forms && ORM && ActiveModel

**URL:** <https://www.ruby-forum.com/t/question-on-rails-3-forms-orm-activemodel/189236>\
**Category:** Rails\
**Created:** [May 27, 2010, 8:15am UTC](https://www.ruby-forum.com/t/question-on-rails-3-forms-orm-activemodel/189236 "2010-05-27T08:15:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Alexandru\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c77e96/32.png) [@Alexandru\_N](https://www.ruby-forum.com/u/Alexandru_N)\
**Post date:** [May 27, 2010, 8:15am UTC](https://www.ruby-forum.com/t/question-on-rails-3-forms-orm-activemodel/189236/1 "2010-05-27T08:15:22Z")

</div>

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 …

1. 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 ?

1. 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](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

---

<div class="post-metadata">

**Author:** ![Alexandru\_N](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/c77e96/32.png) [@Alexandru\_N](https://www.ruby-forum.com/u/Alexandru_N)\
**Post date:** [May 28, 2010, 2:57pm UTC](https://www.ruby-forum.com/t/question-on-rails-3-forms-orm-activemodel/189236/2 "2010-05-28T14:57:41Z")

</div>

On Thu, May 27, 2010 at 8:01 AM, Alexandru N. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) 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](http://edgeguides.rubyonrails.org) Not sure the guides are all up to date  
though.

> 1. 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](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
