Skip to content

Instantly share code, notes, and snippets.

@adelevie
Created July 29, 2010 18:25
Show Gist options
  • Save adelevie/498832 to your computer and use it in GitHub Desktop.
Save adelevie/498832 to your computer and use it in GitHub Desktop.
#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
user = post.meta_data
comments = user.comments #=> Undefined method 'comments' for YAML object
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