Some upgrade progress

This commit is contained in:
Absurdon 2017-11-25 22:39:25 +01:00 committed by Ari Timonen
parent 9252200dc0
commit 06ea6e57a7
12 changed files with 196 additions and 136 deletions

View file

@ -43,6 +43,10 @@ gem 'neat', '~> 1.6.0'
gem 'haml', '~> 4.0.5' gem 'haml', '~> 4.0.5'
gem 'rails_autolink', '~> 1.1.5' gem 'rails_autolink', '~> 1.1.5'
# acts as
gem 'acts_as_readable', '~> 2.1', '>= 2.1.1'
gem 'db_acts_as_versioned', '~> 3.5.0'
group :assets do group :assets do
gem 'uglifier', '~> 2.5.0' gem 'uglifier', '~> 2.5.0'
end end

View file

@ -46,6 +46,8 @@ GEM
minitest (~> 5.1) minitest (~> 5.1)
thread_safe (~> 0.3, >= 0.3.4) thread_safe (~> 0.3, >= 0.3.4)
tzinfo (~> 1.1) tzinfo (~> 1.1)
acts_as_readable (2.1.1)
rails (~> 4.0)
addressable (2.5.2) addressable (2.5.2)
public_suffix (>= 2.0.2, < 4.0) public_suffix (>= 2.0.2, < 4.0)
annotate (2.6.10) annotate (2.6.10)
@ -116,6 +118,7 @@ GEM
crass (1.0.3) crass (1.0.3)
dalli (2.7.6) dalli (2.7.6)
database_cleaner (1.2.0) database_cleaner (1.2.0)
db_acts_as_versioned (3.5.0)
debug_inspector (0.0.3) debug_inspector (0.0.3)
debugger-linecache (1.2.0) debugger-linecache (1.2.0)
declarative (0.0.10) declarative (0.0.10)
@ -343,6 +346,7 @@ PLATFORMS
DEPENDENCIES DEPENDENCIES
active_link_to (~> 1.0.2) active_link_to (~> 1.0.2)
acts_as_readable (~> 2.1, >= 2.1.1)
annotate (~> 2.6.2) annotate (~> 2.6.2)
bbcoder (~> 1.0.1) bbcoder (~> 1.0.1)
better_errors (~> 1.1.0) better_errors (~> 1.1.0)
@ -360,6 +364,7 @@ DEPENDENCIES
country_select country_select
dalli (~> 2.7.0) dalli (~> 2.7.0)
database_cleaner (~> 1.2.0) database_cleaner (~> 1.2.0)
db_acts_as_versioned (~> 3.5.0)
dotenv-rails (~> 0.10.0) dotenv-rails (~> 0.10.0)
dynamic_form (~> 1.1.4) dynamic_form (~> 1.1.4)
exceptional (~> 2.0.33) exceptional (~> 2.0.33)

View file

@ -39,7 +39,7 @@ class ArticlesController < ApplicationController
end end
def create def create
@article = Article.new params[:article] @article = Article.new(article_create_params)
@article.user = cuser @article.user = cuser
raise AccessError unless @article.can_create? cuser raise AccessError unless @article.can_create? cuser
@ -52,8 +52,8 @@ class ArticlesController < ApplicationController
end end
def update def update
raise AccessError unless @article.can_update? cuser, params[:article] raise AccessError unless @article.can_update?(cuser, params[:article])
if @article.update_attributes(params[:article]) if @article.update_attributes(article_update_params)
flash[:notice] = t(:articles_update) flash[:notice] = t(:articles_update)
redirect_to @article redirect_to @article
else else
@ -79,4 +79,12 @@ class ArticlesController < ApplicationController
def get_article def get_article
@article = Article.find params[:id] @article = Article.find params[:id]
end end
def article_create_params
params.require(:article).permit(:title,:status, :category, :text, :text_parsed, :text_coding, :user)
end
def article_update_params
params.require(:article).permit(:title,:status, :category, :text, :text_parsed, :text_coding)
end
end end

View file

@ -53,7 +53,7 @@ class BansController < ApplicationController
end end
def ban_create_params def ban_create_params
params.require(:ban).pemit(:steamid, :addr, :reason, :len, :user_name, :creator, :ban_type, :ip, :server, :len, :expiry) params.require(:ban).permit(:steamid, :addr, :reason, :len, :user_name, :creator, :ban_type, :ip, :server, :len, :expiry)
end end
def ban_update_params def ban_update_params

View file

