I would agree that this is a nice way to get started with your models,
but once you need to do anything beyond the basics, like association
extensions for example, even simply renaming the association, then
you'll have to define the association anyway.

Nice idea, but I'd rather see this remain as a plugin instead of users
getting used to the fact that you don't have to define model
associations or provide validations.

If all this did was generate the base model with the associations and
validations then that would definitely relieve some initial
development time and possibily worthy of core inclusion.

Andrew

On 8/14/06, Dr. Ernie Prabhakar <[EMAIL PROTECTED]> wrote:

Hi Nic,

I for one think this is incredibly cool, and would love to see it in Rails
1.2 (as part of core)...

Thanks!
-- Ernie P.

On Aug 8, 2006, at 3:33 AM, Nic Williams wrote:
I've written an ActiveRecord extension that allows Associations to be
automatically generated at runtime without requiring "has_many" and
"belongs_to" to be defined in the class. The use of has_many vs has_one is
determined by the pluralisation of the method call.

Additionally, it uses the :null => false attribute of columns to provide
validates_presence_of automatically to models too.

If any of this code is relevant for Core Rails, let me know and I'll extract
it from the gem and create a patch for core. The gem has received a good
reception on the Ruby + RoR forums.

http://drnicwilliams.com/2006/08/07/ann-dr-nics-magic-models/

Cheers
Nic

--
Dr Nic Williams
 http://www.drnicwilliams.com - Ruby/Rails blog
skype: nicwilliams
(m) +31 62 494 8552
(p) +61 7 3305 7522 (finds me anywhere in the world)
(f) +61 7 3305 7572 (sends fax to my email)
_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core



_______________________________________________
Rails-core mailing list
Rails-core@lists.rubyonrails.org
http://lists.rubyonrails.org/mailman/listinfo/rails-core

Reply via email to