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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T04:55:09+00:00 2026-06-07T04:55:09+00:00

In my rails app Users and Schools can create courses, and each course has

  • 0

In my rails app Users and Schools can create courses, and each course has one syllabus.

in my course model:

belongs_to :hostable, polymorphic: true
has_one  :syllabus

syllabus:

belongs_to :course

school (and user):

has_many :courses, as: :hostable, :dependent => :destroy

My routes are currently set up as follows:

resources :users do
  resources :courses 
  member do
   get :attending, :memberships
  end
end

resources :schools do 
  resources :courses 
  member do
    put :apply, :enroll
  end
end

resources :syllabuses

In my syllabuses controller I have:

def create
  @course = Course.find(params[:id])
  @syllabus = @course.build_syllabus(params[:syllabus])
  if @syllabus.save
    redirect_to @course, notice: 'Syllabus was successfully created.' 
  end
end

my courses controller has this:

def show
  @course = Course.find(params[:id])
  @school = Course.find(params[:school_id])
  @title = @course.title
  unless @course.syllabus
    @syllabus = @course.build_syllabus
  end
end

and my course view page has

<%= form_for (@syllabus) do |f| %>

  <div> <%= f.label :syllabus %> </div>
  <%= f.label :name %> 
  <%= f.text_field :name %> </br>
    ....

  <%= f.submit "Save Changes" %>
<% end %>

but when I try to create a syllabus from a course page inside of a school I get:

“Couldn’t find Course without an ID”

What am I doing wrong? How could I reconfigure my routes/models so that both Users and Schools can create a course, and then from within the course a syllabus can be created? I tried nesting the syllabus model under the course model with javascript but I had a few problems.

  • 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-07T04:55:11+00:00Added an answer on June 7, 2026 at 4:55 am

    Try nesting syllabus in your routing,

      resources :courses do 
         resource :syllabus
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I'm making a Rails app which allows Users to create Items, and each
I'm building a Rails 3 app where users can select one of a number
I have a Rails app where users can follow one another. I've just discovered
I'm working on a Rails app that existing users can invite additional members to
I have a Rails app where users can upload images. After they upload an
I have rails app which has a list of users. I have different relations
I have a Rails app with Users, and each user HABTM Roles. I want
I have a rails app that users can upload photos to. The photos get
Im working on an Occasion Reminder rails app where users can register then set
I've got a Rails app where users can send messages to other users. The

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.