use _path for most things instead of _url

Instead of hard-coding the scheme and host everywhere, use _path
methods to show relative URLs.

Except that our previous setting of
Rails.application.routes.default_url_options in
config.after_initialize made this moot because Rails inserts that
host into all _path helpers for some reason.  So revert that
setting.

But then anything that wants an absolute URL doesn't know the
hostname and the root_url helper throws an exception.  So make a
Rails.application.root_url shortcut to pass the per-app settings in
Rails.application to root_url.

Now we can just use _path helpers most places but still use _url
ones where we need them, such as in RSS views and e-mail templates.
This commit is contained in:
joshua stein 2015-01-02 17:02:55 -06:00
parent ad272a8f11
commit 9f5e04bbba
25 changed files with 79 additions and 54 deletions

View file

@ -16,8 +16,4 @@ module ApplicationHelper
label_tag(nil, time_ago_in_words(*args), label_tag(nil, time_ago_in_words(*args),
:title => args.first.strftime("%F %T %z")) :title => args.first.strftime("%F %T %z"))
end end
def main_root_url
Rails.application.routes.url_helpers.root_url
end
end end

View file

@ -325,6 +325,10 @@ class Comment < ActiveRecord::Base
"comment.#{short_id}.#{created_at.to_i}@#{Rails.application.domain}" "comment.#{short_id}.#{created_at.to_i}@#{Rails.application.domain}"
end end
def path
self.story.comments_path + "/comments/#{self.short_id}#c_#{self.short_id}"
end
def plaintext_comment def plaintext_comment
# TODO: linkify then strip tags and convert entities back # TODO: linkify then strip tags and convert entities back
comment comment
@ -341,6 +345,10 @@ class Comment < ActiveRecord::Base
self.upvotes - self.downvotes self.upvotes - self.downvotes
end end
def short_id_path
self.story.short_id_path + "/_/comments/#{self.short_id}#c_#{self.short_id}"
end
def short_id_url def short_id_url
self.story.short_id_url + "/_/comments/#{self.short_id}#c_#{self.short_id}" self.story.short_id_url + "/_/comments/#{self.short_id}#c_#{self.short_id}"
end end

View file

@ -75,6 +75,6 @@ class Message < ActiveRecord::Base
end end
def url def url
Rails.application.routes.url_helpers.root_url + "messages/#{self.short_id}" Rails.application.root_url + "messages/#{self.short_id}"
end end
end end

View file

@ -190,6 +190,10 @@ class Story < ActiveRecord::Base
end end
end end
def comments_path
"#{short_id_path}/#{self.title_as_url}"
end
def comments_url def comments_url
"#{short_id_url}/#{self.title_as_url}" "#{short_id_url}/#{self.title_as_url}"
end end
@ -370,8 +374,12 @@ class Story < ActiveRecord::Base
self.user_id, nil, false) self.user_id, nil, false)
end end
def short_id_path
Rails.application.routes.url_helpers.root_path + "s/#{self.short_id}"
end
def short_id_url def short_id_url
Rails.application.routes.url_helpers.root_url + "s/#{self.short_id}" Rails.application.root_url + "s/#{self.short_id}"
end end
def score def score
@ -472,6 +480,10 @@ class Story < ActiveRecord::Base
end end
end end
def url_or_comments_path
self.url.blank? ? self.comments_path : self.url
end
def url_or_comments_url def url_or_comments_url
self.url.blank? ? self.comments_url : self.url self.url.blank? ? self.comments_url : self.url
end end

View file

@ -12,7 +12,7 @@ class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ?
<% if @user %> <% if @user %>
<a class="upvoter"></a> <a class="upvoter"></a>
<% else %> <% else %>
<%= link_to "", login_url, :class => "upvoter" %> <%= link_to "", login_path, :class => "upvoter" %>
<% end %> <% end %>
<div class="score"><%= comment.score %></div> <div class="score"><%= comment.score %></div>
<% if @user && @user.can_downvote?(comment) %> <% if @user && @user.can_downvote?(comment) %>
@ -90,7 +90,8 @@ class="comment <%= comment.current_vote ? (comment.current_vote[:vote] == 1 ?
<% if defined?(show_story) && show_story %> <% if defined?(show_story) && show_story %>
| on: | on:
<a href="<%= comment.story.comments_url %>"><%= comment.story.title %></a> <a href="<%= comment.story.comments_path %>"><%= comment.story.title
%></a>
<% end %> <% end %>
</div> </div>
<div class="comment_text"> <div class="comment_text">

