i''m sorry, forget my question, i found the awnser.
class Comment < ActiveRecord::Base
validates_presence_of(:post)
belongs_to :post, :validate => true
end
:)
On Tue, Apr 7, 2009 at 10:03 PM, Tiago Z.C
<tiagozc-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:
> Hi
> I''m having some issues with models that i don''t know
which is the best way
> of doing that.
>
> I have Post model...
>
> class Post < ActiveRecord::Base
>
> validates_presence_of :name, :title
>
> has_many :comments
>
> end
>
>
> and the Comment model.
>
>
> class Comment < ActiveRecord::Base
>
> validates_presence_of(:post)
>
> belongs_to :post
>
> end
>
>
> If I open the console, and start write some lines:
>
> c = Comment.new
>
> p = post.new
>
> c.post = p
>
> c.save
>
>
> I receive the true feedback but, what about the presence of name and title
> on post???
>
>
> Thank you...
>
>
> --
> Tiago Zortéa de Conto
> Mac User - MAC OS X Leopard
> MSN: tiagozc-jatbLxuxqqVfyO9Q7EP/yw@public.gmane.org
>
--
Tiago Zortéa de Conto
Mac User - MAC OS X Leopard
MSN: tiagozc-jatbLxuxqqVfyO9Q7EP/yw@public.gmane.org
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---