Sha256: 52a23d77599bc21bc2e31497d262717e58e656e254390eeb127dc8c37346e557

Contents?: true

Size: 858 Bytes

Versions: 19

Compression:

Stored size: 858 Bytes

Contents

<%
  parent_class = ActiveRecord::Migration
  parent_class = parent_class[parent_class.current_version] if Rails::VERSION::MAJOR >= 5
-%>
class CreateActiveAdminComments < <%= parent_class.to_s %>
  def self.up
    create_table :active_admin_comments do |t|
      t.string :namespace
      t.text   :body
      t.references :resource, polymorphic: true
      t.references :author, polymorphic: true
      <%- if Rails::VERSION::MAJOR >= 5 -%>
      t.timestamps
      <%- else -%>
      t.timestamps null: false
      <%- end -%>
    end
    add_index :active_admin_comments, [:namespace]
    <%- unless Rails::VERSION::MAJOR >= 5 -%>

    add_index :active_admin_comments, [:author_type, :author_id]
    add_index :active_admin_comments, [:resource_type, :resource_id]
    <%- end -%>

  end

  def self.down
    drop_table :active_admin_comments
  end
end

Version data entries

19 entries across 19 versions & 3 rubygems

Version Path
activeadmin-rb-1.5.0 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin_addons-1.7.1 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-rb-1.4.0 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin_addons-1.7.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-1.4.3 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-1.4.2 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-1.4.1 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-1.4.0 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-1.3.1 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin_addons-1.6.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin_addons-1.5.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-1.3.0 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin_addons-1.4.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-f71b375325eb/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin_addons-1.3.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin_addons-1.2.0 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-f71b375325eb/lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-1.2.1 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-1.2.0 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-1.1.0 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb
activeadmin-1.0.0 lib/generators/active_admin/install/templates/migrations/create_active_admin_comments.rb.erb