Whats the advantage of moving your schema into ruby?
I found Hstore invaluable when using STI, because ActiveRecord's column-proliferation approach is an ORM wart of the highest order but I didn't really want to go MongoDB just yet.
I concur with Kevin. I've come to Ruby & Rails with a background in other programming languages and frameworks (C, Perl, Scheme and Java). The rails API doco is somewhat half-baked, so I am very interested in deep-dive walkthroughs and I have no problem keeping up. And the pause button is there if one needs to chew on the substance a little more.
Another usage tip. To make creates work (e.g. when using accepts_nested_attributes_for), you'll need serialize :properties, ActiveRecord::Coders::Hstore in your model (assuming your hstore field is called "properties").
I've seen suggestions that this need will go away with Rails 4.0.
I found Hstore invaluable when using STI, because ActiveRecord's column-proliferation approach is an ORM wart of the highest order but I didn't really want to go MongoDB just yet.
I concur with Kevin. I've come to Ruby & Rails with a background in other programming languages and frameworks (C, Perl, Scheme and Java). The rails API doco is somewhat half-baked, so I am very interested in deep-dive walkthroughs and I have no problem keeping up. And the pause button is there if one needs to chew on the substance a little more.
nice piece, also for the neat metaprogramming example!
NB: playback cuts off a little, missing the last couple of seconds.
Nominating this article for an update.
Another usage tip. To make creates work (e.g. when using accepts_nested_attributes_for), you'll need
serialize :properties, ActiveRecord::Coders::Hstorein your model (assuming your hstore field is called "properties").I've seen suggestions that this need will go away with Rails 4.0.
How about a bit of DRY. I have this in lib/hstore_accessor.rb ( see https://gist.github.com/2834785 ):
and in config/initializers/active_record_extensions.rb
require "hstore_accessor"Then we can do