Fix Rails 4.1 migration issues

This commit is contained in:
r888888888
2014-04-24 16:15:59 -07:00
parent 616aef4394
commit a89c57cee0
7 changed files with 22 additions and 9 deletions

View File

@@ -69,6 +69,9 @@ protected
fmt.json do
render :json => {:success => false, :reason => "access denied"}.to_json, :status => 403
end
fmt.js do
render :nothing => true, :status => 403
end
end
end
@@ -106,10 +109,15 @@ protected
def normalize_search
if request.get?
params[:search] ||= {}
changed = params[:search].reject! {|k,v| v.blank?}
unless changed.nil?
redirect_to params
if params[:search].blank?
params[:search] = {}
end
if params[:search].is_a?(Hash)
changed = params[:search].reject! {|k,v| v.blank?}
unless changed.nil?
redirect_to params
end
end
end
end

View File

@@ -431,4 +431,8 @@ class Artist < ActiveRecord::Base
def deletable_by?(user)
user.is_builder?
end
def visible?
!is_banned? || CurrentUser.user.is_janitor?
end
end

View File

@@ -5,7 +5,7 @@ class ArtistCommentaryVersion < ActiveRecord::Base
attr_accessible :post_id, :original_title, :original_description, :translated_title, :translated_description
def self.search(params)
q = scoped
q = where("true")
params = {} if params.blank?
if params[:updater_id]

View File

@@ -4,7 +4,7 @@ class ModAction < ActiveRecord::Base
attr_accessible :description
def self.search(params = {})
q = scoped
q = where("true")
return q if params.blank?
if params[:creator_id].present?

View File

@@ -31,7 +31,7 @@ module PostSetPresenters
end
def pattern_tags
Tag.name_matches(post_set.tag_string).all(:select => "name", :limit => Danbooru.config.tag_query_limit, :order => "post_count DESC").map(&:name)
Tag.name_matches(post_set.tag_string).select("name").limit(Danbooru.config.tag_query_limit).order("post_count DESC").map(&:name)
end
def related_tags_for_group

View File

@@ -75,7 +75,7 @@ class UserPresenter
def favorites
@favorites ||= begin
arel = user.favorites.limit(6).includes(:post).reorder("favorites.id desc")
arel = user.favorites.limit(6).joins(:post).reorder("favorites.id desc")
if CurrentUser.user.hide_deleted_posts?
arel = arel.where("posts.is_deleted = false")

View File

@@ -6726,4 +6726,5 @@ INSERT INTO schema_migrations (version) VALUES ('20140111191413');
INSERT INTO schema_migrations (version) VALUES ('20140204233337');
INSERT INTO schema_migrations (version) VALUES ('20140221213349');
INSERT INTO schema_migrations (version) VALUES ('20140221213349');