I\'m building backend system, as written in Iain Hecker\'s tutorial: http://iain.nl/backends-in-rails-3-1 and I try to adapt it to MongoDB with Mongoid.
So when I need t
You're on the right track with attribute_names
. I think you just need to make sure you're including your module in the proper place. For instance, if you had the same module:
module Backend::ResourceHelper
def attributes
resource_class.attribute_names - %w(id created_at updated_at)
end
end
Your class should look like so:
class User
include Mongoid::Document
extend Backend::ResourceHelper
devise_for :users
field :name
field :address
end
Then calling User.attributes
should return ["name", "address"]