models: drop various unused #named methods.
This commit is contained in:
@@ -86,7 +86,6 @@ class WikiPagesController < ApplicationController
|
|||||||
redirect_to wiki_page_path(@wiki_page)
|
redirect_to wiki_page_path(@wiki_page)
|
||||||
else
|
else
|
||||||
@wiki_page = WikiPage.new(:title => params[:title])
|
@wiki_page = WikiPage.new(:title => params[:title])
|
||||||
@artist = Artist.named(@wiki_page.title).active.first
|
|
||||||
respond_with(@wiki_page)
|
respond_with(@wiki_page)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ protected
|
|||||||
end
|
end
|
||||||
|
|
||||||
def related_tags
|
def related_tags
|
||||||
tag = Tag.named(query.strip).first
|
tag = Tag.find_by_name(query.strip)
|
||||||
|
|
||||||
if tag
|
if tag
|
||||||
tag.related_tag_array.map(&:first)
|
tag.related_tag_array.map(&:first)
|
||||||
|
|||||||
@@ -464,10 +464,6 @@ class Artist < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
module SearchMethods
|
module SearchMethods
|
||||||
def named(name)
|
|
||||||
where(name: normalize_name(name))
|
|
||||||
end
|
|
||||||
|
|
||||||
def any_other_name_matches(regex)
|
def any_other_name_matches(regex)
|
||||||
where(id: Artist.from("unnest(other_names) AS other_name").where("other_name ~ ?", regex))
|
where(id: Artist.from("unnest(other_names) AS other_name").where("other_name ~ ?", regex))
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -930,10 +930,6 @@ class Tag < ApplicationRecord
|
|||||||
where("tags.name LIKE ? ESCAPE E'\\\\'", normalize_name(name).to_escaped_for_sql_like)
|
where("tags.name LIKE ? ESCAPE E'\\\\'", normalize_name(name).to_escaped_for_sql_like)
|
||||||
end
|
end
|
||||||
|
|
||||||
def named(name)
|
|
||||||
where("tags.name = ?", TagAlias.to_aliased([name]).join(""))
|
|
||||||
end
|
|
||||||
|
|
||||||
def search(params)
|
def search(params)
|
||||||
q = super
|
q = super
|
||||||
|
|
||||||
|
|||||||
@@ -742,10 +742,6 @@ class User < ApplicationRecord
|
|||||||
end
|
end
|
||||||
|
|
||||||
module SearchMethods
|
module SearchMethods
|
||||||
def named(name)
|
|
||||||
where("lower(name) = ?", name)
|
|
||||||
end
|
|
||||||
|
|
||||||
def admins
|
def admins
|
||||||
where("level = ?", Levels::ADMIN)
|
where("level = ?", Levels::ADMIN)
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -10,8 +10,8 @@
|
|||||||
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(:wiki_page => {:title => params[:title]}) %>.</p>
|
<p>This wiki page does not exist. <%= link_to "Create new wiki page", new_wiki_page_path(:wiki_page => {:title => params[:title]}) %>.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if @artist %>
|
<% if @wiki_page.artist.present? %>
|
||||||
<p><%= link_to "View artist", @artist %></p>
|
<p><%= link_to "View artist", @wiki_page.artist %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
|
<%= wiki_page_alias_and_implication_list(@wiki_page)%>
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ class RelatedTagQueryTest < ActiveSupport::TestCase
|
|||||||
|
|
||||||
context "for a tag that already exists" do
|
context "for a tag that already exists" do
|
||||||
setup do
|
setup do
|
||||||
Tag.named("aaa").first.update_related
|
Tag.find_by_name("aaa").update_related
|
||||||
@query = RelatedTagQuery.new(query: "aaa")
|
@query = RelatedTagQuery.new(query: "aaa")
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -60,7 +60,7 @@ class RelatedTagQueryTest < ActiveSupport::TestCase
|
|||||||
@wp = FactoryBot.create(:wiki_page, title: "aaa", body: "blah [[foo|blah]] [[FOO]] [[bar]] blah")
|
@wp = FactoryBot.create(:wiki_page, title: "aaa", body: "blah [[foo|blah]] [[FOO]] [[bar]] blah")
|
||||||
@query = RelatedTagQuery.new(query: "xyz")
|
@query = RelatedTagQuery.new(query: "xyz")
|
||||||
|
|
||||||
Tag.named("aaa").first.update_related
|
Tag.find_by_name("aaa").update_related
|
||||||
end
|
end
|
||||||
|
|
||||||
should "take wiki tags from the consequent's wiki" do
|
should "take wiki tags from the consequent's wiki" do
|
||||||
|
|||||||
Reference in New Issue
Block a user