Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8059687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:45:03+00:00 2026-06-05T09:45:03+00:00

I have users and contacts. Users sign into their account and can create address

  • 0
  1. I have users and contacts.
  2. Users sign into their account and can create address books from which they add contacts to.
  3. If they share something with a contact that contact needs to login to view it.

Users are unique in the db (stored in users table) and contacts are stored in the contacts table and are only unique per a given address book.

I’m currently using the Sorcery gem for users, which is working great. However, how can I extend this to support authentication for contact to login?

I’ve read a bit into doing this via STI or polymorphic setup, but unclear on what the general pattern is for something like this.

Can I simply have both models use Sorcery? Or is that an anti-pattern?

Thanks in advance!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T09:45:05+00:00Added an answer on June 5, 2026 at 9:45 am

    Why are you using a separate model for contacts? Why not just set up a self-join like:

    has_many :contact_entries, :class_name => "ContactEntry"
    has_many :contacts, :through => :contact_entries
    

    Your user table would look the same, but you would have a join model like:

    class ContactEntry < ActiveRecord::Base
      belongs_to :user
      belongs_to :contact, :foreign_key => "contact_id", :class_name => "User"
    end
    

    Which would have a user_id and contact_id field.

    Update

    Okay, I see your issue now. I don’t think this will be possible with sorcery, at least not without making substantial edits to sorcery itself. Sorcery defines a single authenticatable model in the file initializer.rb.

    Authlogic, however, can be brought into any model via “acts_as_authentic”, so it is a plausible solution to your needs. The drawback is that authlogic doesn’t seem to be actively developed. It had a fair amount of activity 10 days ago, however, so it’s definitely worth looking in to.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a contact form which asks users for their name, email address and
I have a form to add contacts into a database, which has a select
We have a AutoCompleteTextView which is able to read from the users-contact-data as a
I have to create an application in PHP which will store the phone contacts
I`m making a site where users have to sign up. They will be contacted
I'm trying to create a small app for users to have contacts. I'm using
I have a process users must go through on my site which can take
Users can't complete sign up because they get Redirected. I still want to keep
I have got 2 tables: Contacts and Users . Contacts table contains user_id which
I have an entries controller that allows users to add contact information the website.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.