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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T06:28:53+00:00 2026-06-06T06:28:53+00:00

I am creating an app that allows users to create and apply for jobs.

  • 0

I am creating an app that allows users to create and apply for jobs.

The issue I am having is in getting the associations correct between my three models.

Currently I have the following:

 class App < ActiveRecord::Base
    belongs_to :job
    belongs_to :user
 end 

 class Job < ActiveRecord::Base
    belongs_to :user, :dependent => :destroy
    has_many :apps, :through => :users
 end

 class User < ActiveRecord::Base
    has_many :jobs
    has_many :apps, :through => :jobs
 end

In my database table for Apps I have two additional columns for user_id and job_id so that the association can be made correctly there.

I am also unsure how I would create a form for say a new application. Currently I have used the following but because I don’t have apps as a nested resource of users I am unsure if this is what’s causing the issues:

 class AppsController < ApplicationController

 def new
   @user = current_user
   @app = @user.apps.build
 end

def create
  @user = current_user
  @app = @user.apps.create(params[:app])
  if @app.save
    redirect_to user_path
  else
    render new_app_path
  end
end

and

<%= form_for [@app] do |f| %>

<div class = "field">
    <%= f.label :name %>
    <%= f.text_field :name %>
</div>

<div class = "field">
    <%= f.label :cover_letter %>
    <%= f.text_field :cover_letter %>
</div>

<div class = "field">
    <%= f.label :cv %>
    <%= f.text_field :cv %>
</div>

<%= f.submit "Submit" %>

<% end %>

It would be great if someone could provide an example of how they would setup the associations for this app and how they would ensure that the related forms worked with this setup.

Thanks in advance for your help!

I have also pushed my app to Github in case that helps anyone: Github Link

  • 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-06T06:28:54+00:00Added an answer on June 6, 2026 at 6:28 am

    I think there will be relationship many-to-many between users and jobs.And applications can act as join table (as jobs_users).

    so models …

    class App < ActiveRecord::Base 
        belongs_to :job
        belongs_to :user
    end
    
    class Job < ActiveRecord::Base
         has_many :users
         has_many :apps, :through => :apps
    end
    
    class User < ActiveRecord::Base
         has_many :jobs,:dependent => :destroy
         has_many :apps, :through => :apps
    end
    

    And for nested form go through this
    http://railscasts.com/episodes/196-nested-model-form-part-1?view=asciicast

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

Sidebar

Related Questions

I'm working on creating a Rails app that allows users to set availability Sunday
I'm creating an app that allows users to query, manipulate, and explore a very
I am working on a simple django app that allows users to create posts
I am creating a WPF app that needs to allow users to work in
I'm creating an app that uses ActionBarSherlock. The app consists of three tabs, and
So I'm creating a django app that allows a user to add a new
I am creating a webapp on facebook that allows users to provide login details
I am building a web app that allows our field staff to create appointments.
I am looking at creating an app for OS X and/or iOS that allows
I am creating an app that will point a simple arrow in the direction

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.