test/tables_models.rb in simple-search-0.10.3 vs test/tables_models.rb in simple-search-0.11.0
- old
+ new
@@ -12,33 +12,32 @@
ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS 'comments'")
ActiveRecord::Base.connection.execute("DROP TABLE IF EXISTS 'post_likes'")
# create tables
ActiveRecord::Base.connection.create_table(:posts) do |t|
- t.string :subject
- t.text :body
+ t.string :subject
+ t.text :body
end
ActiveRecord::Base.connection.create_table(:comments) do |t|
- t.string :post_id
- t.text :body
- t.boolean :spam_flag
+ t.string :post_id
+ t.text :body
+ t.boolean :spam_flag
end
ActiveRecord::Base.connection.create_table(:post_likes) do |t|
- t.string :post_id
- t.boolean :like
+ t.string :post_id
+ t.boolean :like
end
# models
class Post < ActiveRecord::Base
- has_many :comments
- has_many :post_likes
+ has_many :comments
+ has_many :post_likes
end
class Comment < ActiveRecord::Base
- belongs_to :post
- has_many :votes
+ belongs_to :post
end
class PostLike < ActiveRecord::Base
- belongs_to :post
+ belongs_to :post
end
# insert tables
ActiveRecord::Base.connection.execute("INSERT INTO posts (id,subject,body) VALUES (1, 'subject foo','body foo') ")
ActiveRecord::Base.connection.execute("INSERT INTO posts (id,subject,body) VALUES (2, 'subject bar','body bar') ")