Class: Ecm::UserArea::User

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/ecm/user_area/user.rb

Instance Method Summary collapse

Instance Method Details

#as_json(options = {}) ⇒ Object

def self.current_id

Thread.current[:user_id]

end



18
19
20
21
22
23
24
25
26
27
28
29
# File 'app/models/ecm/user_area/user.rb', line 18

def as_json(options = {})
  options.reverse_merge!(style: :default)

  style = options.delete(:style)

  case style
  when :autocomplete
    { value: id, title: human, subtitle: self.inspect }
  else
    super
  end
end

#authenticable?Boolean

Returns:

  • (Boolean)


31
32
33
# File 'app/models/ecm/user_area/user.rb', line 31

def authenticable?
  [active, confirmed, approved].all?
end

#humanObject



35
36
37
# File 'app/models/ecm/user_area/user.rb', line 35

def human
  email
end