Sunday, December 9, 2012

[Rails] Associations in models - am I doing it wrong?

One of my modesl looks like this:

class UnprocessedPage < ActiveRecord::Base
     has_one :user
     attr_accessible :url, :user_id
end

Do I need :user_id?  Or is it implied via "has_one :user"?

This is working as is.. but when I look for examples of other things, I never see any attributes with *_id... so I'm wondering if it's implied and I'm just mucking things up?

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/K4kU3dSf728J.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate