Created
October 17, 2014 23:25
-
-
Save larsthegeek/df254e1ba1f12c9adefd 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
# given a model with a postgres array data type called 'wishlist' | |
# I know I can do | |
def add_item_to_wishlist(item) | |
wishlist_will_change! | |
wishlist = wishlist | item | |
end | |
# can I do something like: | |
def wishlist << (*items) | |
wishlist_will_change! | |
write_attribute(:wishlist, wishlist | items) | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment