2

I am having problems with the model "Collection".

I'm using mongoid with mongodb and rails 3.2.

I have the problem when I try create a nested resource from collection with a select with simple_form sth like:

 <%= f.input :collection_id, :collection => Collection.where(:user_id => current_user.id).order([:created_at, :desc]), :input_html => { :id => "m_collection_id" }  %>

However with the other words for the model working fine.

My question is if it's possible create a model with the "Collection" word with ruby on rails 3.2, mongoid and mongodb.

Thank you very much!

hyperrjas
  • 10,666
  • 25
  • 99
  • 198

1 Answers1

0

While I'm not sure if "collection" is a protected word in rails, mongodb, or simple_form, it'd probably be best to not use it. There are several methods that have "collection" in the name, such as collection_select for example. I checked around on a couple reserved word lists, but didn't find it there.(Here's the best one I found: http://cheat.errtheblog.com/s/rails_reserved_words/)

When I'm not sure about a word though, I just go to a thesaurus online and look up a good synonym. Some good ones I saw for collection are compilation, aggregation, assortment, medley(ok, maybe not that, but you get the idea).

GorrillaMcD
  • 1,884
  • 1
  • 14
  • 22