class Hstore::Setup
Creates the hstore:setup generator. This generator creates a migration that adds hstore support for your database. If fact, it’s just the sql from the contrib inside a migration. But it’ s handy, isn’t it?
To use your generator, simply run it in your project:
rails g hstore:setup
Public Class Methods
next_migration_number(dirname)
click to toggle source
# File lib/activerecord-postgres-hstore/railties.rb, line 36 def self.next_migration_number(dirname) if ActiveRecord::Base.timestamped_migrations Time.now.utc.strftime("%Y%m%d%H%M%S") else "%.3d" % (current_migration_number(dirname) + 1) end end
source_root()
click to toggle source
# File lib/activerecord-postgres-hstore/railties.rb, line 32 def self.source_root @source_root ||= File.join(File.dirname(__FILE__), '../templates') end
Public Instance Methods
create_migration_file()
click to toggle source
# File lib/activerecord-postgres-hstore/railties.rb, line 44 def create_migration_file pgversion = ActiveRecord::Base.connection.send(:postgresql_version) if pgversion < 90100 migration_template 'setup_hstore.rb', 'db/migrate/setup_hstore.rb' else migration_template 'setup_hstore91.rb', 'db/migrate/setup_hstore.rb' end end