View file

@ -5,7 +5,7 @@
<title><%= Rails.application.name %><%= @title.present? ? <title><%= Rails.application.name %><%= @title.present? ?
": " + h(@title) : "" %></title> ": " + h(@title) : "" %></title>
<description><%= @title %></description> <description><%= @title %></description>
<link><%= root_url %>comments</link> <link><%= Rails.application.root_url %>comments</link>
<% @comments.each do |comment| %> <% @comments.each do |comment| %>
<item> <item>

View file

@ -5,7 +5,7 @@
<title><%= Rails.application.name %><%= @title.present? ? <title><%= Rails.application.name %><%= @title.present? ?
": " + h(@title) : "" %></title> ": " + h(@title) : "" %></title>
<description><%= @title %></description> <description><%= @title %></description>
<link><%= root_url + (@newest ? "newest" : "") %></link> <link><%= Rails.application.root_url + (@newest ? "newest" : "") %></link>
<% @stories.each do |story| %> <% @stories.each do |story| %>
<item> <item>

View file

@ -1,7 +1,7 @@
Hello <%= @invitation.email %>, Hello <%= @invitation.email %>,
The user <%= @invitation.user.username %> has invited you to <%= Rails.application.name %> (<%= root_url %>)<%= @invitation.memo.present? ? raw("\n\n #{@invitation.memo}") : "" %> The user <%= @invitation.user.username %> has invited you to <%= Rails.application.name %> (<%= Rails.application.root_url %>)<%= @invitation.memo.present? ? raw("\n\n #{@invitation.memo}") : "" %>
To accept this invitation and create an account, visit the URL below: To accept this invitation and create an account, visit the URL below:
<%= root_url %>invitations/<%= @invitation.code %> <%= Rails.application.root_url %>invitations/<%= @invitation.code %>

View file

@ -10,6 +10,6 @@ Someone at <%= @invitation_request.ip_address %> has submitted an invitation req
If this is you, visit the URL below to confirm your request and If this is you, visit the URL below to confirm your request and
display it to other logged-in users. display it to other logged-in users.
<%= root_url %>invitations/confirm/<%= @invitation_request.code %> <%= Rails.application.root_url %>invitations/confirm/<%= @invitation_request.code %>
If this is not you, you can delete this message. If this is not you, you can delete this message.

View file

@ -17,7 +17,7 @@
</p> </p>
<%= form_for @invitation_request, <%= form_for @invitation_request,
:url => create_invitation_by_request_url do |f| %> :url => create_invitation_by_request_path do |f| %>
<p> <p>
<%= f.label :name, "Name:" %> <%= f.label :name, "Name:" %>
<%= f.text_field :name, :size => 30 %> <%= f.text_field :name, :size => 30 %>

View file

@ -29,13 +29,13 @@
<em><%= ir.email %></em> <em><%= ir.email %></em>
<% end %></td> <% end %></td>
<td><%= raw ir.markeddown_memo %></td> <td><%= raw ir.markeddown_memo %></td>
<td><%= form_tag send_invitation_for_request_url do %> <td><%= form_tag send_invitation_for_request_path do %>
<%= hidden_field_tag "code", ir.code %> <%= hidden_field_tag "code", ir.code %>
<%= submit_tag "Send Invitation", :data => { :confirm => "Are " << <%= submit_tag "Send Invitation", :data => { :confirm => "Are " <<
"you sure you want to invite this person and remove this request?" } %> "you sure you want to invite this person and remove this request?" } %>
<% end %></td> <% end %></td>
<% if @user.is_moderator? %> <% if @user.is_moderator? %>
<td><%= form_tag delete_invitation_request_url do %> <td><%= form_tag delete_invitation_request_path do %>
<%= hidden_field_tag "code", ir.code %> <%= hidden_field_tag "code", ir.code %>
<%= submit_tag "Delete", :data => { :confirm => "Are you sure " << <%= submit_tag "Delete", :data => { :confirm => "Are you sure " <<
"you want to delete this request?" } %> "you want to delete this request?" } %>

View file

@ -8,7 +8,7 @@
below and instructions will be e-mailed to you. below and instructions will be e-mailed to you.
</p> </p>
<%= form_tag reset_password_url do %> <%= form_tag reset_password_path do %>
<%= label_tag :email, "E-mail or Username:" %> <%= label_tag :email, "E-mail or Username:" %>
<%= text_field_tag :email, "", :size => 30 %> <%= text_field_tag :email, "", :size => 30 %>
<br /> <br />

