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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T14:17:48+00:00 2026-05-22T14:17:48+00:00

I have nested my resources (see below) and when I try to create a

  • 0

I have nested my resources (see below) and when I try to create a new entity, I get the following error. Does anyone know why I’m getting this error and how to solve it?

undefined method `applications’ for nil:NilClass

resources careers do
    resources applications
end

Within the ‘Applications’ controller I have:

before_filter [[:authenticate, :except => :new], :load_career]

def create
      # The following line is where the error originates
    @application = @career.applications.new(params[:application])

    respond_to do |format|
        ...
    end
end

private
def load_career
    @career = Career.find(params[:career_id])
end

The Career and Application models have has_many :applications and belongs_to :career respectively.

And the ‘*_create_applications’ migration has a career_id field.

  • 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-22T14:17:49+00:00Added an answer on May 22, 2026 at 2:17 pm

    I have never seen before_filters defined that way. I just tried it in Rails 3 and it doesn’t seem to do anything. I would give each callback it’s own before_filter call:

    before_filter :authenticate, :except => :new
    before_filter :load_career
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to create nested resources where the sub-resource doesn't have an existence
I have the following nested resources in my routes.rb file. The inner resource specifies
I have a nested route as: resources :wsps do member do get :location get
I have nested dictionaries: {'key0': {'attrs': {'entity': 'p', 'hash': '34nj3h43b4n3', 'id': '4130'}, u'key1': {'attrs':
I'm using Rails 2. I have resources nested like this: - university_categories - universities
In Rails 3 edge, I have set up two nested resources like this: config/routes.rb
I have a resourceful route, with a post route nested within it: resources :groups,
I have gone through tons of the form_for nested resource questions and can't get
I have a set of nested resources -- :users and :messages. resources :users, :only
I have a Problem with Nested Resources. 2 Models User => has_many :stuffs Stuff

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.