Skip to content

Commit 95ecf20

Browse files
committed
use Rails' base_class
and remove base_ar_class, that does the same thing Change-Id: Id76a2dcc375cfea397ff4b4853f50d660b6b044c Reviewed-on: https://gerrit.instructure.com/41783 Tested-by: Jenkins <jenkins@instructure.com> Reviewed-by: Nick Cloward <ncloward@instructure.com> Product-Review: Cody Cutrer <cody@instructure.com> QA-Review: Cody Cutrer <cody@instructure.com>
1 parent 0f13948 commit 95ecf20

25 files changed

Lines changed: 35 additions & 49 deletions

app/controllers/application_controller.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,7 +266,7 @@ def named_context_url(context, name, *opts)
266266
if context.is_a?(UserProfile)
267267
name = name.to_s.sub(/context/, "profile")
268268
else
269-
klass = context.class.base_ar_class
269+
klass = context.class.base_class
270270
name = name.to_s.sub(/context/, klass.name.underscore)
271271
opts.unshift(context)
272272
end
@@ -1341,7 +1341,7 @@ def safe_domain_file_url(attachment, host_and_shard=nil, verifier = nil, downloa
13411341
opts[:inline] = 1
13421342
end
13431343

1344-
if @context && Attachment.relative_context?(@context.class.base_ar_class) && @context == attachment.context
1344+
if @context && Attachment.relative_context?(@context.class.base_class) && @context == attachment.context
13451345
# so yeah, this is right. :inline=>1 wants :download=>1 to go along with
13461346
# it, so we're setting :download=>1 *because* we want to display inline.
13471347
opts[:download] = 1 unless download

app/controllers/external_tools_controller.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ def show
318318
raise(ActiveRecord::RecordNotFound, "Couldn't find external tool with API id '#{params[:external_tool_id]}'")
319319
end
320320
else
321-
selection_type = params[:launch_type] || "#{@context.class.base_ar_class.to_s.downcase}_navigation"
321+
selection_type = params[:launch_type] || "#{@context.class.base_class.to_s.downcase}_navigation"
322322
if find_tool(params[:id], selection_type)
323323

324324
@return_url = external_content_success_url('external_tool_redirect')

app/helpers/application_helper.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ def full_url(path)
114114
end
115115

116116
def url_helper_context_from_object(context)
117-
(context ? context.class.base_ar_class : context.class).name.underscore
117+
(context ? context.class.base_class : context.class).name.underscore
118118
end
119119

120120
def message_user_path(user, context = nil)

app/messages/announcement_created_by_you.email.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% define_content :link do -%>
2-
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_ar_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/announcements/<%= asset.id %>
2+
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/announcements/<%= asset.id %>
33
<% end %>
44
<% define_content :subject do -%>
55
<%= before_label asset.title %> <%= asset.context.name %>
@@ -10,6 +10,6 @@ You created this Announcement:
1010
<%= html_to_text(asset.message, :base_url => "#{HostUrl.protocol}://#{HostUrl.context_host(asset.context)}") %>
1111

1212
<% if asset.attachment %><%= before_label :file_included, "File Included" %> <%= asset.attachment.display_name %> - <%= asset.attachment.readable_size %>
13-
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_ar_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/files/<%= asset.attachment_id %>/download<% end %>
13+
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/files/<%= asset.attachment_id %>/download<% end %>
1414

1515
<%= content :link %>

app/messages/announcement_created_by_you.email.html.erb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% define_content :link do %>
2-
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_ar_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/announcements/<%= asset.id %>
2+
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/announcements/<%= asset.id %>
33
<% end %>
44

55
<% define_content :subject do %>
@@ -21,7 +21,7 @@ You created this Announcement:
2121
<p style="margin: 0px;"><%= t :attached_file, "Attached File" %></p>
2222
<ul style="padding-left: 20px;">
2323
<li><%= asset.attachment.display_name %> - <%= asset.attachment.readable_size %>
24-
<a href="<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_ar_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/files/<%= asset.attachment_id %>/download">[<%= t :download, "download" %>]</a></li>
24+
<a href="<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/files/<%= asset.attachment_id %>/download">[<%= t :download, "download" %>]</a></li>
2525
</ul>
2626
</div>
2727
<% end %>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% define_content :link do %>
2-
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_ar_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/announcements/<%= asset.id %>
2+
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/announcements/<%= asset.id %>
33
<% end %>
44

55
<%= t :body, "You created this Announcement: %{title}, %{course}", :title => %{<b><a href="#{ content :link }">#{h asset.title}</a></b>}.html_safe, :course => asset.context.name %>

app/messages/announcement_created_by_you.summary.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% define_content :link do %>
2-
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_ar_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/announcements/<%= asset.id %>
2+
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/announcements/<%= asset.id %>
33
<% end %>
44

55
<% define_content :subject do %>
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
<% define_content :link do -%>
2-
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_ar_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/announcements/<%= asset.id %>
2+
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.context) %>/<%= asset.context.class.base_class.to_s.downcase.pluralize %>/<%= asset.context_id %>/announcements/<%= asset.id %>
33
<% end -%>
44
<%= t :body, "Canvas Alert - You created this Announcement: %{title}, %{course}.", :title => asset.title, :course => asset.context.name %>

app/messages/collaboration_invitation.email.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% define_content :link do %>
2-
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.collaboration.context) %>/<%= asset.collaboration.context.class.base_ar_class.to_s.downcase.pluralize %>/<%= asset.collaboration.context_id %>/collaborations/<%= asset.collaboration.id %>
2+
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.collaboration.context) %>/<%= asset.collaboration.context.class.base_class.to_s.downcase.pluralize %>/<%= asset.collaboration.context_id %>/collaborations/<%= asset.collaboration.id %>
33
<% end %>
44

55
<% define_content :subject do %>

app/messages/collaboration_invitation.email.html.erb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<% define_content :link do %>
2-
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.collaboration.context) %>/<%= asset.collaboration.context.class.base_ar_class.to_s.downcase.pluralize %>/<%= asset.collaboration.context_id %>/collaborations/<%= asset.collaboration.id %>
2+
<%= HostUrl.protocol %>://<%= HostUrl.context_host(asset.collaboration.context) %>/<%= asset.collaboration.context.class.base_class.to_s.downcase.pluralize %>/<%= asset.collaboration.context_id %>/collaborations/<%= asset.collaboration.id %>
33
<% end %>
44

55
<% define_content :subject do %>

0 commit comments

Comments
 (0)