View file

@ -3,7 +3,7 @@
Login Login
</div> </div>
<%= form_tag login_url do %> <%= form_tag login_path do %>
<p> <p>
<%= label_tag :email, "E-mail or Username:" %> <%= label_tag :email, "E-mail or Username:" %>
<%= text_field_tag :email, "", :size => 30, :autofocus => "autofocus" %> <%= text_field_tag :email, "", :size => 30, :autofocus => "autofocus" %>
@ -20,7 +20,7 @@
<p> <p>
Forgot your password? <%= link_to "Reset your password", Forgot your password? <%= link_to "Reset your password",
forgot_password_url %>. forgot_password_path %>.
</p> </p>
<p> <p>

View file

@ -3,7 +3,7 @@
Set New Password Set New Password
</div> </div>
<%= form_tag set_new_password_url, { :autocomplete => "off" } do %> <%= form_tag set_new_password_path, { :autocomplete => "off" } do %>
<%= error_messages_for(@reset_user) %> <%= error_messages_for(@reset_user) %>
<%= hidden_field_tag "token", params[:token] %> <%= hidden_field_tag "token", params[:token] %>

View file

@ -23,7 +23,7 @@
</div> </div>
<% if @messages.any? %> <% if @messages.any? %>
<%= form_tag batch_delete_messages_url do %> <%= form_tag batch_delete_messages_path do %>
<table class="data zebra" width="100%" cellspacing=0> <table class="data zebra" width="100%" cellspacing=0>
<tr> <tr>
<th width="3%"><%= check_box_tag "delete_all", <th width="3%"><%= check_box_tag "delete_all",

View file

@ -33,13 +33,13 @@
<div class="boxline"> <div class="boxline">
<div style="float: left;"> <div style="float: left;">
<%= form_tag message_url(@message.short_id), :method => :delete do %> <%= form_tag message_path(@message.short_id), :method => :delete do %>
<%= submit_tag "Delete Message" %> <%= submit_tag "Delete Message" %>
<% end %> <% end %>
</div> </div>
<div style="float: left; padding-left: 1em;"> <div style="float: left; padding-left: 1em;">
<%= form_tag message_url(@message.short_id) + "/keep_as_new", <%= form_tag message_path(@message.short_id) + "/keep_as_new",
:method => :post do %> :method => :post do %>
<%= submit_tag "Keep As New" %> <%= submit_tag "Keep As New" %>
<% end %> <% end %>

View file

@ -16,7 +16,7 @@
<td><a href="/messages?to=<%= mod.moderator.try(:username) %>"><%= <td><a href="/messages?to=<%= mod.moderator.try(:username) %>"><%=
mod.moderator.try(:username) %></a></td> mod.moderator.try(:username) %></a></td>
<td><% if mod.story %> <td><% if mod.story %>
<a href="<%= mod.story.comments_url %>">Story: <%= mod.story.title <a href="<%= mod.story.comments_path %>">Story: <%= mod.story.title
%></a> %></a>
<% elsif mod.comment %> <% elsif mod.comment %>
<a href="<%= mod.comment.url %>">Comment on <%= <a href="<%= mod.comment.url %>">Comment on <%=

View file

@ -4,4 +4,4 @@ Someone at <%= @ip %> requested to reset your account password
on <%= Rails.application.name %>. If you submitted this request, visit the link below to on <%= Rails.application.name %>. If you submitted this request, visit the link below to
set a new password. If not, you can disregard this e-mail. set a new password. If not, you can disregard this e-mail.
<%= root_url %>login/set_new_password?token=<%= @user.password_reset_token %> <%= Rails.application.root_url %>login/set_new_password?token=<%= @user.password_reset_token %>

View file

@ -6,7 +6,7 @@
Account Settings Account Settings
</div> </div>
<%= form_for @edit_user, :url => settings_url, :method => :post, <%= form_for @edit_user, :url => settings_path, :method => :post,
:html => { :id => "edit_user" } do |f| %> :html => { :id => "edit_user" } do |f| %>
<%= error_messages_for f.object %> <%= error_messages_for f.object %>
@ -179,7 +179,7 @@
<br> <br>
<br> <br>
<%= form_for @edit_user, :url => delete_account_url, :method => :post, <%= form_for @edit_user, :url => delete_account_path, :method => :post,
:html => { :id => "delete_user" } do |f| %> :html => { :id => "delete_user" } do |f| %>
<div class="legend"> <div class="legend">
Delete Account Delete Account

