On 12 March 2011 12:59, Paul B. [email protected].invalid wrote:
I have 3 tables; Feelings, Users, and Members. Both Feelings and Members
belongs_to Users with user_id.
Both models Feelings and Members have belongs_to :user in them. Feelings
has has_one :member, :through => :user.
The above would be easier for us (well, me anyway) to understand if
you showed the class definitions
class Feeling < ActiveRecord::Base
and so on. Also tell us the file names. Copy and paste from your
code in case of typo errors.
Is this the right setup? How can I make a rails search condition in
Feelings and get a column from members into that search?
I am not exactly sure what you want, but once you find Feeling object
@feeling = Feeling.first for example, then, if the relationships are
correct, the member can be accessed by
so columns can be accessed by
@feeling.member.name or whatever.
You can check whether it is working by using the rails console and
typing things like
f = Feeling.first