mirror of
https://github.com/samsonjs/grape-active_model_serializers.git
synced 2026-03-25 08:45:55 +00:00
15 lines
250 B
Ruby
15 lines
250 B
Ruby
class BlogPost
|
|
include ActiveModel::Serialization
|
|
|
|
attr_accessor :title, :body
|
|
|
|
def self.model_name
|
|
to_s
|
|
end
|
|
|
|
def initialize(params = {})
|
|
params.each do |k, v|
|
|
instance_variable_set("@#{k}", v) unless v.nil?
|
|
end
|
|
end
|
|
end
|