@ -3,7 +3,7 @@ class CategoriesController < ApplicationController
def show def show
if [Category::DOMAIN_ARTICLES, Category::DOMAIN_NEWS].include? @category.domain if [Category::DOMAIN_ARTICLES, Category::DOMAIN_NEWS].include? @category.domain
@articles = Article.with_comments.ordered.limited.nodrafts.category params[:id] @articles = Article.with_comments.ordered.limited.nodrafts.of_category params[:id]
Category.find(params[:id]).read_by! cuser if cuser Category.find(params[:id]).read_by! cuser if cuser
render partial: 'articles/article', collection: @articles.to_a render partial: 'articles/article', collection: @articles.to_a
end end
@ -23,7 +23,7 @@ class CategoriesController < ApplicationController
end end
def create def create
@category = Category.new params[:category] @category = Category.new category_params
raise AccessError unless @category.can_create? cuser raise AccessError unless @category.can_create? cuser
if @category.save if @category.save
@ -37,7 +37,7 @@ class CategoriesController < ApplicationController
def update def update
raise AccessError unless @category.can_update? cuser raise AccessError unless @category.can_update? cuser
if @category.update_attributes params[:category] if @category.update_attributes category_params
flash[:notice] = t(:articles_category_update) flash[:notice] = t(:articles_category_update)
redirect_to :categories redirect_to :categories
end end
@ -66,4 +66,8 @@ class CategoriesController < ApplicationController
def get_category def get_category
@category = Category.find params[:id] @category = Category.find params[:id]
end end
def category_params
params.require(:category).permit(:name, :domain)
end
end end

View file

@ -36,7 +36,7 @@ class IssuesController < ApplicationController
end end
def create def create
@issue = Issue.new(params[:issue]) @issue = Issue.new(issue_create_params)
@issue.author = cuser if cuser @issue.author = cuser if cuser
raise AccessError unless @issue.can_create? cuser raise AccessError unless @issue.can_create? cuser
@ -54,7 +54,7 @@ class IssuesController < ApplicationController
def update def update
raise AccessError unless @issue.can_update?(cuser, params[:issue]) raise AccessError unless @issue.can_update?(cuser, params[:issue])
if @issue.update_attributes(params[:issue]) if @issue.update_attributes(issue_update_params)
flash[:notice] = t(:issues_update) flash[:notice] = t(:issues_update)
redirect_to(@issue) redirect_to(@issue)
else else
@ -73,4 +73,12 @@ class IssuesController < ApplicationController
def get_issue def get_issue
@issue = Issue.find params[:id] @issue = Issue.find params[:id]
end end
def issue_create_params
params.require(:issue).permit(:title, :category, :text, :author)
end
def issue_update_params
params.require(:issue).permit(:title, :category, :text, :assigned, :author, :solution, :status)
end
end end

View file

@ -53,7 +53,7 @@ class UsersController < ApplicationController
end end
def create def create
@user = User.new params[:user] @user = User.new(user_create_params)
@user.lastvisit = Date.today @user.lastvisit = Date.today
@user.lastip = request.env['REMOTE_ADDR'] @user.lastip = request.env['REMOTE_ADDR']
@ -73,7 +73,7 @@ class UsersController < ApplicationController
def update def update
raise AccessError unless @user.can_update? cuser raise AccessError unless @user.can_update? cuser
params[:user].delete(:username) unless @user.can_change_name? cuser params[:user].delete(:username) unless @user.can_change_name? cuser
if @user.update_attributes params[:user] if @user.update_attributes user_update_params
flash[:notice] = t(:users_update) flash[:notice] = t(:users_update)
redirect_to_back redirect_to_back
else else
@ -117,7 +117,8 @@ class UsersController < ApplicationController
def forgot def forgot
if request.post? if request.post?
if u = User.first(:conditions => {:username => params[:username], :email => params[:email]}) and u.send_new_password user = User.where(username: params[:username], email: params[:email] ).first
if user and user.send_new_password
flash[:notice] = t(:passwords_sent) flash[:notice] = t(:passwords_sent)
else else
flash[:error] = t(:incorrect_information) flash[:error] = t(:incorrect_information)
@ -137,4 +138,16 @@ class UsersController < ApplicationController
user.lastvisit = DateTime.now user.lastvisit = DateTime.now
user.save() user.save()
end end
def user_create_params
params.require(:user).permit(:raw_password, :username, :email, :steamid, :birthdate)
end
def user_update_params
params.require(:user).permit(
:raw_password, :username, :email, :steamid, :birthdate,
:firstname, :lastname, :country, :time_zone, :public_email,
params[:user][:profile_attributes].try(:keys)
)
end
end end

