class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :encryptable, :confirmable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable, :timeoutable, :lockable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me

  has_many :inputs, :dependent => :destroy
  has_many :feeds,  :dependent => :destroy

  def reset_api_read_token
    self.api_read_token = friendly_token
  end

  def reset_api_read_token!
    reset_api_read_token
    save
  end

  private

  def friendly_token
    ActiveSupport::SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n")
  end

end

class User < ActiveRecord::Base
  # Include default devise modules. Others available are:
  # :token_authenticatable, :encryptable, :confirmable, :timeoutable and :omniauthable
  devise :database_authenticatable, :registerable,
         :recoverable, :rememberable, :trackable, :validatable, :token_authenticatable, :timeoutable, :lockable

  # Setup accessible (or protected) attributes for your model
  attr_accessible :email, :password, :password_confirmation, :remember_me

  has_many :inputs, :dependent => :destroy
  has_many :feeds,  :dependent => :destroy

  def reset_api_read_token
    self.api_read_token = friendly_token
  end

  def reset_api_read_token!
    reset_api_read_token
    save
  end

  private

  def friendly_token
    SecureRandom.base64(15).tr('+/=', '-_ ').strip.delete("\n")
  end

end

Remove ActiveSupport:: to prevent deprecation warning
Remove ActiveSupport:: to prevent deprecation warning
