Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PG Error #20

Open
homerjon opened this issue Oct 31, 2015 · 9 comments
Open

PG Error #20

homerjon opened this issue Oct 31, 2015 · 9 comments

Comments

@homerjon
Copy link

I am getting this error

PG::UndefinedColumn: ERROR: column users.subdomain does not exist
LINE 1: ...HERE (("users"."email" = '[email protected]' AND "users"."s...
^
: SELECT "users".* FROM "users" WHERE (("users"."email" = '[email protected]' AND "users"."subdomain" = 'mysubdomainname')) LIMIT 1

I am using

gem 'devise', '> 3.2.0'
gem 'devise_invitable', '
> 1.3.6'
gem 'devise-basecamper'

I do have two model Users and Vetters. Users uses basecamper and the other does not.

Here is my model

class User < ActiveRecord::Base

# Associations
belongs_to :account, :class_name => "Account", :foreign_key => "account_id"
has_many :documents

# Validations
validates :firstname, :presence => true
validates :lastname, :presence => true
validates :phone, :presence => true
validates :language_pref, :presence => true
validates :date_pref, :presence => true
validates :time_zone, :presence => true
validates_presence_of   :email
validates_uniqueness_of :email   
validates_format_of  :email, :with  => /\A([\w\.%\+\-]+)@([\w\-]+\.)+([\w]{2,})\z/i
with_options :if => :password_required? do |v|
    v.validates_presence_of     :password
    v.validates_confirmation_of :password
    v.validates_length_of       :password, :within => 6..20, :allow_blank => true
end


#  Devise
devise :invitable, :database_authenticatable, :recoverable, :rememberable, :validatable, :trackable, :basecamper, :request_keys => [:subdomain], :reset_password_keys => [:email, :subdomain]

devise_basecamper :subdomain_class => :account, :subdomain_field => :subdomain, :scope_field => :account_id

# Attributes
attr_accessible :account_id, :agreedtoterms, :firstname, :lastname, :phone, :title, :language_pref, :time_zone, :date_pref, :email, :password, :password_confirmation, :remember_me, :owner


# Callbacks

# Scopes
scope :accounted, lambda { |account| where("users.account_id = ?", account.id) }
scope :registered, where('firstname is not null AND lastname is not null AND language_pref is not null')
scope :alphabetical, order("lastname ASC")

end

@noiseunion
Copy link
Owner

Hey @homerjon - where is the SQL statement you included below your error being generated? Is that happening during the authentication process?

@homerjon
Copy link
Author

homerjon commented Nov 2, 2015

This was during "forgot my password". Authentication seems fine.

@noiseunion
Copy link
Owner

I'll try and take a look when I get a chance, otherwise if you want to do a pull request that would be great too.

@banta
Copy link

banta commented Apr 8, 2016

Was this fixed? I'm currently getting the same error.

@banta
Copy link

banta commented Apr 8, 2016

Hi @homerjon, did you find a solution to the above?

@homerjon
Copy link
Author

@banta. This was not fixed and is still an open issue for me. Noiseunion recommended to due a pull request. I am not pro git user and wasn't sure how to do that or the point of it.

@noiseunion
Copy link
Owner

@banta @homerjon I apologize, but I have been swamped with work for the last few months and have not had time to look into this. Any help would be appreciated.

@homerjon A pull request starts with you forking the repo to your GitHub account, making the necessary changes to fix the issue and then you can, from GitHub, do a pull request to have those changes merged back in to the main repo. I could then take your code changes and deploy an update to the Gem for everyone to benefit from.

Let me know if either of you would be interested in committing a fix, as I know I will not have time to hit this up super soon and the help would be greatly appreciated.

@banta
Copy link

banta commented Apr 13, 2016

@noiseunion @homerjon I got a fix. I'll send a pull request soon.

@noiseunion
Copy link
Owner

@banta hey buddy. Any updates on your pull request?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants