Sha256: 27fdf25690ed80ba515cabd046fc58710632455d42f64bb680b4a77d5a763fab

Contents?: true

Size: 774 Bytes

Versions: 3

Compression:

Stored size: 774 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, default: ''
      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

3 entries across 3 versions & 1 rubygems

Version Path
acts_as_commentable_more-1.2.11 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.2.10 lib/generators/commentable/templates/create_comments.rb
acts_as_commentable_more-1.2.9 lib/generators/commentable/templates/create_comments.rb