View file

@ -36,23 +36,27 @@ class Article < ActiveRecord::Base
G_RULES = 464 G_RULES = 464
COMPMOD = 998 COMPMOD = 998
attr_protected :id, :updated_at, :created_at, :user_id, :version scope :recent, ->{ order(created_at: :desc).limit(8) }
scope :with_comments, lambda {
select("articles.*, COUNT(C.id) AS comment_num")
.joins("LEFT JOIN comments C ON C.commentable_type = 'Article' AND C.commentable_id = articles.id")
.group(:id)
}
scope :ordered, -> { order(created_at: :desc) }
scope :limited, -> { limit(5) }
scope :nodrafts, -> { where(status: STATUS_PUBLISHED) }
scope :drafts, -> { where(status: STATUS_DRAFT) }
scope :of_category, ->(cat){ where(category_id: cat) }
scope :recent, order: 'created_at DESC', limit: 8 scope :domain, lambda { |domain|
scope :with_comments, includes(:category)
select: "articles.*, COUNT(C.id) AS comment_num", .where(category_id: {category: { domain: domain}})
joins: "LEFT JOIN comments C ON C.commentable_type = 'Article' AND C.commentable_id = articles.id", }
group: "articles.id" scope :articles, -> { domain Category::DOMAIN_ARTICLES }
scope :ordered, order: 'articles.created_at DESC' scope :onlynews, -> { domain Category::DOMAIN_NEWS }
scope :limited, limit: 5
scope :nodrafts, conditions: { status: STATUS_PUBLISHED } scope :nospecial, -> { where(category_id: Category::SPECIAL) }
scope :drafts, conditions: { status: STATUS_DRAFT } scope :interviews, -> { where(category_id: Category::INTERVIEWS) }
scope :articles, conditions: ["category_id IN (SELECT id FROM categories WHERE domain = ?)", Category::DOMAIN_ARTICLES]
scope :onlynews, conditions: ["category_id IN (SELECT id FROM categories WHERE domain = ?)", Category::DOMAIN_NEWS]
scope :category, lambda { |cat| { conditions: { category_id: cat } } }
scope :domain, lambda { |domain| { includes: 'category', conditions: { "categories.domain" => domain } } }
scope :nospecial, conditions: ["category_id != ?", Category::SPECIAL]
scope :interviews, conditions: ["category_id = ?", Category::INTERVIEWS]
belongs_to :user belongs_to :user
belongs_to :category belongs_to :category
@ -83,11 +87,11 @@ class Article < ActiveRecord::Base
end end
def previous_article def previous_article
category.articles.nodrafts.first(conditions: ["id < ?", self.id], order: "id DESC") category.articles.nodrafts.where(["id < ?", self.id]).order(id: :desc).first
end end
def next_article def next_article
category.articles.nodrafts.first(conditions: ["id > ?", self.id], order: "id ASC") category.articles.nodrafts.where(["id > ?", self.id]).order(:id).first
end end
def statuses def statuses
@ -95,7 +99,7 @@ class Article < ActiveRecord::Base
end end
def validate_status def validate_status
errors.add :status, I18n.t(:invalid_status) unless statuses.include? status errors.add :status, 'Invalid status' unless statuses.include? status
end end
def init_variables def init_variables

View file

@ -28,21 +28,26 @@ class Category < ActiveRecord::Base
PER_PAGE = 3 PER_PAGE = 3
attr_protected :id, :updated_at, :created_at, :sort
validates_length_of :name, :in => 1..30 validates_length_of :name, :in => 1..30
validate :validate_domain validate :validate_domain
scope :ordered, :order => "sort ASC, created_at DESC" scope :ordered, ->{ order(:sort, created_at: :desc) }
scope :domain, lambda { |domain| {:conditions => {:domain => domain}} } scope :domain, ->(domain) { where(domain: domain) }
scope :nospecial, :conditions => ["name != 'Special'"] scope :nospecial,->{ where.not(name: 'Special') }
scope :newest, :include => :articles, :order => "articles.created_at DESC" scope :newest, lambda{
scope :page, lambda { |page| {:limit => "#{(page-1)*PER_PAGE}, #{(page-1)*PER_PAGE+PER_PAGE}"} } includes(:articles)
scope :of_user, lambda { |user| {:conditions => {"articles.user_id" => user.id}, :include => :articles} } .order(articles: { created_at: :desc})
}
scope :of_user, lambda { |user|
includes(:articles)
.where(articles: {
user_id: user.id
})
}
has_many :articles, :order => "created_at DESC" has_many :articles, ->{ order(created_at: :desc) }
has_many :issues, :order => "created_at DESC" has_many :issues, ->{ order(created_at: :desc) }
has_many :forums, :order => "forums.position" has_many :forums, ->{ order(:position) }
has_many :movies has_many :movies
has_many :maps has_many :maps
has_many :gathers has_many :gathers
@ -65,7 +70,7 @@ class Category < ActiveRecord::Base
end end
def validate_domain def validate_domain
errors.add :domain, I18n.t(:invalid_domain) unless domains.include? domain errors.add(:domain, 'Incalid Domain') unless domains.include? domain
end end
def can_create? cuser def can_create? cuser

