mirror of
https://github.com/oonyeje/Pearlception_Website_RoR.git
synced 2025-12-25 11:47:41 +00:00
Fixed routes
This commit is contained in:
parent
87d4a4185f
commit
58259d5a83
@ -1,5 +1,5 @@
|
|||||||
class ApplicationController < ActionController::Base
|
class ApplicationController < ActionController::Base
|
||||||
protect_from_forgery with: :exception
|
#protect_from_forgery with: :exception
|
||||||
protected
|
protected
|
||||||
|
|
||||||
def authenticate_user
|
def authenticate_user
|
||||||
|
|||||||
@ -6,7 +6,6 @@ class SessionsController < Devise::RegistrationsController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create
|
def create
|
||||||
puts "NOW IN CREATE"
|
|
||||||
params = sign_in_params
|
params = sign_in_params
|
||||||
@user = User.find_by(email: params[:email])
|
@user = User.find_by(email: params[:email])
|
||||||
if @user == nil || !@user.valid_password?(params[:password])
|
if @user == nil || !@user.valid_password?(params[:password])
|
||||||
@ -19,7 +18,7 @@ class SessionsController < Devise::RegistrationsController
|
|||||||
if !current_user.admin
|
if !current_user.admin
|
||||||
Apartment::Tenant.switch!(Company.find(current_user.company_id).company_name.gsub(/'/,'').gsub(/\s/,''))
|
Apartment::Tenant.switch!(Company.find(current_user.company_id).company_name.gsub(/'/,'').gsub(/\s/,''))
|
||||||
end
|
end
|
||||||
redirect_to "/"
|
redirect_to "/pearlception"
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|||||||
@ -1,12 +1,4 @@
|
|||||||
class Oyster < ApplicationRecord
|
class Oyster < ApplicationRecord
|
||||||
belongs_to :run
|
belongs_to :run
|
||||||
#Oyster.establish_connection(:"stats_#{Rails.env}")
|
|
||||||
#Oyster.establish_connection(
|
|
||||||
#:adapter => "mysql2",
|
|
||||||
#:host => ENV['STATS_DB_URL'],
|
|
||||||
#:username => ENV['STATS_DB_USER'],
|
|
||||||
#:password => ENV['STATS_DB_PASS'],
|
|
||||||
#:database => "main"
|
|
||||||
#)
|
|
||||||
scope :run_id, -> (id) { where run_id: id.to_i }
|
scope :run_id, -> (id) { where run_id: id.to_i }
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,12 +1,3 @@
|
|||||||
class Run < ApplicationRecord
|
class Run < ApplicationRecord
|
||||||
has_many :oysters
|
has_many :oysters
|
||||||
#belongs_to :companies
|
|
||||||
# establish_connection(:"stats_#{Rails.env}")
|
|
||||||
#Run.establish_connection(
|
|
||||||
#:adapter => "mysql2",
|
|
||||||
#:host => ENV['STATS_DB_URL'],
|
|
||||||
#:username => ENV['STATS_DB_USER'],
|
|
||||||
#:password => ENV['STATS_DB_PASS'],
|
|
||||||
#:database => "main"
|
|
||||||
#)
|
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,8 +1,7 @@
|
|||||||
require 'subdomain'
|
require 'subdomain'
|
||||||
|
|
||||||
Rails.application.routes.draw do
|
Rails.application.routes.draw do
|
||||||
constraints(Subdomain) do
|
get '/pearlception', to: "dashboard#index"
|
||||||
root 'dashboard#index'
|
|
||||||
# More subdomain constrained routes...
|
# More subdomain constrained routes...
|
||||||
get 'oysters/show'
|
get 'oysters/show'
|
||||||
get 'oysters/index'
|
get 'oysters/index'
|
||||||
@ -20,7 +19,6 @@ Rails.application.routes.draw do
|
|||||||
get 'signin' => 'sessions#new'
|
get 'signin' => 'sessions#new'
|
||||||
post 'signin' => 'sessions#create'
|
post 'signin' => 'sessions#create'
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
#binding.pry
|
#binding.pry
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user