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 4256764
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T05:23:57+00:00 2026-05-21T05:23:57+00:00

We are development an announcement mechanism that works in such way: – Users are

  • 0

We are development an announcement mechanism that works in such way:
– Users are nested attributes under an announcement. User’s emails are entered in the new announcement form as the nested attributes.
– Would like to work this way – When the announcement is saved, it needs to search user’s email w/ current users’ emails, if found, then deposit this announcement into that user’s profile and the user will be notified via email. If NOT, then a new user account is created and an email is sent for the user to claim his account.
When creating a new announcement, the rails saves all attributes tied w/nested attributes (this is great except when the user’s email already exists).
Since only user’s email is used to created the User’s account, how can we implement password later on (or auto create password to allow user to change later on)? We are using devise for authentication. Is there a way to use devise to perform this function?
How this problem can be solved ? Your help is greatly appreciated.

class Announcement < ActiveRecord::Base

  attr_accessible  :content, :users_attributes 

  has_many :users, :through => :awards
  has_many :awards, :dependent => :destroy

  accepts_nested_attributes_for :users, :reject_if => lambda { |a| a[:email].blank? }, :allow_destroy => true

end
class User < ActiveRecord::Base
  attr_accessible :email, :first_name, :last_name, :middle_name

  has_many :awards, :dependent => :destroy
  has_many :announcements, :through => :awards, :dependent => :destroy

  email_regex = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i

  validates :email, :presence => true, :format => { :with => email_regex }, :uniqueness => { :case_sensitive => false }

end

E-mail

  • 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-05-21T05:23:58+00:00Added an answer on May 21, 2026 at 5:23 am

    You can implement an additional boolean attribute on your user model to indicate that the account has been claimed, and then not use the confirmable module of devise (since the user has effectively confirmed their email by following back a link). When a user arrives who’s account has not been claimed, fill in the authentication details at that point. Presumably you’d have an attribute in the Email linkback that lets you retrieve the appropriate record to populate.

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

Sidebar

Related Questions

My development under VS2008 Team Suite SP1 with SQL Sever 2005 Express SP3. One
In development I make an Ajax post which works in development. However when I
On development server I'd like to remove unused databases. To realize that I need
I have written an application that is used company wide. A lot of users
My development environment (IBM RAD 8 + WAS 8) is complaining that my project
During development, i can easily manage my users/roles/smtp etc using the Administer Web Site
In development environment string AppPath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location); string path = AppPath + \\options.xml; Works.
In development mode in eclipse with jetty the fileupload works just fine. I upload
Yesterday I saw the announcement from the Ceylon team that the first milestone release
Our development policy dictates that all database accesses are made via stored procedures, and

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.