Fixed routes

This commit is contained in:
bmv root 2017-04-24 23:19:05 -04:00
parent 87d4a4185f
commit 58259d5a83
5 changed files with 3 additions and 23 deletions

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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