GithubHelp home page GithubHelp logo

Comments (10)

 avatar commented on May 27, 2024

Using authlogic with STI User models

I’m not sure, but I dont think it would be difficult to support. What are the specific errors?

by Ben Johnson

from authlogic.

 avatar commented on May 27, 2024

Using authlogic with STI User models

I’m using authlogic with STI right now and everything seems to work fine under development, but when I run it in production mode and attempt to update a model, this is what I get:

NoMethodError (undefined method `=&rsquo; for #<Patient:0xb34032c>):
authlogic (2.1.1) [v] lib/authlogic/acts_as_authentic/password.rb:229:in `send&rsquo;
authlogic (2.1.1) [v] lib/authlogic/acts_as_authentic/password.rb:229:in `password=&rsquo;

Here’s the current setup for the models:

class User < ActiveRecord::Base
  acts_as_authentic
end
class Patient < User;end
class Doctor < User;end

I looked at the password method, but I’m not sure what is happening or what to look for, is authlogic actually passing the whole model to the password method. Any help would be much appreciated.

Thanks!

  • Vann

    by Vann

from authlogic.

 avatar commented on May 27, 2024

Using authlogic with STI User models

It looks like:

Patient.crypted_password_field

Is returning nil. What does Patient.column_names return for you?

by Ben Johnson

from authlogic.

 avatar commented on May 27, 2024

Using authlogic with STI User models

Here’s what it returns:

Patient.column_names
Patient Columns (3.2ms) SHOW FIELDS FROM users
=> ["id", "login", "name", "email", "crypted_password", "salt", "created_at", "updated_at", "remember_token", "remember_token_expires_at", "first_name", "last_name", "ssn", "address", "city", "state", "zip", "drivers_license", "home_phone", "cell_phone", "fax", "employer", "insurance_co", "insurance_type", "insurance_id", "allergies", "medications", "operations", "chronic_conditions", "family_history", "immunizations", "visits_count", "appointments_count", "login_count", "getting_started", "type"]

by Vann

from authlogic.

grimen avatar grimen commented on May 27, 2024

I was about to use STI user models too, but don't really looking for trouble right now. What's the status on this? 8)

from authlogic.

nickytime avatar nickytime commented on May 27, 2024

@binarylogic what version of rails are you using? I am using authlogic with STI and it works beautifully on rails 2.3.2.

from authlogic.

nickytime avatar nickytime commented on May 27, 2024

Actually there is one thing that I am having trouble with and that is the password reset feature when using STI. It wants the param user. However my params for :user are nil. If I change to the appropriate STI class name it works fine but I have multiple STI sub class names. Any idea how I would fix that?

from authlogic.

nickytime avatar nickytime commented on May 27, 2024

Thanks to rsl, he showed me http://api.rubyonrails.org/classes/ActiveRecord/Base.html#M002334. In the form_for rather than using @user use @user.becomes(User) and it works beautifully again. Thanks again rsl.

from authlogic.

brianjlandau avatar brianjlandau commented on May 27, 2024

I too am using an app that uses authlogic and STI on User and it all works fine for me. I'm using authlogic 2.1.6 and rails 2.3.10

from authlogic.

jaredbeck avatar jaredbeck commented on May 27, 2024

Closing after six years with no activity. If this is still a problem in the latest version (currently 3.5.0), please let us know.

from authlogic.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.