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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T15:17:03+00:00 2026-06-14T15:17:03+00:00

Hello I have the following problem with my rails application: I have two models,

  • 0

Hello I have the following problem with my rails application:

I have two models, User and Information, the user, create his information using this url:

users/id/information/new

and edit his information using this url:

users/id/information/id/edit

The problem if the following, after the user create his information, if he go to the url:

users/id/information/new

the record is deleted from the data base and the user it’s allowed to create a new record; this is totally wrong, because the user is only allow to create one user information and then he can only edit his record.

How can I denied the user to go to new action url if the user have a record on the information table.

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-14T15:17:03+00:00Added an answer on June 14, 2026 at 3:17 pm

    add a before filter to the action new, then, inside that filter check if the user information exists

    UserInformationsController
      before_filter :require_no_user_information, :only => :new
    
      def require_no_user_information
        if UserInformation.exists?(:user_id => params[:id])
          flash[:notice] = 'The user information already exists'
          redirect_to edit_user_information_path params[:id]
          false
        end
      end
    end
    

    the filter will redirect and return false with a flash message if the user information exists, the code is an example, I don’t know your models

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

Sidebar

Related Questions

Hello i have the following problem, I record a video using red5 like this:
I have the following in my controller: return render :js => alert('Hello Rails'); Problem
Hello I have following Problem: Within an uninstall-process I load a JAR (jdbc-driver). URL
hello i have the following problem: i would like to create a filter for
hello i have just start using Raphael but i'm very confused in the following
I have the following problem. I need to pass the hello function to name
Hello i have the following problem. I have a search page lets call it
Hello I have the following problem. I the site http://www.telefonkoll.se when I enter a
Hello I have a problem with the following code in a GTMTestCase: - (void)testSomething
Hello i have created a sample application in android using eclipse IDE my code

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.