Class: Diandian::Model::Base

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::AttributeMethods, ActiveModel::Serializers::JSON, ActiveModel::Validations
Defined in:
lib/diandian/model/base.rb

Direct Known Subclasses

Diandain::Model::Post, Blog, User

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Base

Returns a new instance of Base.



8
9
10
# File 'lib/diandian/model/base.rb', line 8

def initialize( attributes = {})
	@attributes = attributes
end

Class Method Details

.model_name(model_name = nil) ⇒ Object



13
14
15
16
# File 'lib/diandian/model/base.rb', line 13

def model_name model_name = nil
	@model_name = model_name if model_name
	@model_name ||= self.name.downcase
end

Instance Method Details

#idObject



23
24
25
# File 'lib/diandian/model/base.rb', line 23

def id
	nil
end

#model_nameObject



19
20
21
# File 'lib/diandian/model/base.rb', line 19

def model_name
	self.class.model_name
end