title: Why is devise invitable not sending out some emails
body: <p>I am using devise and <a href="https://github.com/scambra/devise_invitable" rel="nofollow">devise_invitable</a> </p>
  
  <pre><code>gem 'devise',           '&gt;= 2.0.0'
  gem 'devise_invitable', '~&gt; 1.0.0'
  </code></pre>
  
  <p>And i have a link in the the admin portion of the site that automatically sends the invitation email to the users </p>
  
  <pre><code> = link_to 'Send Invitation', invite_user_path(@user), :remote =&gt; true, :title =&gt; "Sends an email directly to the user" 
  
  
  def invite
     @user = User.find(params[:id])
     User.invite!(:email =&gt; @user.email)
     flash.now[:success] = "Invitation email has been sent"
     respond_to do |format|
       format.js
     end
   end
  </code></pre>
  
  <p>And this sends out emails to users who have have the user.invitation_token not NULL in the db but skips sending out an email to the other users....why is this and how do I correct this. Also in the documentation for <a href="https://github.com/scambra/devise_invitable" rel="nofollow">devise_invitable</a> this is the way they say call invite!</p>
  
  <pre><code>User.invite!(:email =&gt; "new_user@example.com", :name =&gt; "John Doe")
  </code></pre>
  
  <p>but when i do that they say I cant mass assign attribute name</p>
  
  <p>Any help would be greatly appreciated</p>
  
  <p>I noticed that if there is anything in the user invitation_token field the email will go out but how do i create that initially</p>
  
  <p>UPDATE...here is my entire user model</p>
  
  <pre><code>class User &lt; ActiveRecord::Base
    delegate :can?, :cannot?, :to =&gt; :ability
  
    has_many :roles, :through =&gt; :role_users
    has_many :role_users
    has_many :notifications, :through =&gt; :subscriptions
    has_many :subscriptions
    has_many :companies, :through =&gt; :positions
    has_many :positions
    has_many :notification_histories
    has_many :sites, :through =&gt; :site_users
    has_many :site_users
  
    scope :admins, joins(:roles).where("roles.name = 'SuperAdmin' or roles.name = 'SubAdmin'")  
    scope :regular, joins(:companies).where('positions.regular_user = 1').group('users.id')
    scope :employee, joins(:companies).where('positions.regular_user = 0').group('users.id')
    scope :current, :conditions =&gt; { :active =&gt; true }, :order =&gt; 'LOWER(first_name), LOWER(last_name) ASC'
  
    default_scope :order =&gt; 'LOWER(first_name) ASC'
  
    has_many :feedbacks do
      def for_playlist(id)
        find_or_create_by_playlist_id(id)
      end
    end
  
    def name
      "#{self.first_name} #{self.last_name}"
    end
  
    has_many :ratings, :through =&gt; :feedbacks do
      def for_playlist(id)
        where('feedbacks.playlist_id = ?', id)
      end
    end
  
    Role::TYPES.each do |role|
      define_method(role + '?') do
        self.has_role?(role)
      end
    end
  
    def has_role?(role_name)
      role_name = role_name.name if role_name.is_a?(Role)
      self.roles.where(:name =&gt; role_name.to_s).exists?
    end
  
    accepts_nested_attributes_for :roles, :notifications, :allow_destroy =&gt; true 
  
    def company
      self.companies.first
    end
  
    def site
      self.sites.first
    end
  
    validates :first_name, :presence =&gt; true
    validates :last_name, :presence =&gt; true
    validates :email, :presence =&gt; true
    validates_format_of :email, :with =&gt; /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z/i, :on =&gt; :create, :if =&gt; :email_present?
    validates_uniqueness_of :email
    validates_format_of :phone_number, :with =&gt; /^\(?([0-9]{3})\)?[-. ]?([0-9]{3})[-. ]?([0-9]{4})$/, :allow_nil =&gt; true
    validates_format_of :password, 
                        :with =&gt; /^.*(?=.{6,})(?=.*[a-z])(?=.*[A-Z])(?=.*[\d\W]).*$/, 
                        :message =&gt; "must be at least 6 characters, have one number and one capital letter",
                        :if =&gt; Proc.new { |user| !user.password.blank? }
  
    before_validation :clear_empty_attrs
    before_validation :clean_data
  
    # Include default devise modules
    devise :database_authenticatable, :recoverable, :rememberable, :trackable, :invitable
  
    # Setup accessible (or protected) attributes for devise support
    attr_accessible :email, :password, :password_confirmation, :remember_me, :active,
      :company_id, :first_name, :last_name, :phone_number, :role_ids, :notification_ids, :name
  
    def role?(role)
      return !!self.roles.find_by_name(role.to_s.camelize)
    end
  
    def ability
      @ability ||= Ability.new(self)
    end
  
    def name
      "#{first_name} #{last_name}"
    end
  
    def list_companies
      companies.map(&amp;:name).try(:join, ", ").try(:titlecase)
    end
  
    def email_present?
      !self.email.blank?
    end
  
  protected
    def clear_empty_attrs
      @attributes.each do |key,value|
        self[key] = nil if value.blank?
      end
    end
  
    def clean_data
      self.email.downcase! unless self.email.nil?
    end
  end
  </code></pre>