Module: ApplicationHelper
- Defined in:
- lib/hopsoft/acts_as_lookup.rb
Instance Method Summary collapse
Instance Method Details
#select_from_lookup(table, options = {}) ⇒ Object
277 278 279 280 281 282 283 284 285 286 |
# File 'lib/hopsoft/acts_as_lookup.rb', line 277 def select_from_lookup(table, = {}) if table.is_a?(Symbol) || table.is_a?(String) model = Object.const_get(table.to_s.classify) field ||= [:field] || "name" collection = model.send(:find, :all) default ||= [:value] || nil choices = (collection, "name", field, default) select_tag table, choices, end end |