Mongoid, set_table_name & attr_accessible

I am using rails3 edge and mongoid 2beta6 with ruby ​​1.9.2-head.

How can I manually change the table name like set_table_name for ActiveRecord? For example, my Registration model should use the "users" table for storage, not "signups".

Another question is how to implement bevahior attr_accessible AR?

Thanks, Corinne

+2


a source to share


3 answers


pretty simple :)



class Pictures
  self.collection_name = 'photos'
end

      

+6


a source


With mongoid, it is attr_accessible

ignored as far as I know . Only attributes declared with field

will persist, however if passed as an attribute you can use attr_accessor

to make sure they won't persist (typically: password as an example).



Alex

+1


a source


The link mentioned by Dan Healy has been changed to http://mongoid.org/en/mongoid/docs/documents.html .

0


a source







All Articles