View file

@ -3,7 +3,7 @@
Create an Account Create an Account
</div> </div>
<%= form_for @new_user, { :url => signup_url, <%= form_for @new_user, { :url => signup_path,
:autocomplete => "off" } do |f| %> :autocomplete => "off" } do |f| %>
<%= hidden_field_tag "invitation_code", @invitation.code %> <%= hidden_field_tag "invitation_code", @invitation.code %>

View file

@ -3,7 +3,7 @@
<h2>Error: This story was already submitted <%= <h2>Error: This story was already submitted <%=
time_ago_in_words(f.object.already_posted_story.created_at) %> ago</h2> time_ago_in_words(f.object.already_posted_story.created_at) %> ago</h2>
<p> <p>
Please view the <a href="<%= f.object.already_posted_story.comments_url %>" Please view the <a href="<%= f.object.already_posted_story.comments_path %>"
target="_blank">previous discussion</a> for this story. target="_blank">previous discussion</a> for this story.
</p> </p>
</div> </div>
@ -15,7 +15,7 @@
time_ago_in_words(f.object.already_posted_story.created_at) %> ago, but may time_ago_in_words(f.object.already_posted_story.created_at) %> ago, but may
be submitted again.</h2> be submitted again.</h2>
<p> <p>
Please view the <a href="<%= f.object.already_posted_story.comments_url %>" Please view the <a href="<%= f.object.already_posted_story.comments_path %>"
target="_blank">previous discussion</a> for this story first. If the content target="_blank">previous discussion</a> for this story first. If the content
has changed or warrants new discussion, you may submit it again. has changed or warrants new discussion, you may submit it again.
</p> </p>
@ -71,7 +71,7 @@
<div id="story_guidelines" style="<%= show_guidelines?? "" : <div id="story_guidelines" style="<%= show_guidelines?? "" :
"display: none;" %>"> "display: none;" %>">
<div style="float: right;"> <div style="float: right;">
<a href="javascript:window.location=%22<%= root_url %>stories/new?url=%22+encodeURIComponent(document.location)+%22&title=%22+encodeURIComponent(document.title)" <a href="javascript:window.location=%22<%= Rails.application.root_url %>stories/new?url=%22+encodeURIComponent(document.location)+%22&title=%22+encodeURIComponent(document.title)"
style="border: 1px solid #ddd; padding: 0.5em; background-color: style="border: 1px solid #ddd; padding: 0.5em; background-color:
#f8f8f8; line-height: 1.5em; margin-left: 1em;">Submit to #f8f8f8; line-height: 1.5em; margin-left: 1em;">Submit to
<%= Rails.application.name %></a> <%= Rails.application.name %></a>

View file

