[Rails] Using find - beginner's advice
Owners has_one :widget and Widgets belongs_to :owner. When creating a
new widget, I'm giving the option for the user to specify the owner by
using a drop down select. The select is populated by pulling a list of
owners.
What would be the best way to populate the select with owners who do not
have a widget?
I'm assuming my controller would look something like this for Widgets:
--
def new
@widget = Widget.new
@widgets = Widget.find(:all)
@owners = Owners.find(:all, :conditions => '...this is where I go
blank...')
end
--
I'm assuming that it has to go in some kind of condition. Am I supposed
to run the owners find through some sort of block to validate for each
widget I've found in @widgets?
Thanks as always for any help in advance.
--
Posted via http://www.ruby-forum.com/.

0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home