Skip to content
Browse files

Rename join table 'posts_tags' to 'monologue_posts_tags'

  • Loading branch information...
1 parent f349bf1 commit 50d693b0b6adc9b6450f1980b026a483db464bcc @msevestre msevestre committed Jun 3, 2012
View
2 app/models/monologue/post.rb
@@ -1,6 +1,6 @@
class Monologue::Post < ActiveRecord::Base
has_many :posts_revisions, :dependent => :destroy
- has_and_belongs_to_many :tags
+ has_and_belongs_to_many :tags ,:join_table => :monologue_posts_tags
accepts_nested_attributes_for :posts_revisions
attr_accessible :posts_revisions_attributes
View
2 app/models/monologue/tag.rb
@@ -2,7 +2,7 @@ class Monologue::Tag < ActiveRecord::Base
attr_accessible :name
validates :name, :uniqueness => true,:presence => true;
- has_and_belongs_to_many :posts
+ has_and_belongs_to_many :posts,:join_table => :monologue_posts_tags
def posts_with_tag
self.posts.published
View
5 db/migrate/20120604010152_rename_post_tags_table.rb
@@ -0,0 +1,5 @@
+class RenamePostTagsTable < ActiveRecord::Migration
+ def change
+ rename_table :posts_tags, :monologue_posts_tags
+ end
+end
View
24 spec/dummy/db/schema.rb
@@ -11,13 +11,13 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20120526195147) do
+ActiveRecord::Schema.define(:version => 20120604010152) do
create_table "monologue_posts", :force => true do |t|
t.integer "posts_revision_id"
t.boolean "published"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
create_table "monologue_posts_revisions", :force => true do |t|
@@ -27,15 +27,20 @@
t.integer "user_id"
t.integer "post_id"
t.datetime "published_at"
- t.datetime "created_at"
- t.datetime "updated_at"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
add_index "monologue_posts_revisions", ["id"], :name => "index_monologue_posts_revisions_on_id", :unique => true
add_index "monologue_posts_revisions", ["post_id"], :name => "index_monologue_posts_revisions_on_post_id"
add_index "monologue_posts_revisions", ["published_at"], :name => "index_monologue_posts_revisions_on_published_at"
add_index "monologue_posts_revisions", ["url"], :name => "index_monologue_posts_revisions_on_url"
+ create_table "monologue_posts_tags", :id => false, :force => true do |t|
+ t.integer "post_id"
+ t.integer "tag_id"
+ end
+
create_table "monologue_tags", :force => true do |t|
t.string "name"
end
@@ -44,13 +49,8 @@
t.string "name"
t.string "email"
t.string "password_digest"
- t.datetime "created_at"
- t.datetime "updated_at"
- end
-
- create_table "posts_tags", :id => false, :force => true do |t|
- t.integer "post_id"
- t.integer "tag_id"
+ t.datetime "created_at", :null => false
+ t.datetime "updated_at", :null => false
end
end

0 comments on commit 50d693b

Please sign in to comment.
Something went wrong with that request. Please try again.