ActsAsMtObject¶ ↑
Acts as Movable Type’s object.
Features¶ ↑
-
Setup aliases. (e.g. “title” to “entry_title”)
-
Can access meta table data.
-
Can access custom fields data.
-
Only “mysql2” adapter is supported.
Problems¶ ↑
-
Can’t save meta table data.
-
Can’t save custom fields data.
Install¶ ↑
Put this line in your Gemfile:
gem 'acts_as_mt_object'
Then bundle:
$ bundle
Example¶ ↑
Include¶ ↑
class MT::Entry < ActiveRecord::Base acts_as_mt_object end
or
class Plan < ActiveRecord::Base acts_as_mt_object :mt_class => :Entry end
Usage¶ ↑
> entry = MT::Entry.find(343) # find by entry_id => #<MT::Entry entry_id: 343 ... > entry.title # column data => "Title" > entry.current_revision # meta data => 1 > entry.price # custom field's data => 30000
Copyright 2011-2012 ToI Inc., released under the MIT license