-
Code's Tags
-
Your Codes
-
Reffers
-
Linked Codes
|
Code:
Short link for Twitter:
HTML:
HTML view:
Copy Source | Copy HTML class Person include ActiveModel::Serialization attr_accessor :attributes def initialize(attributes) @attributes = attributes end end p = Person.new(:first_name => "Yukihiro", :last_name => "Matsumoto") p.to_json #=> %|{"first_name": "Yukihiro", "last_name": "Matsumoto"}| p.to_json(:only => :first_name) #=> %|{"first_name": "Yukihiro"}|
|