diff --git a/Gemfile.lock b/Gemfile.lock index 5af455c25de..0498faa1398 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -6,6 +6,14 @@ GIT rake rake-compiler +GIT + remote: https://github.com/SamSaffron/annotate_models.git + revision: ebe4ba7e3f6ceeb43e4e40078da2b261a1bb71b2 + specs: + annotate (2.6.0.beta1) + activerecord (>= 2.3.0) + rake (>= 0.8.7) + GIT remote: https://github.com/SamSaffron/message_bus revision: 031a107bbe6e468caa67ff540485d70230d1c362 @@ -71,13 +79,6 @@ GIT activerecord (>= 3.0.0) activesupport (>= 3.0.0) -PATH - remote: /home/sam/Source/annotate_models - specs: - annotate (2.6.0.beta1) - activerecord (>= 2.3.0) - rake (>= 0.8.7) - PATH remote: vendor/gems/discourse_emoji specs: diff --git a/app/models/admin_log.rb b/app/models/admin_log.rb index b69ee14f93a..63198f70a18 100644 --- a/app/models/admin_log.rb +++ b/app/models/admin_log.rb @@ -1,16 +1,3 @@ -# == Schema Information -# -# Table name: admin_logs -# -# id :integer not null, primary key -# action :integer not null -# admin_id :integer not null -# target_user_id :integer -# details :text -# created_at :datetime not null -# updated_at :datetime not null -# - # AdminLog stores information about actions that admins and moderators have taken, # like deleting users, changing site settings, etc. # Use the AdminLogger class to log records to this table. @@ -27,3 +14,17 @@ class AdminLog < ActiveRecord::Base @actions ||= Enum.new(:delete_user) end end + +# == Schema Information +# +# Table name: admin_logs +# +# id :integer not null, primary key +# action :integer not null +# admin_id :integer not null +# target_user_id :integer +# details :text +# created_at :datetime not null +# updated_at :datetime not null +# + diff --git a/app/models/category.rb b/app/models/category.rb index e53e22f030f..2a8035d95cf 100644 --- a/app/models/category.rb +++ b/app/models/category.rb @@ -1,31 +1,3 @@ -# == Schema Information -# -# Table name: categories -# -# id :integer not null, primary key -# name :string(50) not null -# color :string(6) default("AB9364"), not null -# topic_id :integer -# topic_count :integer default(0), not null -# created_at :datetime not null -# updated_at :datetime not null -# user_id :integer not null -# topics_year :integer -# topics_month :integer -# topics_week :integer -# slug :string(255) not null -# description :text -# text_color :string(6) default("FFFFFF"), not null -# hotness :float default(5.0), not null -# secure :boolean default(FALSE), not null -# auto_close_days :float -# -# Indexes -# -# index_categories_on_forum_thread_count (topic_count) -# index_categories_on_name (name) UNIQUE -# - class Category < ActiveRecord::Base belongs_to :topic, dependent: :destroy belongs_to :topic_only_relative_url, @@ -164,3 +136,32 @@ class Category < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: categories +# +# id :integer not null, primary key +# name :string(50) not null +# color :string(6) default("AB9364"), not null +# topic_id :integer +# topic_count :integer default(0), not null +# created_at :datetime not null +# updated_at :datetime not null +# user_id :integer not null +# topics_year :integer +# topics_month :integer +# topics_week :integer +# slug :string(255) not null +# description :text +# text_color :string(6) default("FFFFFF"), not null +# hotness :float default(5.0), not null +# secure :boolean default(FALSE), not null +# auto_close_days :float +# +# Indexes +# +# index_categories_on_forum_thread_count (topic_count) +# index_categories_on_name (name) UNIQUE +# + diff --git a/app/models/category_featured_topic.rb b/app/models/category_featured_topic.rb index 19f139a1574..94460142151 100644 --- a/app/models/category_featured_topic.rb +++ b/app/models/category_featured_topic.rb @@ -1,17 +1,3 @@ -# == Schema Information -# -# Table name: category_featured_topics -# -# category_id :integer not null -# topic_id :integer not null -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# cat_featured_threads (category_id,topic_id) UNIQUE -# - class CategoryFeaturedTopic < ActiveRecord::Base belongs_to :category belongs_to :topic @@ -50,3 +36,18 @@ class CategoryFeaturedTopic < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: category_featured_topics +# +# category_id :integer not null +# topic_id :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# cat_featured_threads (category_id,topic_id) UNIQUE +# + diff --git a/app/models/category_featured_user.rb b/app/models/category_featured_user.rb index a6c0ed8755a..f89fce9146a 100644 --- a/app/models/category_featured_user.rb +++ b/app/models/category_featured_user.rb @@ -1,18 +1,3 @@ -# == Schema Information -# -# Table name: category_featured_users -# -# id :integer not null, primary key -# category_id :integer -# user_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_category_featured_users_on_category_id_and_user_id (category_id,user_id) UNIQUE -# - class CategoryFeaturedUser < ActiveRecord::Base belongs_to :category belongs_to :user @@ -44,3 +29,19 @@ class CategoryFeaturedUser < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: category_featured_users +# +# id :integer not null, primary key +# category_id :integer +# user_id :integer +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_category_featured_users_on_category_id_and_user_id (category_id,user_id) UNIQUE +# + diff --git a/app/models/category_group.rb b/app/models/category_group.rb index 820651dc7cd..679c062e9ee 100644 --- a/app/models/category_group.rb +++ b/app/models/category_group.rb @@ -1,3 +1,8 @@ +class CategoryGroup < ActiveRecord::Base + belongs_to :category + belongs_to :group +end + # == Schema Information # # Table name: category_groups @@ -9,7 +14,3 @@ # updated_at :datetime not null # -class CategoryGroup < ActiveRecord::Base - belongs_to :category - belongs_to :group -end diff --git a/app/models/category_search_data.rb b/app/models/category_search_data.rb index 12b7510f61b..76feabbcc6d 100644 --- a/app/models/category_search_data.rb +++ b/app/models/category_search_data.rb @@ -1,3 +1,9 @@ +class CategorySearchData < ActiveRecord::Base + belongs_to :category + + validates_presence_of :search_data +end + # == Schema Information # # Table name: category_search_data @@ -10,8 +16,3 @@ # idx_search_category (search_data) # -class CategorySearchData < ActiveRecord::Base - belongs_to :category - - validates_presence_of :search_data -end diff --git a/app/models/draft.rb b/app/models/draft.rb index dd739db9638..012fb1c35bc 100644 --- a/app/models/draft.rb +++ b/app/models/draft.rb @@ -1,20 +1,3 @@ -# == Schema Information -# -# Table name: drafts -# -# id :integer not null, primary key -# user_id :integer not null -# draft_key :string(255) not null -# data :text not null -# created_at :datetime not null -# updated_at :datetime not null -# sequence :integer default(0), not null -# -# Indexes -# -# index_drafts_on_user_id_and_draft_key (user_id,draft_key) -# - class Draft < ActiveRecord::Base NEW_TOPIC = 'new_topic' NEW_PRIVATE_MESSAGE = 'new_private_message' @@ -54,3 +37,21 @@ class Draft < ActiveRecord::Base Draft.where(user_id: user_id, draft_key: key).first end end + +# == Schema Information +# +# Table name: drafts +# +# id :integer not null, primary key +# user_id :integer not null +# draft_key :string(255) not null +# data :text not null +# created_at :datetime not null +# updated_at :datetime not null +# sequence :integer default(0), not null +# +# Indexes +# +# index_drafts_on_user_id_and_draft_key (user_id,draft_key) +# + diff --git a/app/models/draft_sequence.rb b/app/models/draft_sequence.rb index 77f8fc7cfd1..ef0d63ef21b 100644 --- a/app/models/draft_sequence.rb +++ b/app/models/draft_sequence.rb @@ -1,17 +1,3 @@ -# == Schema Information -# -# Table name: draft_sequences -# -# id :integer not null, primary key -# user_id :integer not null -# draft_key :string(255) not null -# sequence :integer not null -# -# Indexes -# -# index_draft_sequences_on_user_id_and_draft_key (user_id,draft_key) UNIQUE -# - class DraftSequence < ActiveRecord::Base def self.next!(user,key) user_id = user @@ -37,3 +23,18 @@ class DraftSequence < ActiveRecord::Base r.length.zero? ? 0 : r[0][0].to_i end end + +# == Schema Information +# +# Table name: draft_sequences +# +# id :integer not null, primary key +# user_id :integer not null +# draft_key :string(255) not null +# sequence :integer not null +# +# Indexes +# +# index_draft_sequences_on_user_id_and_draft_key (user_id,draft_key) UNIQUE +# + diff --git a/app/models/email_log.rb b/app/models/email_log.rb index 2774797937d..4c3b9de8201 100644 --- a/app/models/email_log.rb +++ b/app/models/email_log.rb @@ -1,3 +1,18 @@ +class EmailLog < ActiveRecord::Base + belongs_to :user + validates_presence_of :email_type + validates_presence_of :to_address + + after_create do + # Update last_emailed_at if the user_id is present + User.update_all("last_emailed_at = CURRENT_TIMESTAMP", id: user_id) if user_id.present? + end + + def self.count_per_day(sinceDaysAgo = 30) + where('created_at > ?', sinceDaysAgo.days.ago).group('date(created_at)').order('date(created_at)').count + end +end + # == Schema Information # # Table name: email_logs @@ -15,17 +30,3 @@ # index_email_logs_on_user_id_and_created_at (user_id,created_at) # -class EmailLog < ActiveRecord::Base - belongs_to :user - validates_presence_of :email_type - validates_presence_of :to_address - - after_create do - # Update last_emailed_at if the user_id is present - User.update_all("last_emailed_at = CURRENT_TIMESTAMP", id: user_id) if user_id.present? - end - - def self.count_per_day(sinceDaysAgo = 30) - where('created_at > ?', sinceDaysAgo.days.ago).group('date(created_at)').order('date(created_at)').count - end -end diff --git a/app/models/email_token.rb b/app/models/email_token.rb index be07e2e4608..ad86416e602 100644 --- a/app/models/email_token.rb +++ b/app/models/email_token.rb @@ -1,21 +1,3 @@ -# == Schema Information -# -# Table name: email_tokens -# -# id :integer not null, primary key -# user_id :integer not null -# email :string(255) not null -# token :string(255) not null -# confirmed :boolean default(FALSE), not null -# expired :boolean default(FALSE), not null -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_email_tokens_on_token (token) UNIQUE -# - class EmailToken < ActiveRecord::Base belongs_to :user @@ -76,3 +58,22 @@ class EmailToken < ActiveRecord::Base # If the user's email is already taken, just return nil (failure) end end + +# == Schema Information +# +# Table name: email_tokens +# +# id :integer not null, primary key +# user_id :integer not null +# email :string(255) not null +# token :string(255) not null +# confirmed :boolean default(FALSE), not null +# expired :boolean default(FALSE), not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_email_tokens_on_token (token) UNIQUE +# + diff --git a/app/models/facebook_user_info.rb b/app/models/facebook_user_info.rb index 83b7969b751..2378fa45ca6 100644 --- a/app/models/facebook_user_info.rb +++ b/app/models/facebook_user_info.rb @@ -1,3 +1,8 @@ +class FacebookUserInfo < ActiveRecord::Base + attr_accessible :email, :facebook_user_id, :first_name, :gender, :last_name, :name, :user_id, :username, :link + belongs_to :user +end + # == Schema Information # # Table name: facebook_user_infos @@ -21,7 +26,3 @@ # index_facebook_user_infos_on_user_id (user_id) UNIQUE # -class FacebookUserInfo < ActiveRecord::Base - attr_accessible :email, :facebook_user_id, :first_name, :gender, :last_name, :name, :user_id, :username, :link - belongs_to :user -end diff --git a/app/models/github_user_info.rb b/app/models/github_user_info.rb index 2c4f603e1b2..762b459d5bc 100644 --- a/app/models/github_user_info.rb +++ b/app/models/github_user_info.rb @@ -1,3 +1,7 @@ +class GithubUserInfo < ActiveRecord::Base + belongs_to :user +end + # == Schema Information # # Table name: github_user_infos @@ -15,6 +19,3 @@ # index_github_user_infos_on_user_id (user_id) UNIQUE # -class GithubUserInfo < ActiveRecord::Base - belongs_to :user -end diff --git a/app/models/group.rb b/app/models/group.rb index 1726066c0ca..9265be647f7 100644 --- a/app/models/group.rb +++ b/app/models/group.rb @@ -1,19 +1,3 @@ -# == Schema Information -# -# Table name: groups -# -# id :integer not null, primary key -# name :string(255) not null -# created_at :datetime not null -# updated_at :datetime not null -# automatic :boolean default(FALSE), not null -# user_count :integer default(0), not null -# -# Indexes -# -# index_groups_on_name (name) UNIQUE -# - class Group < ActiveRecord::Base has_many :category_groups has_many :group_users, dependent: :destroy @@ -172,3 +156,20 @@ class Group < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: groups +# +# id :integer not null, primary key +# name :string(255) not null +# created_at :datetime not null +# updated_at :datetime not null +# automatic :boolean default(FALSE), not null +# user_count :integer default(0), not null +# +# Indexes +# +# index_groups_on_name (name) UNIQUE +# + diff --git a/app/models/group_user.rb b/app/models/group_user.rb index c9e6fe66eed..36d5789685c 100644 --- a/app/models/group_user.rb +++ b/app/models/group_user.rb @@ -1,3 +1,8 @@ +class GroupUser < ActiveRecord::Base + belongs_to :group, counter_cache: "user_count" + belongs_to :user +end + # == Schema Information # # Table name: group_users @@ -13,7 +18,3 @@ # index_group_users_on_group_id_and_user_id (group_id,user_id) UNIQUE # -class GroupUser < ActiveRecord::Base - belongs_to :group, counter_cache: "user_count" - belongs_to :user -end diff --git a/app/models/hot_topic.rb b/app/models/hot_topic.rb index c61189652ed..fe7dd338d9a 100644 --- a/app/models/hot_topic.rb +++ b/app/models/hot_topic.rb @@ -1,23 +1,3 @@ -# == Schema Information -# -# Table name: hot_topics -# -# id :integer not null, primary key -# topic_id :integer not null -# category_id :integer -# score :float not null -# random_bias :float -# random_multiplier :float -# days_ago_bias :float -# days_ago_multiplier :float -# hot_topic_type :integer -# -# Indexes -# -# index_hot_topics_on_score (score) -# index_hot_topics_on_topic_id (topic_id) UNIQUE -# - class HotTopic < ActiveRecord::Base belongs_to :topic @@ -144,3 +124,24 @@ class HotTopic < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: hot_topics +# +# id :integer not null, primary key +# topic_id :integer not null +# category_id :integer +# score :float not null +# random_bias :float +# random_multiplier :float +# days_ago_bias :float +# days_ago_multiplier :float +# hot_topic_type :integer +# +# Indexes +# +# index_hot_topics_on_score (score) +# index_hot_topics_on_topic_id (topic_id) UNIQUE +# + diff --git a/app/models/incoming_link.rb b/app/models/incoming_link.rb index 990d7ea6874..d082fa4e210 100644 --- a/app/models/incoming_link.rb +++ b/app/models/incoming_link.rb @@ -1,24 +1,3 @@ -# == Schema Information -# -# Table name: incoming_links -# -# id :integer not null, primary key -# url :string(1000) not null -# referer :string(1000) -# domain :string(100) -# topic_id :integer -# post_number :integer -# created_at :datetime not null -# updated_at :datetime not null -# user_id :integer -# ip_address :string -# current_user_id :integer -# -# Indexes -# -# incoming_index (topic_id,post_number) -# - class IncomingLink < ActiveRecord::Base belongs_to :topic belongs_to :user @@ -107,3 +86,25 @@ class IncomingLink < ActiveRecord::Base end end end + +# == Schema Information +# +# Table name: incoming_links +# +# id :integer not null, primary key +# url :string(1000) not null +# referer :string(1000) +# domain :string(100) +# topic_id :integer +# post_number :integer +# created_at :datetime not null +# updated_at :datetime not null +# user_id :integer +# ip_address :string +# current_user_id :integer +# +# Indexes +# +# incoming_index (topic_id,post_number) +# + diff --git a/app/models/invite.rb b/app/models/invite.rb index ea49fc45c98..d95baebb8e3 100644 --- a/app/models/invite.rb +++ b/app/models/invite.rb @@ -1,23 +1,3 @@ -# == Schema Information -# -# Table name: invites -# -# id :integer not null, primary key -# invite_key :string(32) not null -# email :string(255) not null -# invited_by_id :integer not null -# user_id :integer -# redeemed_at :datetime -# created_at :datetime not null -# updated_at :datetime not null -# deleted_at :datetime -# -# Indexes -# -# index_invites_on_email_and_invited_by_id (email,invited_by_id) UNIQUE -# index_invites_on_invite_key (invite_key) UNIQUE -# - require_dependency 'trashable' class Invite < ActiveRecord::Base @@ -105,3 +85,24 @@ class Invite < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: invites +# +# id :integer not null, primary key +# invite_key :string(32) not null +# email :string(255) not null +# invited_by_id :integer not null +# user_id :integer +# redeemed_at :datetime +# created_at :datetime not null +# updated_at :datetime not null +# deleted_at :datetime +# +# Indexes +# +# index_invites_on_email_and_invited_by_id (email,invited_by_id) UNIQUE +# index_invites_on_invite_key (invite_key) UNIQUE +# + diff --git a/app/models/notification.rb b/app/models/notification.rb index f35e82ba1b3..f5832fa589f 100644 --- a/app/models/notification.rb +++ b/app/models/notification.rb @@ -1,24 +1,3 @@ -# == Schema Information -# -# Table name: notifications -# -# id :integer not null, primary key -# notification_type :integer not null -# user_id :integer not null -# data :string(1000) not null -# read :boolean default(FALSE), not null -# created_at :datetime not null -# updated_at :datetime not null -# topic_id :integer -# post_number :integer -# post_action_id :integer -# -# Indexes -# -# index_notifications_on_post_action_id (post_action_id) -# index_notifications_on_user_id_and_created_at (user_id,created_at) -# - require_dependency 'enum' class Notification < ActiveRecord::Base @@ -124,3 +103,24 @@ class Notification < ActiveRecord::Base end +# == Schema Information +# +# Table name: notifications +# +# id :integer not null, primary key +# notification_type :integer not null +# user_id :integer not null +# data :string(1000) not null +# read :boolean default(FALSE), not null +# created_at :datetime not null +# updated_at :datetime not null +# topic_id :integer +# post_number :integer +# post_action_id :integer +# +# Indexes +# +# index_notifications_on_post_action_id (post_action_id) +# index_notifications_on_user_id_and_created_at (user_id,created_at) +# + diff --git a/app/models/post.rb b/app/models/post.rb index 087bf7906f9..b48b12723c1 100644 --- a/app/models/post.rb +++ b/app/models/post.rb @@ -1,50 +1,3 @@ -# == Schema Information -# -# Table name: posts -# -# id :integer not null, primary key -# user_id :integer not null -# topic_id :integer not null -# post_number :integer not null -# raw :text not null -# cooked :text not null -# created_at :datetime not null -# updated_at :datetime not null -# reply_to_post_number :integer -# cached_version :integer default(1), not null -# reply_count :integer default(0), not null -# quote_count :integer default(0), not null -# deleted_at :datetime -# off_topic_count :integer default(0), not null -# like_count :integer default(0), not null -# incoming_link_count :integer default(0), not null -# bookmark_count :integer default(0), not null -# avg_time :integer -# score :float -# reads :integer default(0), not null -# post_type :integer default(1), not null -# vote_count :integer default(0), not null -# sort_order :integer -# last_editor_id :integer -# hidden :boolean default(FALSE), not null -# hidden_reason_id :integer -# notify_moderators_count :integer default(0), not null -# spam_count :integer default(0), not null -# illegal_count :integer default(0), not null -# inappropriate_count :integer default(0), not null -# last_version_at :datetime not null -# user_deleted :boolean default(FALSE), not null -# reply_to_user_id :integer -# percent_rank :float default(1.0) -# notify_user_count :integer default(0), not null -# -# Indexes -# -# idx_posts_user_id_deleted_at (user_id) -# index_posts_on_reply_to_post_number (reply_to_post_number) -# index_posts_on_topic_id_and_post_number (topic_id,post_number) UNIQUE -# - require_dependency 'jobs' require_dependency 'pretty_text' require_dependency 'rate_limiter' @@ -536,3 +489,51 @@ class Post < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: posts +# +# id :integer not null, primary key +# user_id :integer not null +# topic_id :integer not null +# post_number :integer not null +# raw :text not null +# cooked :text not null +# created_at :datetime not null +# updated_at :datetime not null +# reply_to_post_number :integer +# cached_version :integer default(1), not null +# reply_count :integer default(0), not null +# quote_count :integer default(0), not null +# deleted_at :datetime +# off_topic_count :integer default(0), not null +# like_count :integer default(0), not null +# incoming_link_count :integer default(0), not null +# bookmark_count :integer default(0), not null +# avg_time :integer +# score :float +# reads :integer default(0), not null +# post_type :integer default(1), not null +# vote_count :integer default(0), not null +# sort_order :integer +# last_editor_id :integer +# hidden :boolean default(FALSE), not null +# hidden_reason_id :integer +# notify_moderators_count :integer default(0), not null +# spam_count :integer default(0), not null +# illegal_count :integer default(0), not null +# inappropriate_count :integer default(0), not null +# last_version_at :datetime not null +# user_deleted :boolean default(FALSE), not null +# reply_to_user_id :integer +# percent_rank :float default(1.0) +# notify_user_count :integer default(0), not null +# +# Indexes +# +# idx_posts_user_id_deleted_at (user_id) +# index_posts_on_reply_to_post_number (reply_to_post_number) +# index_posts_on_topic_id_and_post_number (topic_id,post_number) UNIQUE +# + diff --git a/app/models/post_action.rb b/app/models/post_action.rb index d84ca6e623d..a749ca8c526 100644 --- a/app/models/post_action.rb +++ b/app/models/post_action.rb @@ -1,24 +1,3 @@ -# == Schema Information -# -# Table name: post_actions -# -# id :integer not null, primary key -# post_id :integer not null -# user_id :integer not null -# post_action_type_id :integer not null -# deleted_at :datetime -# created_at :datetime not null -# updated_at :datetime not null -# deleted_by :integer -# message :text -# related_post_id :integer -# -# Indexes -# -# idx_unique_actions (user_id,post_action_type_id,post_id,deleted_at) UNIQUE -# index_post_actions_on_post_id (post_id) -# - require_dependency 'rate_limiter' require_dependency 'system_message' require_dependency 'trashable' @@ -263,3 +242,25 @@ class PostAction < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: post_actions +# +# id :integer not null, primary key +# post_id :integer not null +# user_id :integer not null +# post_action_type_id :integer not null +# deleted_at :datetime +# created_at :datetime not null +# updated_at :datetime not null +# deleted_by :integer +# message :text +# related_post_id :integer +# +# Indexes +# +# idx_unique_actions (user_id,post_action_type_id,post_id,deleted_at) UNIQUE +# index_post_actions_on_post_id (post_id) +# + diff --git a/app/models/post_action_type.rb b/app/models/post_action_type.rb index 5c52b52f5dc..40c6d087c70 100644 --- a/app/models/post_action_type.rb +++ b/app/models/post_action_type.rb @@ -1,16 +1,3 @@ -# == Schema Information -# -# Table name: post_action_types -# -# name_key :string(50) not null -# is_flag :boolean default(FALSE), not null -# icon :string(20) -# created_at :datetime not null -# updated_at :datetime not null -# id :integer not null, primary key -# position :integer default(0), not null -# - require_dependency 'enum' class PostActionType < ActiveRecord::Base @@ -44,3 +31,17 @@ class PostActionType < ActiveRecord::Base end end end + +# == Schema Information +# +# Table name: post_action_types +# +# name_key :string(50) not null +# is_flag :boolean default(FALSE), not null +# icon :string(20) +# created_at :datetime not null +# updated_at :datetime not null +# id :integer not null, primary key +# position :integer default(0), not null +# + diff --git a/app/models/post_reply.rb b/app/models/post_reply.rb index 099d70b5c0d..c350b30e998 100644 --- a/app/models/post_reply.rb +++ b/app/models/post_reply.rb @@ -1,3 +1,10 @@ +class PostReply < ActiveRecord::Base + belongs_to :post + belongs_to :reply, class_name: 'Post' + + validates_uniqueness_of :reply_id, scope: :post_id +end + # == Schema Information # # Table name: post_replies @@ -12,9 +19,3 @@ # index_post_replies_on_post_id_and_reply_id (post_id,reply_id) UNIQUE # -class PostReply < ActiveRecord::Base - belongs_to :post - belongs_to :reply, class_name: 'Post' - - validates_uniqueness_of :reply_id, scope: :post_id -end diff --git a/app/models/post_search_data.rb b/app/models/post_search_data.rb index c58f0c873a8..42745d698c9 100644 --- a/app/models/post_search_data.rb +++ b/app/models/post_search_data.rb @@ -1,3 +1,9 @@ +class PostSearchData < ActiveRecord::Base + belongs_to :post + + validates_presence_of :search_data +end + # == Schema Information # # Table name: post_search_data @@ -10,8 +16,3 @@ # idx_search_post (search_data) # -class PostSearchData < ActiveRecord::Base - belongs_to :post - - validates_presence_of :search_data -end diff --git a/app/models/post_timing.rb b/app/models/post_timing.rb index 3ae564dfdb8..a6571a6b68c 100644 --- a/app/models/post_timing.rb +++ b/app/models/post_timing.rb @@ -1,18 +1,3 @@ -# == Schema Information -# -# Table name: post_timings -# -# topic_id :integer not null -# post_number :integer not null -# user_id :integer not null -# msecs :integer not null -# -# Indexes -# -# post_timings_summary (topic_id,post_number) -# post_timings_unique (topic_id,post_number,user_id) UNIQUE -# - class PostTiming < ActiveRecord::Base belongs_to :topic belongs_to :user @@ -81,3 +66,19 @@ class PostTiming < ActiveRecord::Base end end end + +# == Schema Information +# +# Table name: post_timings +# +# topic_id :integer not null +# post_number :integer not null +# user_id :integer not null +# msecs :integer not null +# +# Indexes +# +# post_timings_summary (topic_id,post_number) +# post_timings_unique (topic_id,post_number,user_id) UNIQUE +# + diff --git a/app/models/site_content.rb b/app/models/site_content.rb index 3079ce4e82f..e4aa2ada8d1 100644 --- a/app/models/site_content.rb +++ b/app/models/site_content.rb @@ -1,17 +1,3 @@ -# == Schema Information -# -# Table name: site_contents -# -# content_type :string(255) not null, primary key -# content :text not null -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_site_contents_on_content_type (content_type) UNIQUE -# - require_dependency 'site_content_type' require_dependency 'site_content_class_methods' @@ -37,3 +23,18 @@ class SiteContent < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: site_contents +# +# content_type :string(255) not null, primary key +# content :text not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_site_contents_on_content_type (content_type) UNIQUE +# + diff --git a/app/models/site_customization.rb b/app/models/site_customization.rb index 43d6790f85d..40814ea7917 100644 --- a/app/models/site_customization.rb +++ b/app/models/site_customization.rb @@ -1,25 +1,3 @@ -# == Schema Information -# -# Table name: site_customizations -# -# id :integer not null, primary key -# name :string(255) not null -# stylesheet :text -# header :text -# position :integer not null -# user_id :integer not null -# enabled :boolean not null -# key :string(255) not null -# created_at :datetime not null -# updated_at :datetime not null -# override_default_style :boolean default(FALSE), not null -# stylesheet_baked :text default(""), not null -# -# Indexes -# -# index_site_customizations_on_key (key) -# - class SiteCustomization < ActiveRecord::Base ENABLED_KEY = '7e202ef2-56d7-47d5-98d8-a9c8d15e57dd' # placing this in uploads to ease deployment rules @@ -191,3 +169,26 @@ footer:after{ content: '#{error}' }" @stylesheet_link_tag = "" end end + +# == Schema Information +# +# Table name: site_customizations +# +# id :integer not null, primary key +# name :string(255) not null +# stylesheet :text +# header :text +# position :integer not null +# user_id :integer not null +# enabled :boolean not null +# key :string(255) not null +# created_at :datetime not null +# updated_at :datetime not null +# override_default_style :boolean default(FALSE), not null +# stylesheet_baked :text default(""), not null +# +# Indexes +# +# index_site_customizations_on_key (key) +# + diff --git a/app/models/site_setting.rb b/app/models/site_setting.rb index da7b8556231..903ef7ea7ee 100644 --- a/app/models/site_setting.rb +++ b/app/models/site_setting.rb @@ -1,15 +1,3 @@ -# == Schema Information -# -# Table name: site_settings -# -# id :integer not null, primary key -# name :string(255) not null -# data_type :integer not null -# value :text -# created_at :datetime not null -# updated_at :datetime not null -# - require 'site_setting_extension' class SiteSetting < ActiveRecord::Base @@ -238,3 +226,16 @@ class SiteSetting < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: site_settings +# +# id :integer not null, primary key +# name :string(255) not null +# data_type :integer not null +# value :text +# created_at :datetime not null +# updated_at :datetime not null +# + diff --git a/app/models/topic.rb b/app/models/topic.rb index 55327ee4a79..9563ddc2ec3 100644 --- a/app/models/topic.rb +++ b/app/models/topic.rb @@ -1,59 +1,3 @@ -# == Schema Information -# -# Table name: topics -# -# id :integer not null, primary key -# title :string(255) not null -# last_posted_at :datetime -# created_at :datetime not null -# updated_at :datetime not null -# views :integer default(0), not null -# posts_count :integer default(0), not null -# user_id :integer not null -# last_post_user_id :integer not null -# reply_count :integer default(0), not null -# featured_user1_id :integer -# featured_user2_id :integer -# featured_user3_id :integer -# avg_time :integer -# deleted_at :datetime -# highest_post_number :integer default(0), not null -# image_url :string(255) -# off_topic_count :integer default(0), not null -# like_count :integer default(0), not null -# incoming_link_count :integer default(0), not null -# bookmark_count :integer default(0), not null -# star_count :integer default(0), not null -# category_id :integer -# visible :boolean default(TRUE), not null -# moderator_posts_count :integer default(0), not null -# closed :boolean default(FALSE), not null -# archived :boolean default(FALSE), not null -# bumped_at :datetime not null -# has_best_of :boolean default(FALSE), not null -# meta_data :hstore -# vote_count :integer default(0), not null -# archetype :string(255) default("regular"), not null -# featured_user4_id :integer -# notify_moderators_count :integer default(0), not null -# spam_count :integer default(0), not null -# illegal_count :integer default(0), not null -# inappropriate_count :integer default(0), not null -# pinned_at :datetime -# score :float -# percent_rank :float default(1.0), not null -# notify_user_count :integer default(0), not null -# subtype :string(255) -# slug :string(255) -# auto_close_at :datetime -# auto_close_user_id :integer -# -# Indexes -# -# idx_topics_user_id_deleted_at (user_id) -# index_forum_threads_on_bumped_at (bumped_at) -# - require_dependency 'slug' require_dependency 'avatar_lookup' require_dependency 'topic_view' @@ -785,3 +729,60 @@ class Topic < ActiveRecord::Base category && category.secure end end + +# == Schema Information +# +# Table name: topics +# +# id :integer not null, primary key +# title :string(255) not null +# last_posted_at :datetime +# created_at :datetime not null +# updated_at :datetime not null +# views :integer default(0), not null +# posts_count :integer default(0), not null +# user_id :integer not null +# last_post_user_id :integer not null +# reply_count :integer default(0), not null +# featured_user1_id :integer +# featured_user2_id :integer +# featured_user3_id :integer +# avg_time :integer +# deleted_at :datetime +# highest_post_number :integer default(0), not null +# image_url :string(255) +# off_topic_count :integer default(0), not null +# like_count :integer default(0), not null +# incoming_link_count :integer default(0), not null +# bookmark_count :integer default(0), not null +# star_count :integer default(0), not null +# category_id :integer +# visible :boolean default(TRUE), not null +# moderator_posts_count :integer default(0), not null +# closed :boolean default(FALSE), not null +# archived :boolean default(FALSE), not null +# bumped_at :datetime not null +# has_best_of :boolean default(FALSE), not null +# meta_data :hstore +# vote_count :integer default(0), not null +# archetype :string(255) default("regular"), not null +# featured_user4_id :integer +# notify_moderators_count :integer default(0), not null +# spam_count :integer default(0), not null +# illegal_count :integer default(0), not null +# inappropriate_count :integer default(0), not null +# pinned_at :datetime +# score :float +# percent_rank :float default(1.0), not null +# notify_user_count :integer default(0), not null +# subtype :string(255) +# slug :string(255) +# auto_close_at :datetime +# auto_close_user_id :integer +# +# Indexes +# +# idx_topics_user_id_deleted_at (user_id) +# index_forum_threads_on_bumped_at (bumped_at) +# + diff --git a/app/models/topic_allowed_group.rb b/app/models/topic_allowed_group.rb index 393ca9b54be..9b6cea59936 100644 --- a/app/models/topic_allowed_group.rb +++ b/app/models/topic_allowed_group.rb @@ -1,3 +1,11 @@ +class TopicAllowedGroup < ActiveRecord::Base + belongs_to :topic + belongs_to :group + attr_accessible :group_id, :user_id + + validates_uniqueness_of :topic_id, scope: :group_id +end + # == Schema Information # # Table name: topic_allowed_groups @@ -12,10 +20,3 @@ # index_topic_allowed_groups_on_topic_id_and_group_id (topic_id,group_id) UNIQUE # -class TopicAllowedGroup < ActiveRecord::Base - belongs_to :topic - belongs_to :group - attr_accessible :group_id, :user_id - - validates_uniqueness_of :topic_id, scope: :group_id -end diff --git a/app/models/topic_allowed_user.rb b/app/models/topic_allowed_user.rb index 7691e80c71f..eff27af1468 100644 --- a/app/models/topic_allowed_user.rb +++ b/app/models/topic_allowed_user.rb @@ -1,3 +1,11 @@ +class TopicAllowedUser < ActiveRecord::Base + belongs_to :topic + belongs_to :user + attr_accessible :topic_id, :user_id + + validates_uniqueness_of :topic_id, scope: :user_id +end + # == Schema Information # # Table name: topic_allowed_users @@ -14,10 +22,3 @@ # index_topic_allowed_users_on_user_id_and_topic_id (user_id,topic_id) UNIQUE # -class TopicAllowedUser < ActiveRecord::Base - belongs_to :topic - belongs_to :user - attr_accessible :topic_id, :user_id - - validates_uniqueness_of :topic_id, scope: :user_id -end diff --git a/app/models/topic_invite.rb b/app/models/topic_invite.rb index eca7b2c4663..19157d98d38 100644 --- a/app/models/topic_invite.rb +++ b/app/models/topic_invite.rb @@ -1,3 +1,13 @@ +class TopicInvite < ActiveRecord::Base + belongs_to :topic + belongs_to :invite + + validates_presence_of :topic_id + validates_presence_of :invite_id + + validates_uniqueness_of :topic_id, scope: :invite_id +end + # == Schema Information # # Table name: topic_invites @@ -14,12 +24,3 @@ # index_topic_invites_on_topic_id_and_invite_id (topic_id,invite_id) UNIQUE # -class TopicInvite < ActiveRecord::Base - belongs_to :topic - belongs_to :invite - - validates_presence_of :topic_id - validates_presence_of :invite_id - - validates_uniqueness_of :topic_id, scope: :invite_id -end diff --git a/app/models/topic_link.rb b/app/models/topic_link.rb index 6992b865bdc..cfd9a9797e7 100644 --- a/app/models/topic_link.rb +++ b/app/models/topic_link.rb @@ -1,27 +1,3 @@ -# == Schema Information -# -# Table name: topic_links -# -# id :integer not null, primary key -# topic_id :integer not null -# post_id :integer -# user_id :integer not null -# url :string(500) not null -# domain :string(100) not null -# internal :boolean default(FALSE), not null -# link_topic_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# reflection :boolean default(FALSE) -# clicks :integer default(0), not null -# link_post_id :integer -# -# Indexes -# -# index_forum_thread_links_on_forum_thread_id (topic_id) -# index_forum_thread_links_on_forum_thread_id_and_post_id_and_url (topic_id,post_id,url) UNIQUE -# - require 'uri' require_dependency 'slug' @@ -144,3 +120,28 @@ class TopicLink < ActiveRecord::Base end end end + +# == Schema Information +# +# Table name: topic_links +# +# id :integer not null, primary key +# topic_id :integer not null +# post_id :integer +# user_id :integer not null +# url :string(500) not null +# domain :string(100) not null +# internal :boolean default(FALSE), not null +# link_topic_id :integer +# created_at :datetime not null +# updated_at :datetime not null +# reflection :boolean default(FALSE) +# clicks :integer default(0), not null +# link_post_id :integer +# +# Indexes +# +# index_forum_thread_links_on_forum_thread_id (topic_id) +# index_forum_thread_links_on_forum_thread_id_and_post_id_and_url (topic_id,post_id,url) UNIQUE +# + diff --git a/app/models/topic_link_click.rb b/app/models/topic_link_click.rb index 8a4901eb1d3..e5b7d2b17fa 100644 --- a/app/models/topic_link_click.rb +++ b/app/models/topic_link_click.rb @@ -1,19 +1,3 @@ -# == Schema Information -# -# Table name: topic_link_clicks -# -# id :integer not null, primary key -# topic_link_id :integer not null -# user_id :integer -# ip :integer not null -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_forum_thread_link_clicks_on_forum_thread_link_id (topic_link_id) -# - require_dependency 'discourse' require 'ipaddr' @@ -70,3 +54,20 @@ class TopicLinkClick < ActiveRecord::Base result end end + +# == Schema Information +# +# Table name: topic_link_clicks +# +# id :integer not null, primary key +# topic_link_id :integer not null +# user_id :integer +# ip :integer not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_forum_thread_link_clicks_on_forum_thread_link_id (topic_link_id) +# + diff --git a/app/models/topic_user.rb b/app/models/topic_user.rb index 5032a92789b..97aa9915e8b 100644 --- a/app/models/topic_user.rb +++ b/app/models/topic_user.rb @@ -1,28 +1,3 @@ -# == Schema Information -# -# Table name: topic_users -# -# user_id :integer not null -# topic_id :integer not null -# starred :boolean default(FALSE), not null -# posted :boolean default(FALSE), not null -# last_read_post_number :integer -# seen_post_count :integer -# starred_at :datetime -# last_visited_at :datetime -# first_visited_at :datetime -# notification_level :integer default(1), not null -# notifications_changed_at :datetime -# notifications_reason_id :integer -# total_msecs_viewed :integer default(0), not null -# cleared_pinned_at :datetime -# unstarred_at :datetime -# -# Indexes -# -# index_forum_thread_users_on_forum_thread_id_and_user_id (topic_id,user_id) UNIQUE -# - class TopicUser < ActiveRecord::Base belongs_to :user belongs_to :topic @@ -234,3 +209,29 @@ SQL end end + +# == Schema Information +# +# Table name: topic_users +# +# user_id :integer not null +# topic_id :integer not null +# starred :boolean default(FALSE), not null +# posted :boolean default(FALSE), not null +# last_read_post_number :integer +# seen_post_count :integer +# starred_at :datetime +# last_visited_at :datetime +# first_visited_at :datetime +# notification_level :integer default(1), not null +# notifications_changed_at :datetime +# notifications_reason_id :integer +# total_msecs_viewed :integer default(0), not null +# cleared_pinned_at :datetime +# unstarred_at :datetime +# +# Indexes +# +# index_forum_thread_users_on_forum_thread_id_and_user_id (topic_id,user_id) UNIQUE +# + diff --git a/app/models/twitter_user_info.rb b/app/models/twitter_user_info.rb index c5277e17179..8d7b75c12d4 100644 --- a/app/models/twitter_user_info.rb +++ b/app/models/twitter_user_info.rb @@ -1,3 +1,7 @@ +class TwitterUserInfo < ActiveRecord::Base + belongs_to :user +end + # == Schema Information # # Table name: twitter_user_infos @@ -15,6 +19,3 @@ # index_twitter_user_infos_on_user_id (user_id) UNIQUE # -class TwitterUserInfo < ActiveRecord::Base - belongs_to :user -end diff --git a/app/models/upload.rb b/app/models/upload.rb index c4731117b1e..8de2a6e168a 100644 --- a/app/models/upload.rb +++ b/app/models/upload.rb @@ -1,24 +1,3 @@ -# == Schema Information -# -# Table name: uploads -# -# id :integer not null, primary key -# user_id :integer not null -# topic_id :integer not null -# original_filename :string(255) not null -# filesize :integer not null -# width :integer -# height :integer -# url :string(255) not null -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# index_uploads_on_forum_thread_id (topic_id) -# index_uploads_on_user_id (user_id) -# - require 'digest/sha1' class Upload < ActiveRecord::Base @@ -114,3 +93,25 @@ class Upload < ActiveRecord::Base end end + +# == Schema Information +# +# Table name: uploads +# +# id :integer not null, primary key +# user_id :integer not null +# topic_id :integer not null +# original_filename :string(255) not null +# filesize :integer not null +# width :integer +# height :integer +# url :string(255) not null +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# index_uploads_on_forum_thread_id (topic_id) +# index_uploads_on_user_id (user_id) +# + diff --git a/app/models/user.rb b/app/models/user.rb index 22939e3e073..d91d69e0d5d 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -1,63 +1,3 @@ -# == Schema Information -# -# Table name: users -# -# id :integer not null, primary key -# username :string(20) not null -# created_at :datetime not null -# updated_at :datetime not null -# name :string(255) -# bio_raw :text -# seen_notification_id :integer default(0), not null -# last_posted_at :datetime -# email :string(256) not null -# password_hash :string(64) -# salt :string(32) -# active :boolean -# username_lower :string(20) not null -# auth_token :string(32) -# last_seen_at :datetime -# website :string(255) -# admin :boolean default(FALSE), not null -# last_emailed_at :datetime -# email_digests :boolean default(TRUE), not null -# trust_level :integer not null -# bio_cooked :text -# email_private_messages :boolean default(TRUE) -# email_direct :boolean default(TRUE), not null -# approved :boolean default(FALSE), not null -# approved_by_id :integer -# approved_at :datetime -# topics_entered :integer default(0), not null -# posts_read_count :integer default(0), not null -# digest_after_days :integer default(7), not null -# previous_visit_at :datetime -# banned_at :datetime -# banned_till :datetime -# date_of_birth :date -# auto_track_topics_after_msecs :integer -# views :integer default(0), not null -# flag_level :integer default(0), not null -# time_read :integer default(0), not null -# days_visited :integer default(0), not null -# ip_address :string -# new_topic_duration_minutes :integer -# external_links_in_new_tab :boolean default(FALSE), not null -# enable_quoting :boolean default(TRUE), not null -# moderator :boolean default(FALSE) -# likes_given :integer default(0), not null -# likes_received :integer default(0), not null -# topic_reply_count :integer default(0), not null -# -# Indexes -# -# index_users_on_auth_token (auth_token) -# index_users_on_email (email) UNIQUE -# index_users_on_last_posted_at (last_posted_at) -# index_users_on_username (username) UNIQUE -# index_users_on_username_lower (username_lower) UNIQUE -# - require_dependency 'email' require_dependency 'email_token' require_dependency 'trust_level' @@ -718,3 +658,64 @@ class User < ActiveRecord::Base end + +# == Schema Information +# +# Table name: users +# +# id :integer not null, primary key +# username :string(20) not null +# created_at :datetime not null +# updated_at :datetime not null +# name :string(255) +# bio_raw :text +# seen_notification_id :integer default(0), not null +# last_posted_at :datetime +# email :string(256) not null +# password_hash :string(64) +# salt :string(32) +# active :boolean +# username_lower :string(20) not null +# auth_token :string(32) +# last_seen_at :datetime +# website :string(255) +# admin :boolean default(FALSE), not null +# last_emailed_at :datetime +# email_digests :boolean default(TRUE), not null +# trust_level :integer not null +# bio_cooked :text +# email_private_messages :boolean default(TRUE) +# email_direct :boolean default(TRUE), not null +# approved :boolean default(FALSE), not null +# approved_by_id :integer +# approved_at :datetime +# topics_entered :integer default(0), not null +# posts_read_count :integer default(0), not null +# digest_after_days :integer default(7), not null +# previous_visit_at :datetime +# banned_at :datetime +# banned_till :datetime +# date_of_birth :date +# auto_track_topics_after_msecs :integer +# views :integer default(0), not null +# flag_level :integer default(0), not null +# time_read :integer default(0), not null +# days_visited :integer default(0), not null +# ip_address :string +# new_topic_duration_minutes :integer +# external_links_in_new_tab :boolean default(FALSE), not null +# enable_quoting :boolean default(TRUE), not null +# moderator :boolean default(FALSE) +# likes_given :integer default(0), not null +# likes_received :integer default(0), not null +# topic_reply_count :integer default(0), not null +# +# Indexes +# +# index_users_on_auth_token (auth_token) +# index_users_on_email (email) UNIQUE +# index_users_on_last_posted_at (last_posted_at) +# index_users_on_username (username) UNIQUE +# index_users_on_username_lower (username_lower) UNIQUE +# + diff --git a/app/models/user_action.rb b/app/models/user_action.rb index 236c0d89e1b..e88b698f7b9 100644 --- a/app/models/user_action.rb +++ b/app/models/user_action.rb @@ -1,24 +1,3 @@ -# == Schema Information -# -# Table name: user_actions -# -# id :integer not null, primary key -# action_type :integer not null -# user_id :integer not null -# target_topic_id :integer -# target_post_id :integer -# target_user_id :integer -# acting_user_id :integer -# created_at :datetime not null -# updated_at :datetime not null -# -# Indexes -# -# idx_unique_rows (action_type,user_id,target_topic_id,target_post_id,acting_user_id) UNIQUE -# index_actions_on_acting_user_id (acting_user_id) -# index_actions_on_user_id_and_action_type (user_id,action_type) -# - class UserAction < ActiveRecord::Base belongs_to :user belongs_to :target_post, class_name: "Post" @@ -292,3 +271,25 @@ ORDER BY p.created_at desc end end end + +# == Schema Information +# +# Table name: user_actions +# +# id :integer not null, primary key +# action_type :integer not null +# user_id :integer not null +# target_topic_id :integer +# target_post_id :integer +# target_user_id :integer +# acting_user_id :integer +# created_at :datetime not null +# updated_at :datetime not null +# +# Indexes +# +# idx_unique_rows (action_type,user_id,target_topic_id,target_post_id,acting_user_id) UNIQUE +# index_actions_on_acting_user_id (acting_user_id) +# index_actions_on_user_id_and_action_type (user_id,action_type) +# + diff --git a/app/models/user_open_id.rb b/app/models/user_open_id.rb index acf9668f9ec..14246041e21 100644 --- a/app/models/user_open_id.rb +++ b/app/models/user_open_id.rb @@ -1,3 +1,11 @@ +class UserOpenId < ActiveRecord::Base + belongs_to :user + attr_accessible :email, :url, :user_id, :active + + validates_presence_of :email + validates_presence_of :url +end + # == Schema Information # # Table name: user_open_ids @@ -15,10 +23,3 @@ # index_user_open_ids_on_url (url) # -class UserOpenId < ActiveRecord::Base - belongs_to :user - attr_accessible :email, :url, :user_id, :active - - validates_presence_of :email - validates_presence_of :url -end diff --git a/app/models/user_search_data.rb b/app/models/user_search_data.rb index d60054b9add..509d03cb91f 100644 --- a/app/models/user_search_data.rb +++ b/app/models/user_search_data.rb @@ -1,3 +1,8 @@ +class UserSearchData < ActiveRecord::Base + belongs_to :user + validates_presence_of :search_data +end + # == Schema Information # # Table name: user_search_data @@ -10,7 +15,3 @@ # idx_search_user (search_data) # -class UserSearchData < ActiveRecord::Base - belongs_to :user - validates_presence_of :search_data -end diff --git a/app/models/user_visit.rb b/app/models/user_visit.rb index 5409c405e40..6362c2092aa 100644 --- a/app/models/user_visit.rb +++ b/app/models/user_visit.rb @@ -1,16 +1,3 @@ -# == Schema Information -# -# Table name: user_visits -# -# id :integer not null, primary key -# user_id :integer not null -# visited_at :date not null -# -# Indexes -# -# index_user_visits_on_user_id_and_visited_at (user_id,visited_at) UNIQUE -# - class UserVisit < ActiveRecord::Base attr_accessible :visited_at, :user_id @@ -32,3 +19,17 @@ class UserVisit < ActiveRecord::Base SQL end end + +# == Schema Information +# +# Table name: user_visits +# +# id :integer not null, primary key +# user_id :integer not null +# visited_at :date not null +# +# Indexes +# +# index_user_visits_on_user_id_and_visited_at (user_id,visited_at) UNIQUE +# + diff --git a/app/models/view.rb b/app/models/view.rb index e1733df35c7..d7e29c2f23f 100644 --- a/app/models/view.rb +++ b/app/models/view.rb @@ -1,18 +1,3 @@ -# == Schema Information -# -# Table name: views -# -# parent_id :integer not null -# parent_type :string(50) not null -# ip :integer not null -# viewed_at :date not null -# user_id :integer -# -# Indexes -# -# index_views_on_parent_id_and_parent_type (parent_id,parent_type) -# - require 'ipaddr' class View < ActiveRecord::Base @@ -45,3 +30,19 @@ class View < ActiveRecord::Base end end end + +# == Schema Information +# +# Table name: views +# +# parent_id :integer not null +# parent_type :string(50) not null +# ip :integer not null +# viewed_at :date not null +# user_id :integer +# +# Indexes +# +# index_views_on_parent_id_and_parent_type (parent_id,parent_type) +# + diff --git a/lib/tasks/auto_annotate_models.rake b/lib/tasks/auto_annotate_models.rake index 2aeb47c64f7..52c51c42615 100644 --- a/lib/tasks/auto_annotate_models.rake +++ b/lib/tasks/auto_annotate_models.rake @@ -7,7 +7,7 @@ if(Rails.env.development?) # same name. Annotate.set_defaults({ 'position_in_routes' => "before", - 'position_in_class' => "before", + 'position_in_class' => "after", 'position_in_test' => "before", 'position_in_fixture' => "before", 'position_in_factory' => "before", diff --git a/spec/fabricators/email_log_fabricator.rb b/spec/fabricators/email_log_fabricator.rb index 58ae914cff1..8ee9c11db80 100644 --- a/spec/fabricators/email_log_fabricator.rb +++ b/spec/fabricators/email_log_fabricator.rb @@ -2,4 +2,4 @@ Fabricator(:email_log,) do user to_address { sequence(:address) { |i| "blah#{i}@example.com" } } email_type :invite -end \ No newline at end of file +end diff --git a/spec/fabricators/invite_fabricator.rb b/spec/fabricators/invite_fabricator.rb index 6f18a20fc2a..ecb9133f45c 100644 --- a/spec/fabricators/invite_fabricator.rb +++ b/spec/fabricators/invite_fabricator.rb @@ -1,4 +1,4 @@ Fabricator(:invite) do invited_by(fabricator: :user) email 'iceking@ADVENTURETIME.ooo' -end \ No newline at end of file +end diff --git a/spec/fabricators/site_content_fabricator.rb b/spec/fabricators/site_content_fabricator.rb index 0eb26630f3c..c4fb3d0cf49 100644 --- a/spec/fabricators/site_content_fabricator.rb +++ b/spec/fabricators/site_content_fabricator.rb @@ -11,4 +11,4 @@ end Fabricator(:site_content_site_setting, from: :site_content) do content_type 'site.replacement' content "%{title} is evil." -end \ No newline at end of file +end diff --git a/spec/models/user_open_id_spec.rb b/spec/models/user_open_id_spec.rb index fb6825930a4..43919009ec4 100644 --- a/spec/models/user_open_id_spec.rb +++ b/spec/models/user_open_id_spec.rb @@ -5,4 +5,4 @@ describe UserOpenId do it { should belong_to :user } it { should validate_presence_of :email } it { should validate_presence_of :url } -end \ No newline at end of file +end