View file

@ -30,7 +30,6 @@ class Issue < ActiveRecord::Base
CATEGORY_GATHER = 54 CATEGORY_GATHER = 54
attr_accessor :assigned_name attr_accessor :assigned_name
attr_protected :id, :created_at, :updated_at
has_many :comments, :as => :commentable has_many :comments, :as => :commentable
belongs_to :category belongs_to :category
@ -81,7 +80,7 @@ class Issue < ActiveRecord::Base
end end
def validate_status def validate_status
errors.add :status, I18n.t(:invalid_status) unless statuses.include? status errors.add :status, 'Invalid status' unless statuses.include? status
end end
def parse_text def parse_text

View file

@ -23,14 +23,12 @@
require 'digest/md5' require 'digest/md5'
require File.join(Rails.root, 'vendor', 'plugins', 'acts_as_versioned', 'lib', 'acts_as_versioned.rb')
class User < ActiveRecord::Base class User < ActiveRecord::Base
include Extra include Extra
VERIFICATION_TIME = 604800 VERIFICATION_TIME = 604800
attr_protected :id, :created_at, :updated_at, :lastvisit, :lastip, :password, :version
attr_accessor :raw_password attr_accessor :raw_password
belongs_to :team belongs_to :team
@ -47,59 +45,77 @@ class User < ActiveRecord::Base
has_many :groups, :through => :groupers has_many :groups, :through => :groupers
has_many :shoutmsgs, :dependent => :destroy has_many :shoutmsgs, :dependent => :destroy
has_many :issues, :foreign_key => "author_id", :dependent => :destroy has_many :issues, :foreign_key => "author_id", :dependent => :destroy
has_many :open_issues, :class_name => "Issue", :foreign_key => "assigned_id",
:conditions => ["issues.status = ?", Issue::STATUS_OPEN] has_many :open_issues, ->{ where(status: Issue::STATUS_OPEN) },
:class_name => "Issue", :foreign_key => 'assigned_id'
has_many :posted_comments, :dependent => :destroy, :class_name => "Comment" has_many :posted_comments, :dependent => :destroy, :class_name => "Comment"
has_many :comments, :class_name => "Comment", :as => :commentable, :order => "created_at ASC", :dependent => :destroy
has_many :comments, ->{ order(created_at: :asc) },
:class_name => "Comment", :as => :commentable, :dependent => :destroy
has_many :teamers, :dependent => :destroy has_many :teamers, :dependent => :destroy
has_many :active_teams, :through => :teamers, :source => "team",
:conditions => ["teamers.rank >= ? AND teams.active = ?", Teamer::RANK_MEMBER, true] has_many :active_teams, ->{ where(["teamers.rank >= ? AND teams.active = ?", Teamer::RANK_MEMBER, true]) },
has_many :active_contesters, :through => :active_teams, :source => "contesters", :through => :teamers, :source => "team"
:conditions => {"contesters.active" => true}
has_many :active_contests, :through => :active_contesters, :source => "contest", has_many :active_contesters, ->{ where(active: true) },
:conditions => ["contests.status != ?", Contest::STATUS_CLOSED] :through => :active_teams, :source => "contesters"
has_many :past_teams, :through => :teamers, :source => "team", :group => "user_id, team_id"
has_many :active_contests,->{ where(status: Contest::STATUS_CLOSED) },
:through => :active_contesters, :source => "contest"
has_many :past_teams, ->{ group(:user_id, :team_id) },
:through => :teamers, :source => "team"
has_many :matchers, :dependent => :destroy has_many :matchers, :dependent => :destroy
has_many :matches, :through => :matchers has_many :matches, :through => :matchers
has_many :predictions, :dependent => :destroy has_many :predictions, :dependent => :destroy
has_many :challenges_received, :through => :active_contesters, :source => "challenges_received" has_many :challenges_received, :through => :active_contesters, :source => "challenges_received"
has_many :challenges_sent, :through => :active_contesters, :source => "challenges_sent" has_many :challenges_sent, :through => :active_contesters, :source => "challenges_sent"
has_many :upcoming_team_matches, :through => :active_contesters, :source => "matches",
:conditions => "match_time > UTC_TIMESTAMP()" has_many :upcoming_team_matches, ->{ where("match_time > UTC_TIMESTAMP()") },
has_many :upcoming_ref_matches, :class_name => "Match", :foreign_key => "referee_id", :through => :active_contesters, :source => "matches"
:conditions => "match_time > UTC_TIMESTAMP()"
has_many :past_team_matches, :through => :active_contesters, :source => "matches", has_many :upcoming_ref_matches, ->{ where("match_time > UTC_TIMESTAMP()") },
:conditions => "match_time < UTC_TIMESTAMP()" :class_name => "Match", :foreign_key => "referee_id"
has_many :past_ref_matches, :class_name => "Match", :foreign_key => "referee_id",
:conditions => "match_time < UTC_TIMESTAMP()" has_many :past_team_matches, ->{ where("match_time < UTC_TIMESTAMP()") },
:through => :active_contesters, :source => "matches"
has_many :past_ref_matches,->{ where("match_time < UTC_TIMESTAMP()") },
:class_name => "Match", :foreign_key => "referee_id"
has_many :received_personal_messages, :class_name => "Message", :as => "recipient", :dependent => :destroy has_many :received_personal_messages, :class_name => "Message", :as => "recipient", :dependent => :destroy
has_many :sent_personal_messages, :class_name => "Message", :as => "sender", :dependent => :destroy has_many :sent_personal_messages, :class_name => "Message", :as => "sender", :dependent => :destroy
has_many :sent_team_messages, :through => :active_teams, :source => :sent_messages has_many :sent_team_messages, :through => :active_teams, :source => :sent_messages
has_many :match_teams, :through => :matchers, :source => :teams, :uniq => true has_many :match_teams, ->{ uniq }, :through => :matchers, :source => :teams
scope :active, :conditions => {:banned => false} scope :active,->{ where(banned: false) }
scope :with_age, scope :with_age, lambda {
:select => "DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(birthdate)), '%Y')+0 AS aged, COUNT(*) as num, username", select("DATE_FORMAT(FROM_DAYS(TO_DAYS(NOW())-TO_DAYS(birthdate)), '%Y')+0 AS aged, COUNT(*) as num, username")
:group => "aged", .having('num > 8 AND aged > 0')
:having => "num > 8 AND aged > 0" .group('aged')
scope :country_stats, }
:select => "country, COUNT(*) as num", scope :country_stats, lambda {
:conditions => "country is not null and country != '' and country != '--'", select("country, COUNT(*) as num")
:group => "country", .where("country is not null and country != '' and country != '--'")
:having => "num > 15", .having("num > 15")
:order => "num DESC" .group("country")
scope :posts_stats, .order("num DESC")
:select => "users.id, username, COUNT(posts.id) as num", }
:joins => "LEFT JOIN posts ON posts.user_id = users.id", scope :posts_stats, lambda {
:group => "users.id", select("users.id, username, COUNT(posts.id) as num")
:order => "num DESC" .joins("LEFT JOIN posts ON posts.user_id = users.id")
scope :banned, .group("users.id")
:joins => "LEFT JOIN bans ON bans.user_id = users.id AND expiry > UTC_TIMESTAMP()", .order("num DESC")
:conditions => "bans.id IS NOT NULL" }
scope :idle, scope :banned, lambda {
:conditions => ["lastvisit < ?", 30.minutes.ago.utc] joins("LEFT JOIN bans ON bans.user_id = users.id AND expiry > UTC_TIMESTAMP()")
scope :lately, .where("bans.id IS NOT NULL")
:conditions => ["lastvisit > ?", 30.days.ago.utc] }
scope :idle, ->{ where(["lastvisit < ?", 30.minutes.ago.utc]) }
scope :lately, ->{ where(["lastvisit > ?", 30.days.ago.utc]) }
before_validation :update_password before_validation :update_password

