Merge pull request #1968 from stephankaag/drop_rails3

Drop Rails3 support
This commit is contained in:
Sam
2014-02-18 10:50:36 +11:00
27 changed files with 185 additions and 1522 deletions
+5 -12
View File
@@ -5,17 +5,10 @@ class Category < ActiveRecord::Base
include Concern::Positionable
belongs_to :topic, dependent: :destroy
if rails4?
belongs_to :topic_only_relative_url,
-> { select "id, title, slug" },
class_name: "Topic",
foreign_key: "topic_id"
else
belongs_to :topic_only_relative_url,
select: "id, title, slug",
class_name: "Topic",
foreign_key: "topic_id"
end
belongs_to :topic_only_relative_url,
-> { select "id, title, slug" },
class_name: "Topic",
foreign_key: "topic_id"
belongs_to :user
belongs_to :latest_post, class_name: "Post"
@@ -81,7 +74,7 @@ class Category < ActiveRecord::Base
def self.scoped_to_permissions(guardian, permission_types)
if guardian && guardian.is_staff?
rails4? ? all : scoped
all
else
permission_types = permission_types.map{ |permission_type|
CategoryGroup.permission_types[permission_type]
+1 -13
View File
@@ -1,17 +1,5 @@
class DiscourseVersionCheck
if rails4?
include ActiveModel::Model
else
include ActiveAttr::Attributes
include ActiveAttr::MassAssignment
include ActiveModel::Serialization
end
include ActiveModel::Model
attr_accessor :latest_version, :critical_updates, :installed_version, :installed_sha, :missing_versions_count, :updated_at, :version_check_pending
unless rails4?
def active_model_serializer
DiscourseVersionCheckSerializer
end
end
end
-1
View File
@@ -90,7 +90,6 @@ class IncomingLinksReport
num_clicks = num_clicks.to_a.sort_by {|x| x[1]}.last(10).reverse # take the top 10
report.data = []
topics = Topic.select('id, slug, title').where('id in (?)', num_clicks.map {|z| z[0]})
topics = topics.all unless rails4?
num_clicks.each do |topic_id, num_clicks_element|
topic = topics.find {|t| t.id == topic_id}
if topic
+1 -1
View File
@@ -103,7 +103,7 @@ class Invite < ActiveRecord::Base
filter: "%#{email_or_username.downcase}%"
)
else
rails4? ? all : scoped
all
end
end
-4
View File
@@ -69,10 +69,6 @@ class Topic < ActiveRecord::Base
self.title = TextCleaner.clean_title(TextSentinel.title_sentinel(title).text) if errors[:title].empty?
end
unless rails4?
serialize :meta_data, ActiveRecord::Coders::Hstore
end
belongs_to :category
has_many :posts
has_many :topic_allowed_users
-1
View File
@@ -11,7 +11,6 @@ class TopicFeaturedUsers
# Chooses which topic users to feature
def choose(args={})
topic.reload unless rails4?
clear
update keys(args)
update_participant_count
+1 -5
View File
@@ -60,11 +60,7 @@ class UserEmailObserver < ActiveRecord::Observer
end
def after_commit(notification)
transaction_includes_action = if rails4?
notification.send(:transaction_include_any_action?, [:create])
else
notification.send(:transaction_include_action?, :create)
end
transaction_includes_action = notification.send(:transaction_include_any_action?, [:create])
delegate_to_email_user notification if transaction_includes_action
end