diff --git a/app/models/notification.rb b/app/models/notification.rb index 575769590..782f8bff7 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -1,7 +1,6 @@ class Notification < ActiveRecord::Base attr_accessible :to_id, :from_id, - :subject, :body, :post_id, - :notification_type, :read + :subject, :body, :post_id, :read belongs_to :sender, :class_name => 'Member', :foreign_key => 'from_id' belongs_to :recipient, :class_name => 'Member', :foreign_key => 'to_id' diff --git a/app/views/notifications/_form.html.haml b/app/views/notifications/_form.html.haml index 955449ec9..9747caa73 100644 --- a/app/views/notifications/_form.html.haml +++ b/app/views/notifications/_form.html.haml @@ -21,9 +21,6 @@ .field = f.label :read = f.check_box :read - .field - = f.label :notification_type - = f.number_field :notification_type .field = f.label :post_id = f.number_field :post_id diff --git a/app/views/notifications/index.html.haml b/app/views/notifications/index.html.haml index a5cb225a3..c5ddc573d 100644 --- a/app/views/notifications/index.html.haml +++ b/app/views/notifications/index.html.haml @@ -7,7 +7,6 @@ %th Subject %th Body %th Read - %th Notification type %th Post %th %th @@ -20,7 +19,6 @@ %td= notification.subject %td= notification.body %td= notification.read - %td= notification.notification_type %td= notification.post_id %td= link_to 'Show', notification %td= link_to 'Edit', edit_notification_path(notification) diff --git a/app/views/notifications/show.html.haml b/app/views/notifications/show.html.haml index 9f23d51ba..9a0657294 100644 --- a/app/views/notifications/show.html.haml +++ b/app/views/notifications/show.html.haml @@ -15,9 +15,6 @@ %p %b Read: = @notification.read -%p - %b Notification type: - = @notification.notification_type %p %b Post: = @notification.post_id diff --git a/db/migrate/20130212123628_create_notifications.rb b/db/migrate/20130212123628_create_notifications.rb index 2b8444eb6..0bb5e1bec 100644 --- a/db/migrate/20130212123628_create_notifications.rb +++ b/db/migrate/20130212123628_create_notifications.rb @@ -6,7 +6,6 @@ class CreateNotifications < ActiveRecord::Migration t.string :subject t.text :body t.boolean :read - t.integer :notification_type t.integer :post_id t.timestamps diff --git a/db/schema.rb b/db/schema.rb index cf20c354d..a7eb7dd65 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -11,14 +11,14 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 20130214034838) do +ActiveRecord::Schema.define(:version => 20130212123628) do create_table "comments", :force => true do |t| - t.integer "post_id", :limit => 255, :null => false - t.integer "author_id", :limit => 255, :null => false - t.text "body", :limit => 255, :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.integer "post_id", :null => false + t.integer "author_id", :null => false + t.text "body", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "crops", :force => true do |t| @@ -32,14 +32,6 @@ ActiveRecord::Schema.define(:version => 20130214034838) do add_index "crops", ["slug"], :name => "index_crops_on_slug", :unique => true add_index "crops", ["system_name"], :name => "index_crops_on_system_name" - create_table "forums", :force => true do |t| - t.string "name", :null => false - t.text "description", :null => false - t.integer "owner_id", :null => false - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "gardens", :force => true do |t| t.string "name", :null => false t.integer "owner_id" @@ -76,9 +68,6 @@ ActiveRecord::Schema.define(:version => 20130214034838) do t.string "slug" t.boolean "tos_agreement" t.boolean "show_email" - t.string "location" - t.float "latitude" - t.float "longitude" end add_index "members", ["confirmation_token"], :name => "index_users_on_confirmation_token", :unique => true @@ -87,23 +76,15 @@ ActiveRecord::Schema.define(:version => 20130214034838) do add_index "members", ["slug"], :name => "index_users_on_slug", :unique => true add_index "members", ["unlock_token"], :name => "index_users_on_unlock_token", :unique => true - create_table "members_roles", :force => true do |t| - t.integer "member_id" - t.integer "role_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "notifications", :force => true do |t| t.integer "from_id" - t.integer "to_id", :null => false + t.integer "to_id", :null => false t.string "subject" t.text "body" t.boolean "read" - t.integer "notification_type" t.integer "post_id" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false + t.datetime "created_at", :null => false + t.datetime "updated_at", :null => false end create_table "plantings", :force => true do |t| @@ -126,19 +107,11 @@ ActiveRecord::Schema.define(:version => 20130214034838) do t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.string "slug" - t.integer "forum_id" end add_index "posts", ["created_at", "author_id"], :name => "index_updates_on_created_at_and_user_id" add_index "posts", ["slug"], :name => "index_updates_on_slug", :unique => true - create_table "roles", :force => true do |t| - t.string "name", :null => false - t.text "description" - t.datetime "created_at", :null => false - t.datetime "updated_at", :null => false - end - create_table "scientific_names", :force => true do |t| t.string "scientific_name", :null => false t.integer "crop_id", :null => false diff --git a/spec/factories/notifications.rb b/spec/factories/notifications.rb index 1758e5042..aa26b4145 100644 --- a/spec/factories/notifications.rb +++ b/spec/factories/notifications.rb @@ -7,7 +7,6 @@ FactoryGirl.define do subject "MyString" body "MyText" read false - notification_type 1 post end end diff --git a/spec/views/notifications/edit.html.haml_spec.rb b/spec/views/notifications/edit.html.haml_spec.rb index 64ad41f7b..7a496efbe 100644 --- a/spec/views/notifications/edit.html.haml_spec.rb +++ b/spec/views/notifications/edit.html.haml_spec.rb @@ -8,7 +8,6 @@ describe "notifications/edit" do :subject => "MyString", :body => "MyText", :read => false, - :notification_type => 1, :post_id => 1 )) end @@ -23,7 +22,6 @@ describe "notifications/edit" do assert_select "input#notification_subject", :name => "notification[subject]" assert_select "textarea#notification_body", :name => "notification[body]" assert_select "input#notification_read", :name => "notification[read]" - assert_select "input#notification_notification_type", :name => "notification[notification_type]" assert_select "input#notification_post_id", :name => "notification[post_id]" end end diff --git a/spec/views/notifications/index.html.haml_spec.rb b/spec/views/notifications/index.html.haml_spec.rb index 16658ed4d..171a0f69d 100644 --- a/spec/views/notifications/index.html.haml_spec.rb +++ b/spec/views/notifications/index.html.haml_spec.rb @@ -9,7 +9,6 @@ describe "notifications/index" do :subject => "Subject", :body => "MyText", :read => false, - :notification_type => 3, :post_id => 4 ), stub_model(Notification, @@ -18,7 +17,6 @@ describe "notifications/index" do :subject => "Subject", :body => "MyText", :read => false, - :notification_type => 3, :post_id => 4 ) ]) @@ -32,7 +30,6 @@ describe "notifications/index" do assert_select "tr>td", :text => "Subject".to_s, :count => 2 assert_select "tr>td", :text => "MyText".to_s, :count => 2 assert_select "tr>td", :text => false.to_s, :count => 2 - assert_select "tr>td", :text => 3.to_s, :count => 2 assert_select "tr>td", :text => 4.to_s, :count => 2 end end diff --git a/spec/views/notifications/new.html.haml_spec.rb b/spec/views/notifications/new.html.haml_spec.rb index e676fa94b..9c01bb9cb 100644 --- a/spec/views/notifications/new.html.haml_spec.rb +++ b/spec/views/notifications/new.html.haml_spec.rb @@ -8,7 +8,6 @@ describe "notifications/new" do :subject => "MyString", :body => "MyText", :read => false, - :notification_type => 1, :post_id => 1 ).as_new_record) end @@ -23,7 +22,6 @@ describe "notifications/new" do assert_select "input#notification_subject", :name => "notification[subject]" assert_select "textarea#notification_body", :name => "notification[body]" assert_select "input#notification_read", :name => "notification[read]" - assert_select "input#notification_notification_type", :name => "notification[notification_type]" assert_select "input#notification_post_id", :name => "notification[post_id]" end end diff --git a/spec/views/notifications/show.html.haml_spec.rb b/spec/views/notifications/show.html.haml_spec.rb index d399a90aa..49076c1d1 100644 --- a/spec/views/notifications/show.html.haml_spec.rb +++ b/spec/views/notifications/show.html.haml_spec.rb @@ -8,7 +8,6 @@ describe "notifications/show" do :subject => "Subject", :body => "MyText", :read => false, - :notification_type => 3, :post_id => 4 )) end @@ -21,7 +20,6 @@ describe "notifications/show" do rendered.should match(/Subject/) rendered.should match(/MyText/) rendered.should match(/false/) - rendered.should match(/3/) rendered.should match(/4/) end end