-
-
Save erkattak/5374370 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A < ActiveRecord::Base | |
serialize :foo, FooSerializer | |
class FooSerializer | |
attr_accessor :attributes, :to, :be, :serialized | |
end | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class A < ActiveRecord::Base | |
serialize :foo, FooSerializer | |
class FooSerializer | |
attr_accessor :attributes, :to, :be, :serialized | |
// you might also want to try this, in order to customize the value of the serialized attribute | |
def custom_attribute | |
// getting your attribute | |
end | |
def custom_attribute=(value) | |
// setting your attribute | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment