Module: Phoenix::Common

Extended by:
ActiveSupport::Concern
Included in:
Base
Defined in:
lib/phoenix/common.rb

Defined Under Namespace

Modules: ClassMethods, Status

Instance Method Summary collapse

Instance Method Details

#errorObject



211
212
213
# File 'lib/phoenix/common.rb', line 211

def error
  self.errors.values.join("<br/>")
end

#human_create_dateObject



207
208
209
# File 'lib/phoenix/common.rb', line 207

def human_create_date
  Time.at(self.CREATE_DATE.to_i/1000).strftime("%Y-%m-%d %H:%M:%S")
end

#human_statusObject



203
204
205
# File 'lib/phoenix/common.rb', line 203

def human_status
  self.STATUS == '1' ? "禁用" : "正常"
end

#initialize(h) ⇒ Object



189
190
191
192
193
194
195
196
197
198
199
200
201
# File 'lib/phoenix/common.rb', line 189

def initialize(h)
  return self if h.blank?
  h.each do |k, v|
    if self.respond_to? "#{k}="
      self.send("#{k}=", v)
    elsif k =~ /SequenceValueExpression/
      self.instance_variable_set("@next_value", v)
    else
      self.instance_variable_set("@#{k[/\w+/]}", v)
    end
  end
  return self
end