1
0
Fork 0

Routes error page, users controller

This commit is contained in:
magnolia-fan 2011-04-13 05:59:45 +04:00
parent b7abe9a1d3
commit 1e01c6cf7d
4 changed files with 22 additions and 56 deletions

View File

@ -0,0 +1,5 @@
class ErrorsController < ApplicationController
def routing
render :file => "#{Rails.root}/public/404.html", :status => 404, :layout => false
end
end

View File

@ -0,0 +1,12 @@
class UserController < ApplicationController
def register
data = Invite.where(:email => params[:email], :code => params[:code]).first
unless data.nil?
@code = data.code
else
redirect_to '/'
end
end
end

View File

@ -5,5 +5,5 @@ class Invite
key :referer, Integer
key :email, String
key :code, String
key :senton, Date
key :date, Date
end

View File

@ -1,65 +1,14 @@
Beathaven::Application.routes.draw do
get "main/index"
# The priority is based upon order of creation:
# first created -> highest priority.
# Sample of regular route:
# match 'products/:id' => 'catalog#view'
# Keep in mind you can assign values other than :controller and :action
# Sample of named route:
# match 'products/:id/purchase' => 'catalog#purchase', :as => :purchase
# This route can be invoked with purchase_url(:id => product.id)
# Sample resource route (maps HTTP verbs to controller actions automatically):
# resources :products
# Sample resource route with options:
# resources :products do
# member do
# get 'short'
# post 'toggle'
# end
#
# collection do
# get 'sold'
# end
# end
# Sample resource route with sub-resources:
# resources :products do
# resources :comments, :sales
# resource :seller
# end
# Sample resource route with more complex sub-resources
# resources :products do
# resources :comments
# resources :sales do
# get 'recent', :on => :collection
# end
# end
# Sample resource route within a namespace:
# namespace :admin do
# # Directs /admin/products/* to Admin::ProductsController
# # (app/controllers/admin/products_controller.rb)
# resources :products
# end
# You can have the root of your site routed with "root"
# just remember to delete public/index.html.
# root :to => "welcome#index"
root :to => "main#index", :as => "main"
# See how all your routes lay out with "rake routes"
# This is a legacy wild controller route that's not recommended for RESTful applications.
# Note: This route will make all actions in every controller accessible via GET requests.
# match ':controller(/:action(/:id(.:format)))'
match 'artist(/:name)' => 'artist#view'
match 'listen/:id' => 'track#listen'
match 'search/autocomplete' => 'artist#autocomplete'
match 'reg/:email/:code' => 'user#register', :constraints => { :email => /[-a-z0-9\._@]+/i, :code => /[a-z0-9]{8}/ }
match '*a', :to => 'errors#routing'
end