You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I left this similar comment on devise's repository, to hopefully see a larger target audience. I'll copy and paste it here to reach another audience while linking to the original.
To make a long story short, I'm attempting to use MTI to create different roles in an application. While this isn't really documented well anywhere, I was hoping to combine the two models that I see as "best practice" (for lack of a better term).
My current issue is when creating or logging into the system using devise, devise seems to query ActiveRecord for specific column names, instead of using ruby attribute calls.
That is, when I try to login to the system, I receive a column not found:
SQLite3::SQLException: no such column: customers.email: SELECT "customers"."id" AS t0_r0, "customers"."created_at" AS t0_r1, "customers"."updated_at" AS t0_r2, "users"."id" AS t1_r0, "users"."as_user_id" AS t1_r1, "users"."as_user_type" AS t1_r2, "users"."email" AS t1_r3, "users"."encrypted_password" AS t1_r4, "users"."reset_password_token" AS t1_r5, "users"."reset_password_sent_at" AS t1_r6, "users"."remember_created_at" AS t1_r7, "users"."sign_in_count" AS t1_r8, "users"."current_sign_in_at" AS t1_r9, "users"."last_sign_in_at" AS t1_r10, "users"."current_sign_in_ip" AS t1_r11, "users"."last_sign_in_ip" AS t1_r12, "users"."created_at" AS t1_r13, "users"."updated_at" AS t1_r14 FROM "customers" INNER JOIN "users" ON "users"."as_user_id" = "customers"."id" AND "users"."as_user_type" = 'Customer' WHERE "customers"."email" = 'testcustomer@test.com' LIMIT 1
and when I try to sign up, I receive what appears to be a validation problem:
To me, this looks like devise is relying on activerecord directly instead of the models I've since created. Is there a way to change this functionality or is there a reason it is written this way?
For reference, my routes is devise_for :customers
my user.rb:
classUser < ActiveRecord::Base#Multi-Table Inheritance. A user can be a Customer, Employee, or an Adminacts_as_superclass# Include default devise modules. Others available are:# :confirmable, :lockable, :timeoutable and :omniauthabledevise:database_authenticatable,:registerable,:recoverable,:rememberable,:trackable,:validatable# Setup accessible (or protected) attributes for your modelattr_accessible:email,:password,:password_confirmation,:remember_me# attr_accessible :title, :bodyend
(side note: I noticed that you need the devise statements here for the routes to generate properly, and the attr_accessible was added to see if that would permit devise to access the proper variables, to no avail)
I left this similar comment on devise's repository, to hopefully see a larger target audience. I'll copy and paste it here to reach another audience while linking to the original.
To make a long story short, I'm attempting to use MTI to create different roles in an application. While this isn't really documented well anywhere, I was hoping to combine the two models that I see as "best practice" (for lack of a better term).
My current issue is when creating or logging into the system using devise, devise seems to query ActiveRecord for specific column names, instead of using ruby attribute calls.
That is, when I try to login to the system, I receive a column not found:
SQLite3::SQLException: no such column: customers.email: SELECT "customers"."id" AS t0_r0, "customers"."created_at" AS t0_r1, "customers"."updated_at" AS t0_r2, "users"."id" AS t1_r0, "users"."as_user_id" AS t1_r1, "users"."as_user_type" AS t1_r2, "users"."email" AS t1_r3, "users"."encrypted_password" AS t1_r4, "users"."reset_password_token" AS t1_r5, "users"."reset_password_sent_at" AS t1_r6, "users"."remember_created_at" AS t1_r7, "users"."sign_in_count" AS t1_r8, "users"."current_sign_in_at" AS t1_r9, "users"."last_sign_in_at" AS t1_r10, "users"."current_sign_in_ip" AS t1_r11, "users"."last_sign_in_ip" AS t1_r12, "users"."created_at" AS t1_r13, "users"."updated_at" AS t1_r14 FROM "customers" INNER JOIN "users" ON "users"."as_user_id" = "customers"."id" AND "users"."as_user_type" = 'Customer' WHERE "customers"."email" = 'testcustomer@test.com' LIMIT 1
and when I try to sign up, I receive what appears to be a validation problem:
To me, this looks like devise is relying on activerecord directly instead of the models I've since created. Is there a way to change this functionality or is there a reason it is written this way?
For reference, my routes is
devise_for :customers
my user.rb:
my customer:
(side note: I noticed that you need the devise statements here for the routes to generate properly, and the attr_accessible was added to see if that would permit devise to access the proper variables, to no avail)
and my related schema:
Thanks for listening!
Original post: heartcombo/devise#2712
The text was updated successfully, but these errors were encountered: