fnando / marshaled_attributes
- Source
- Commits
- Network (0)
- Issues (0)
- Downloads (0)
- Wiki (1)
- Graphs
-
Tree:
db296ef
| name | age | message | |
|---|---|---|---|
| |
MIT-LICENSE | ||
| |
README.markdown | ||
| |
init.rb | ||
| |
lib/ | ||
| |
specs/ |
README.markdown
marshaled_attributes
A simple plugin for saving marshaled objects using ActiveRecord.
Instalation
Install the plugin with script/plugin install git://github.com/fnando/marshaled_attributes.git
Usage
Considering the following schema:
create_table :pages do |t|
t.string :name
t.text :body
t.binary :meta
end
1) Add the method call marshaled_attributes to your model.
class Page < ActiveRecord::Base
marshaled_attributes :meta
end
@page = Page.new # => do not mass-assign the marshaled attributes.
@page.meta = {:last_comment_id => 100}
IMPORTANT: Remember NOT to mass-assign the attributes you want to be marshaled.
Copyright (c) 2008 Nando Vieira, released under the MIT license

