Added m2m on list entry and localeze_categories

This commit is contained in:
Tyrel Souza 2014-02-13 00:31:36 -05:00
parent 7df136799a
commit a13856ea64
4 changed files with 25 additions and 2 deletions

View File

@ -16,6 +16,7 @@ class ListEntry < ActiveRecord::Base
:UnstructuredTerms,
:Zip,
:eMail
has_many: :localeze_category
has_and_belongs_to_many :localeze_categories
end

View File

@ -1,3 +1,4 @@
class LocalezeCategory < ActiveRecord::Base
attr_accessible :name
belongs_to :list_entries
end

View File

@ -0,0 +1,14 @@
class CreateListEntryLocalezeCategoryJoinTable < ActiveRecord::Migration
def self.up
create_table :list_entries_localeze_categories, :id => false do |t|
t.integer :list_entry_id
t.integer :localeze_category_id
end
add_index :list_entries_localeze_categories, [:list_entry_id, :localeze_category_id], name: "listentries_localezecategory_index"
end
def self.down
drop_table :list_entries_localeze_categories
end
end

View File

@ -11,7 +11,7 @@
#
# It's strongly recommended to check this file into your version control system.
ActiveRecord::Schema.define(:version => 20140213043730) do
ActiveRecord::Schema.define(:version => 20140213052627) do
create_table "active_admin_comments", :force => true do |t|
t.string "resource_id", :null => false
@ -68,6 +68,13 @@ ActiveRecord::Schema.define(:version => 20140213043730) do
t.string "form_hash", :limit => 16
end
create_table "list_entries_localeze_categories", :id => false, :force => true do |t|
t.integer "list_entry_id"
t.integer "localeze_category_id"
end
add_index "list_entries_localeze_categories", ["list_entry_id", "localeze_category_id"], :name => "listentries_localezecategory_index"
create_table "localeze_categories", :force => true do |t|
t.string "name", :limit => 256
t.datetime "created_at", :null => false