Sounds like you do not have your associations defined correctly in your model.

In your Buyer model you should have this line:

    belongs_to :status

In your Status model you should have this line:

    has_many :buyers


HTH,

Jamey

On Fri, Jan 29, 2010 at 9:11 PM, Steve Castaneda <li...@ruby-forum.com> wrote:
> I'm looking to give an object (buyer) a status.  What's the best way to
> accomplish this?  At the moment, I'm struggling to comprehend my way
> through the following:
>
> 1) Create a status model, then let the user add statuses as they see
> fit.  These statuses can then be applied to a buyer.  The buyer table
> will have a status_id column. This works fine, but I have a problem when
> I try to refer to the the status through a buyer.
>
> buyer.status gives me the following error:
>
> Unknown column 'statuses.buyer_id' in 'where clause': SELECT * FROM
> `statuses` WHERE (`statuses`.buyer_id = 12)  LIMIT 1
>
> I see what it's trying to do - go into the status column and find all
> statuses that have the buyer_id assigned.  The problem is that I don't
> want a status to apply to only ONE buyer, I want them to be able to
> apply to multiple.
>
> I'm sure I'm missing something in my routes, or just not understanding
> the relationship and how I need to instruct rails of this.
>
> Can someone help me out?  Thanks in advance for any time spent helping.
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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-t...@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>

-- 
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-t...@googlegroups.com.
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.

Reply via email to