Class: GreetingSetting

Inherits:
Object
  • Object
show all
Includes:
DataMapper::Resource
Defined in:
lib/campfire/polling_bot/plugins/greeting/greeting_setting.rb

Overview

used by GreetingPlugin

Class Method Summary collapse

Class Method Details

.for_user(user) ⇒ Object


10
11
12
13
14
15
16
17
18
# File 'lib/campfire/polling_bot/plugins/greeting/greeting_setting.rb', line 10

def self.for_user(user)
  result = first(:user => user) || first(:person => user.name, :user => nil)

  if result && result.user.nil?
    result.update(:user => user)
  end

  return result
end