Sha256: 68992fb145fbce68a19fe94df70e35b252640f1c63d68f231b6beb008009e094
Contents?: true
Size: 787 Bytes
Versions: 16
Compression:
Stored size: 787 Bytes
Contents
class RolifyCreate<%= role_cname.pluralize.camelize %> < ActiveRecord::Migration def change create_table(:<%= role_cname.tableize %>) do |t| t.string :name t.references :resource, :polymorphic => true t.timestamps end create_table(:<%= (user_cname.tableize + "_" + role_cname.tableize) %>, :id => false) do |t| t.references :<%= user_cname.underscore.singularize %> t.references :<%= role_cname.underscore.singularize %> end add_index(:<%= role_cname.tableize %>, :name) add_index(:<%= role_cname.tableize %>, [ :name, :resource_type, :resource_id ]) add_index(:<%= "#{user_cname.tableize}_#{role_cname.tableize}" %>, [ :<%= user_cname.underscore.singularize %>_id, :<%= role_cname.underscore.singularize %>_id ]) end end
Version data entries
16 entries across 16 versions & 1 rubygems