View file

@ -19,9 +19,9 @@ Ensl::Application.routes.draw do
resources :versions resources :versions
end end
match "contests/del_map" get "contests/del_map"
match "contests/scores" get "contests/scores"
match "contests/historical", to: "contests#historical" get "contests/historical", to: "contests#historical"
resources :contests do resources :contests do
get "current", on: :collection get "current", on: :collection
@ -32,7 +32,7 @@ Ensl::Application.routes.draw do
resources :options resources :options
resources :polls resources :polls
match "comments/quote" get "comments/quote"
resources :comments resources :comments
resources :shoutmsgs, except: :index resources :shoutmsgs, except: :index
@ -45,8 +45,8 @@ Ensl::Application.routes.draw do
resources :forumers resources :forumers
resources :topics resources :topics
match "forums/up" get "forums/up"
match "forums/down" get "forums/down"
resources :forums resources :forums
resources :users resources :users
@ -80,71 +80,65 @@ Ensl::Application.routes.draw do
resources :tweets resources :tweets
resources :issues resources :issues
match "posts/quote" get "posts/quote"
resources :posts resources :posts
resources :brackets resources :brackets
match "about/action" get "about/action"
match "about/staff" get "about/staff"
match "about/statistics" get "about/statistics"
match "refresh", to: "application#refresh" # match "refresh", to: "application#refresh"
match "search", to: "application#search" # match "search", to: "application#search"
match "news", to: "articles#news_index" get "news", to: "articles#news_index"
match "news/archive", to: "articles#news_archive" get "news/archive", to: "articles#news_archive"
match "news/admin", to: "articles#admin" get "news/admin", to: "articles#admin"
match "articles/cleanup" get "articles/cleanup"
match "data_files/admin" get "data_files/admin"
match "data_files/addFile" match "data_files/addFile", via: [:get, :post]
match "data_files/delFile" match "data_files/delFile", via: [:get, :post]
match "data_files/trash" match "data_files/trash", via: [:get, :post]
match "contesters/recalc" match "contests/recalc", via: [:get, :post]
match "directories", to: "directories#show", id: 1 get "directories", to: "directories#show", id: 1
match "gathers/refresh" match "gathers/refresh", via: [:get, :post]
match "gathers/latest/:game", to: "gathers#latest", via: :get match "gathers/latest/:game", to: "gathers#latest", via: :get
match "gather", to: "gathers#latest", game: "ns2", via: :get match "gather", to: "gathers#latest", game: "ns2", via: :get
match "gatherers/:id/status", to: "gatherers#status", via: :post match "gatherers/:id/status", to: "gatherers#status", via: :post
match "groups/addUser" post "groups/addUser"
match "groups/delUser" post "groups/delUser"
match "movies/download" get "movies/download"
match "movies/preview" get "movies/preview"
match "movies/snapshot" get "movies/snapshot"
match "plugin/user" get "plugin/user"
match "users/forgot" match "users/forgot", via: [:get, :post]
match "users/recover" get "users/agenda"
match "users/agenda" match "users/logout", via: [:get, :post]
match "users/logout" match "users/login", via: [:get, :post]
match "users/login" get "users/popup"
match "users/agenda" post "votes/create"
match "users/login" get "polls/showvotes/:id", to: "polls#showvotes", as: "polls_showvotes"
match "users/logout"
match "users/popup"
match "users/forgot", to: "users#forgot"
match "votes/create"
match "polls/showvotes/:id", to: "polls#showvotes", as: "polls_showvotes"
get "custom_urls", to: "custom_urls#administrate" get "custom_urls", to: "custom_urls#administrate"
resources :custom_urls, only: [:create, :update, :destroy] resources :custom_urls, only: [:create, :update, :destroy]
get ":name", to: "custom_urls#show", requirements: {name: /\A[a-z\-]{2,10}\Z/} get ":name", to: "custom_urls#show", requirements: {name: /\A[a-z\-]{2,10}\Z/}
match ":controller/:action", requirements: { action: /A-Za-z/ } match ":controller/:action", requirements: { action: /A-Za-z/ }, via: [:get, :post]
match ":controller/:action/:id" match ":controller/:action/:id", via: [:get, :post]
match ":controller/:action/:id.:format" match ":controller/:action/:id.:format", via: [:get, :post]
match ":controller/:action/:id/:id2" match ":controller/:action/:id/:id2", via: [:get, :post]
match "teamers/replace", to: "teamers#replace", as: "teamers_replace" # match "teamers/replace", to: "teamers#replace", as: "teamers_replace"
end end