Sha256: b2e9a7cc677cf0559bb009d0527d4b47905d9db0d2ca36fb19235bf233c356e1

Contents?: true

Size: 761 Bytes

Versions: 10

Compression:

Stored size: 761 Bytes

Contents

class <%= migration_class_name %> < ActiveRecord::Migration
  def change
    enable_extension 'hstore'

    create_table :<%= table_name %> do |t|
      # t.string :title, :limit => 50, :default => "" 
      t.text :message
      t.references :<%= class_name.demodulize.underscore + "able" %>, polymorphic: true
      t.references :user, polymorphic: true, index: true
      t.string :role, default: nil
      t.hstore :related_attributes
      t.timestamps
    end

    add_index :<%= table_name %>, [:<%= class_name.demodulize.underscore + "able" %>_type, :<%= class_name.demodulize.underscore + "able" %>_id],
     name: :index_<%= table_name %>_on_<%= class_name.demodulize.underscore %>able_type_and_<%= class_name.demodulize.underscore %>able_id
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
acts_as_commentable_more-1.2.8 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.2.7 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.2.6 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.2.5 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.2.4 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.2.3 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.2.2 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.2.1 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.2.0 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.1.0 lib/generators/commentable/templates/create_comments.rb