Skip to content

Instantly share code, notes, and snippets.

@liangzan
Created September 5, 2010 03:03
Show Gist options
  • Save liangzan/565704 to your computer and use it in GitHub Desktop.
Save liangzan/565704 to your computer and use it in GitHub Desktop.
# lib/formtastic.rb
def find_raw_collection_for_column(column, options) #:nodoc:
collection = if options[:collection]
options.delete(:collection)
elsif reflection = self.reflection_for(column)
options[:find_options] ||= {}
if conditions = reflection.options[:conditions]
options[:find_options][:conditions] = reflection.klass.merge_conditions(conditions, options[:find_options][:conditions])
end
reflection.klass.find(:all, options[:find_options])
else
create_boolean_collection(options)
end
collection = collection.to_a if collection.is_a?(Hash)
collection
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment