diff options
-rw-r--r-- | app/models/info_request.rb | 1 | ||||
-rw-r--r-- | app/models/widget_vote.rb | 18 | ||||
-rw-r--r-- | db/migrate/20140824191444_create_widget_votes.rb | 11 |
3 files changed, 30 insertions, 0 deletions
diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 7f6b358db..505b9d140 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -50,6 +50,7 @@ class InfoRequest < ActiveRecord::Base has_many :info_request_events, :order => 'created_at' has_many :user_info_request_sent_alerts has_many :track_things, :order => 'created_at desc' + has_many :widget_votes has_many :comments, :order => 'created_at' has_many :censor_rules, :order => 'created_at desc' has_many :mail_server_logs, :order => 'mail_server_log_done_id' diff --git a/app/models/widget_vote.rb b/app/models/widget_vote.rb new file mode 100644 index 000000000..33697f0fb --- /dev/null +++ b/app/models/widget_vote.rb @@ -0,0 +1,18 @@ +# == Schema Information +# +# Table name: widget_votes +# +# id :integer not null, primary key +# cookie :string(255) +# info_request_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# + +class WidgetVote < ActiveRecord::Base + belongs_to :info_request + validates :info_request, :presence => true + + attr_accessible :cookie + validates :cookie, :length => { :is => 20 } +end diff --git a/db/migrate/20140824191444_create_widget_votes.rb b/db/migrate/20140824191444_create_widget_votes.rb new file mode 100644 index 000000000..0a7b4856a --- /dev/null +++ b/db/migrate/20140824191444_create_widget_votes.rb @@ -0,0 +1,11 @@ +class CreateWidgetVotes < ActiveRecord::Migration + def change + create_table :widget_votes do |t| + t.string :cookie + t.belongs_to :info_request, :null => false + + t.timestamps + end + add_index :widget_votes, :info_request_id + end +end |