title: How can I get all field names of the Mongoid Document?
body: <p>I'm building backend system, as written in Iain Hecker's tutorial: <a href="http://iain.nl/backends-in-rails-3-1">http://iain.nl/backends-in-rails-3-1</a> and I try to adapt it to MongoDB with Mongoid.</p>
  
  <p>So when I need to write in backend/resourse_helper.rb</p>
  
  <pre><code>module Backend::ResourceHelper
  
    def attributes
      resource_class.attribute_names - %w(id created_at updated_at)
    end
  
  end
  </code></pre>
  
  <p>I get the following error:</p>
  
  <pre><code>undefined method `attribute_names' for Backend::User:Class
  </code></pre>
  
  <p>(I rooted backend to "backend/users#index").
  Backend::User inherits from User:</p>
  
  <pre><code>class User
    include Mongoid::Document
  
    devise_for :users
  
    field :name
    field :address
  end
  </code></pre>
  
  <p>I just need a list of fields for that User:Class, as I guess (i.e. ["email", "name", "address", ...]), but I broke my head trying to find how. </p>