module Phoenix::Common

Public Class Methods

new(h) click to toggle source
# 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

Public Instance Methods

error() click to toggle source
# File lib/phoenix/common.rb, line 211
def error
  self.errors.values.join("<br/>")
end
human_create_date() click to toggle source
# 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_status() click to toggle source
# File lib/phoenix/common.rb, line 203
def human_status
  self.STATUS == '1' ? "禁用" : "正常"
end