@ -7,14 +7,14 @@ class="story <%= story.vote == 1 ? "upvoted" : "" %> <%= story.vote == -1 ?
<% if @user %> <% if @user %>
<a class="upvoter"></a> <a class="upvoter"></a>
<% else %> <% else %>
<%= link_to "", login_url, :class => "upvoter" %> <%= link_to "", login_path, :class => "upvoter" %>
<% end %> <% end %>
<div class="score"><%= story.score %></div> <div class="score"><%= story.score %></div>
</div> </div>
<div class="details"> <div class="details">
<span class="link"> <span class="link">
<% if story.can_be_seen_by_user?(@user) %> <% if story.can_be_seen_by_user?(@user) %>
<a href="<%= story.url_or_comments_url %>"><%= story.title %></a> <a href="<%= story.url_or_comments_path %>"><%= story.title %></a>
<% end %> <% end %>
<% if story.is_gone? %> <% if story.is_gone? %>
[Story removed by <%= story.is_moderated? ? "moderator" : [Story removed by <%= story.is_moderated? ? "moderator" :
@ -25,7 +25,7 @@ class="story <%= story.vote == 1 ? "upvoted" : "" %> <%= story.vote == -1 ?
<span class="tags"> <span class="tags">
<% story.taggings.sort_by{|t| t.tag.tag }.sort_by{|t| <% story.taggings.sort_by{|t| t.tag.tag }.sort_by{|t|
t.tag.is_media?? -1 : 0 }.each do |tagging| %> t.tag.is_media?? -1 : 0 }.each do |tagging| %>
<a href="<%= tag_url(tagging.tag.tag) %>" <a href="<%= tag_path(tagging.tag.tag) %>"
class="<%= tagging.tag.css_class %>" class="<%= tagging.tag.css_class %>"
title="<%= tagging.tag.description %>"><%= tagging.tag.tag %></a> title="<%= tagging.tag.description %>"><%= tagging.tag.tag %></a>
<% end %> <% end %>
@ -37,12 +37,12 @@ class="story <%= story.vote == 1 ? "upvoted" : "" %> <%= story.vote == -1 ?
<br> <br>
<span class="merge"></span> <span class="merge"></span>
<span class="link"> <span class="link">
<a href="<%= ms.url_or_comments_url %>"><%= ms.title %></a> <a href="<%= ms.url_or_comments_path %>"><%= ms.title %></a>
</span> </span>
<span class="tags"> <span class="tags">
<% ms.taggings.sort_by{|t| t.tag.tag }.sort_by{|t| <% ms.taggings.sort_by{|t| t.tag.tag }.sort_by{|t|
t.tag.tag == "pdf" ? -1 : 0 }.each do |tagging| %> t.tag.tag == "pdf" ? -1 : 0 }.each do |tagging| %>
<a href="<%= tag_url(tagging.tag.tag) %>" <a href="<%= tag_path(tagging.tag.tag) %>"
class="<%= tagging.tag.css_class %>" class="<%= tagging.tag.css_class %>"
title="<%= tagging.tag.description %>"><%= tagging.tag.tag %></a> title="<%= tagging.tag.description %>"><%= tagging.tag.tag %></a>
<% end %> <% end %>
@ -75,21 +75,21 @@ class="story <%= story.vote == 1 ? "upvoted" : "" %> <%= story.vote == -1 ?
<% if story.is_editable_by_user?(@user) %> <% if story.is_editable_by_user?(@user) %>
| |
<a href="<%= edit_story_url(story.short_id) %>">edit</a> <a href="<%= edit_story_path(story.short_id) %>">edit</a>
<% if story.is_gone? && story.is_undeletable_by_user?(@user) %> <% if story.is_gone? && story.is_undeletable_by_user?(@user) %>
| |
<%= link_to "undelete", story_undelete_url(story.short_id), <%= link_to "undelete", story_undelete_path(story.short_id),
:method => :post, :data => { :method => :post, :data => {
:confirm => "Are you sure you want to undelete this story?" } %> :confirm => "Are you sure you want to undelete this story?" } %>
<% elsif !story.is_gone? %> <% elsif !story.is_gone? %>
| |
<% if story.user_id != @user.try(:id) && <% if story.user_id != @user.try(:id) &&
@user.try(:is_moderator?) %> @user.try(:is_moderator?) %>
<%= link_to "delete", story_url(story.short_id), <%= link_to "delete", story_path(story.short_id),
:method => :delete, :class => "mod_story_link" %> :method => :delete, :class => "mod_story_link" %>
<% else %> <% else %>
<%= link_to "delete", story_url(story.short_id), <%= link_to "delete", story_path(story.short_id),
:method => :delete, :data => { :method => :delete, :data => {
:confirm => "Are you sure you want to delete this story?" } %> :confirm => "Are you sure you want to delete this story?" } %>
<% end %> <% end %>
@ -100,10 +100,10 @@ class="story <%= story.vote == 1 ? "upvoted" : "" %> <%= story.vote == -1 ?
| <a class="flagger">flag</a> | <a class="flagger">flag</a>
<% end %> <% end %>
<% if story.vote == 0 %> <% if story.vote == 0 %>
| <%= link_to "unhide", story_unhide_url(story.short_id), | <%= link_to "unhide", story_unhide_path(story.short_id),
:class => "hider" %> :class => "hider" %>
<% else %> <% else %>
| <%= link_to "hide", story_hide_url(story.short_id), | <%= link_to "hide", story_hide_path(story.short_id),
:class => "hider" %> :class => "hider" %>
<% end %> <% end %>
<% if defined?(single_story) && single_story && story.hider_count > 0 %> <% if defined?(single_story) && single_story && story.hider_count > 0 %>
@ -113,7 +113,7 @@ class="story <%= story.vote == 1 ? "upvoted" : "" %> <%= story.vote == -1 ?
<% if !story.is_gone? && (@user || story.comments_count > 0) %> <% if !story.is_gone? && (@user || story.comments_count > 0) %>
<span class="comments_label"> <span class="comments_label">
| |
<a href="<%= story.comments_url %>"><%= story.comments_count == 0 ? <a href="<%= story.comments_path %>"><%= story.comments_count == 0 ?
"discuss" : "#{story.comments_count} comment" << "discuss" : "#{story.comments_count} comment" <<
(story.comments_count == 1 ? "" : "s") %></a> (story.comments_count == 1 ? "" : "s") %></a>
</span> </span>
@ -130,6 +130,6 @@ class="story <%= story.vote == 1 ? "upvoted" : "" %> <%= story.vote == -1 ?
</div> </div>
<div class="mobile_comments <%= story.comments_count == 0 ? "zero" : "" %>" <div class="mobile_comments <%= story.comments_count == 0 ? "zero" : "" %>"
style="display: none;"> style="display: none;">
<a href="<%= story.comments_url %>"><%= story.comments_count %></a> <a href="<%= story.comments_path %>"><%= story.comments_count %></a>
</div> </div>
</li> </li>

View file

@ -3,7 +3,7 @@
Edit Story Edit Story
</div> </div>
<%= form_for @story, :url => story_url(@story.short_id), <%= form_for @story, :url => story_path(@story.short_id),
:method => :put, :html => { :id => "edit_story" } do |f| %> :method => :put, :html => { :id => "edit_story" } do |f| %>
<%= render :partial => "stories/form", :locals => { :story => @story, <%= render :partial => "stories/form", :locals => { :story => @story,
:f => f } %> :f => f } %>
@ -36,7 +36,7 @@
</div> </div>
<%= submit_tag "Save" %> <%= submit_tag "Save" %>
&nbsp;or <a href="<%= story_url(@story.short_id) %>">cancel &nbsp;or <a href="<%= story_path(@story.short_id) %>">cancel
editing</a> editing</a>
<div style="clear: both;"></div> <div style="clear: both;"></div>

View file

@ -92,7 +92,7 @@
<a href="/newest/<%= @showing_user.username %>"><%= <a href="/newest/<%= @showing_user.username %>"><%=
@showing_user.stories_submitted_count %></a><%= tag ? ", " : "" %> @showing_user.stories_submitted_count %></a><%= tag ? ", " : "" %>
<% if tag %> <% if tag %>
most commonly tagged <a href="<%= tag_url(tag.tag) %>" most commonly tagged <a href="<%= tag_path(tag.tag) %>"
class="<%= tag.css_class %>" title="<%= tag.description %>"><%= class="<%= tag.css_class %>" title="<%= tag.description %>"><%=
tag.tag %></a> tag.tag %></a>
<% end %> <% end %>

View file

@ -27,11 +27,6 @@ module Lobsters
config.action_controller.action_on_unpermitted_parameters = :raise config.action_controller.action_on_unpermitted_parameters = :raise
config.cache_store = :file_store, "#{config.root}/tmp/cache/" config.cache_store = :file_store, "#{config.root}/tmp/cache/"
config.after_initialize do
Rails.application.routes.default_url_options[:host] =
Rails.application.domain
end
end end
end end
@ -40,8 +35,8 @@ silence_warnings do
ActionDispatch::ParamsParser::DEFAULT_PARSERS = {} ActionDispatch::ParamsParser::DEFAULT_PARSERS = {}
end end
# define site name and domain to be used globally, can be overridden in # define site name and domain to be used globally, should be overridden in a
# config/initializers/production.rb # local file such as config/initializers/production.rb
class << Rails.application class << Rails.application
def allow_invitation_requests? def allow_invitation_requests?
true true
@ -55,10 +50,23 @@ class << Rails.application
"Example News" "Example News"
end end
def root_url
Rails.application.routes.url_helpers.root_url({
:host => Rails.application.domain,
:protocol => Rails.application.ssl? ? "https" : "http",
})
end
# used as mailing list prefix and countinual prefix, cannot have spaces # used as mailing list prefix and countinual prefix, cannot have spaces
def shortname def shortname
name.downcase.gsub(/[^a-z]/, "") name.downcase.gsub(/[^a-z]/, "")
end end
# whether absolute URLs should include https (does not require that
# config.force_ssl be on)
def ssl?
true
end
end end
require "#{Rails.root}/lib/monkey" require "#{Rails.root}/lib/monkey"