Parameters on :custom_options_method?

0 views
Skip to first unread message

Novack

unread,
Sep 4, 2009, 10:18:26 AM9/4/09
to Streamlined
Is there any way to pass parameters to the :custom_options_method?

Given this case, taken from the docs:

#----------------------------------------------
Streamlined.ui_for(Person) do
user_columns :specialty, { :options_for_select
=> :custom_options_method }
end


class Specialty < ActiveRecord::Base
def self.custom_options_method
subset = self.find(:all, :conditions => "other_id = 1", :order =>
"name ASC").collect { |p| p.name }
end
end

#
# Notice that this is working, but the "find" line is slightly
different than the one at the documentation
#----------------------------------------------

How can I pass the "1" as a parameter? something as "other_id
= :param", but that I can send :param to the custom_options_method?

Actually, other_id should be on the instance of Person, but Im not
beeing able to bring it, as with self.other_id I get a "NoMethodError"
- undefined method `other_id' for... etc.

Let me know if this sounds too cryptic.

Thanks in advance for any help.
Reply all
Reply to author
Forward
0 new messages