Created
July 29, 2010 18:25
-
-
Save adelevie/498832 to your computer and use it in GitHub Desktop.
This file contains 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
#app/models/post.rb | |
class Post < ActiveRecord::Base | |
serialize :meta_data | |
end | |
#some_controller.rb | |
post = Post.find(params[:id]) | |
post.meta_data = User.find_by_name(params[:user][:name]) | |
post.save |
This file contains 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
user = post.meta_data | |
comments = user.comments #=> Undefined method 'comments' for YAML object |
This file contains 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
post.meta_data = User.find_by_name(params[:user][:name]).attributes |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment