title: rails 3.1, why devise can't build the resource?
body: <p>I've noticed that created resouce attributes are all blank after executing <code>build_resource</code> at <code>Devise::RegistrationsController</code> create function</p>
  
  <p>here is the params object sent:</p>
  
  <pre><code> "student"=&gt;{"first_name"=&gt;"George",
   "last_name"=&gt;"Michle",
   "company_name"=&gt;"Meri",
   "work_title"=&gt;"Architect",
   "address"=&gt;"Moon",
   "postal_code"=&gt;"23410",
   "work_phone"=&gt;"",
   "home_phone"=&gt;"",
   "mobile_phone"=&gt;"",
   "fax"=&gt;"",
   "email"=&gt;"gion@gmail.com",
   "password"=&gt;"[FILTERED]",
   "password_confirmation"=&gt;"[FILTERED]",
   "country_id"=&gt;"2",
   "state_province_id"=&gt;"2"}
  </code></pre>
  
  <p>Here is the resulted resource attributes:</p>
  
  <pre><code>[["address", ""], ["city", nil], ["company_name", ""], ["country_id", 1], ["created_at", Wed, 08 Feb 2012 04:52:35 UTC +00:00], ["current_sign_in_at", nil], ["current_sign_in_ip", nil], ["email", ""], ["encrypted_password", ""], ["fax", ""], ["first_name", ""], ["home_phone", ""], ["last_name", ""], ["last_sign_in_at", nil],  ["last_sign_in_ip", nil], ["license_number", nil], ["mobile_phone", ""], ["postal_code", ""], ["remember_created_at", nil], ["reset_password_sent_at", nil], ["reset_password_token", nil], ["sign_in_count", 0], ["state_province_id", nil], ["updated_at", Wed, 08 Feb 2012 04:52:35 UTC +00:00], ["username", nil], ["work_phone", ""], ["work_title", ""]]
  </code></pre>
  
  <p>So, why  build_resource could not populate the params ? Where to look to solve this problem ?
  Any help will be more than appreciated.</p>
  
  <p><strong>EDIT:</strong></p>
  
  <p>Here is the student model:</p>
  
  <pre><code>class Student &lt; ActiveRecord::Base
  
    has_many :students_courseses
    has_many :courses , :through =&gt; :students_courseses
  
  
  
    # Include default devise modules. Others available are:
    # :token_authenticatable, :encryptable, :confirmable, :lockable, :timeoutable and :omniauthable
    devise :database_authenticatable, :registerable,
           :recoverable, :rememberable, :trackable, :validatable, :timeoutable
  
    belongs_to :country
    #validates :weburl, :url =&gt; {:allow_blank =&gt; true}, :length =&gt; { :maximum =&gt; 50 }
  
    validates_length_of :work_phone, :is =&gt; 10, :message =&gt; 'must be 10 digits, excluding special characters such as spaces and dashes. No extension or country code allowed.', :if =&gt; Proc.new{|o| !o.work_phone.blank?}
    validates_length_of :home_phone, :is =&gt; 10, :message =&gt; 'must be 10 digits, excluding special characters such as spaces and dashes. No extension or country code allowed.', :if =&gt; Proc.new{|o| !o.home_phone.blank?}
    validates_length_of :mobile_phone, :is =&gt; 10, :message =&gt; 'must be 10 digits, excluding special characters such as spaces and dashes. No extension or country code allowed.', :if =&gt; Proc.new{|o| !o.mobile_phone.blank?}
    validates_length_of :fax, :is =&gt; 10, :message =&gt; 'must be 10 digits, excluding special characters such as spaces and dashes. No extension or country code allowed.', :if =&gt; Proc.new{|o| !o.fax.blank?}
  
    # Setup accessible (or protected) attributes for your model
    attr_accessible :email, :password, :password_confirmation, :remember_me
  
    attr_accessible:username
    attr_accessible:first_name
    attr_accessible:last_name
    attr_accessible:address
    attr_accessible :city
  
    attr_accessible :state_province_id
    attr_accessible :country_id
  
    attr_accessible:postal_code
    attr_accessible:work_phone
    attr_accessible:home_phone
    attr_accessible:mobile_phone
    attr_accessible:fax
  
    attr_accessible:company_name
    attr_accessible:work_title
    attr_accessible:license_number
  
    ###############################################################
  
  
    #attr_accessor can be used for values you don't want to store in the database directly and that will only exist for the life of the object (e.g. passwords).
    attr_accessor :email, :password, :password_confirmation, :remember_me
    ###############################################################
  
  
    cattr_accessor :time_out_time
  
    def timeout_in
      if time_out_time.nil?
        STUDENT_LOG_OUT_PERIOD
      else
        time_out_time.seconds
      end
    end
  end
  </code></pre>
  
  <p>The student model in route file:</p>
  
  <pre><code>  devise_for :students, :controllers =&gt; { :registrations =&gt; "students/registrations" }
    devise_for :students, :controllers =&gt; { :sessions =&gt; "students/sessions" }
  </code></pre>
  
  <p><strong>EDIT2:</strong></p>
  
  <p>Here is the student registration controller:</p>
  
  <pre><code>class Students::RegistrationsController &lt; Devise::RegistrationsController
  
    def update
      # no mass assignment for country_id, we do it manually
      # check for existence of the country in case a malicious user manipulates the params (fails silently)
      if student_signed_in? then
        if params[resource_name][:country_id]
          resource['country_id'] = params[resource_name][:country_id] if Country.find_by_id(params[resource_name][:country_id])
        end
        if params[resource_name][:state_province_id]
          resource.state_province_id = params[resource_name][:state_province_id] if State.find_by_id(params[resource_name][:state_province_id])
        end
      end
      super
    end
  
    def create
      super
    end
  
  end
  </code></pre>