Student-course system

Hi, I’m a newbie, and I have a basic question. Please help me out with
this.

I’m trying to create a system for the student-course enrollment
management.
These are the steps I’ve followed so far

  1. rails App
  2. script/generate scaffold Student name:string email:string
  3. script/generate scaffold Course name:string section:string
  4. Edited the models/course.rb to
    has_many :studets, :through => :enrollments
  5. Edited the models/course.rb to
    has_many :courses, :through => :enrollments
  6. Created script/generate model Enrollment
  7. Added to the models/enrollement.rb
    belongs_to :student
    belongs_to :course
  8. script/server
  9. Added students to students table from localhost:3000/students
    10)Added courses to courses table from localhost:3000/courses

Now,
-I need to make enrollment have “enrolled_on” field.
-Add functionality to enroll a student to a course and
-Show the students enrolled in a particular course
Please suggest me ways to do this.

Please guys reply.

On 18 August 2010 00:11, Allspam O. [email protected] wrote:

  1. Edited the models/course.rb to

Now,
-I need to make enrollment have “enrolled_on” field.
-Add functionality to enroll a student to a course and
-Show the students enrolled in a particular course
Please suggest me ways to do this.

I suggest that you start by working through all the Rails Guides at
http://guides.rubyonrails.org/, starting with Getting Started
obviously. The one on Database Migrations will show how to add new
fields to a table. The ones on Layouts and Rendering and on Action
View Form Helpers will help you to develop the views and forms for
enrollment.

Do read the others also however. Not forgetting the one on Testing
Rails Apps. In fact if you have not got automated tests yet then
start with this one and incorporate tests before moving on.

Also if you are not already using a version control system then have a
look at git (or one of the others) and start using it. Then move on
to the tests and then enhancements.

Then there are many tutorials on the web which will help, but make
sure they are for the current version of rails as out of date
tutorials will only confuse. I think http://railstutorial.org/ is
good.

Colin

Thanks. I understood the models and controllers. I’m not able to
understand how to add the code when it comes to enrolling students.

Prash Padm wrote:

Thanks. I understood the models and controllers. I’m not able to
understand how to add the code when it comes to enrolling students.

Then you need to read the Rails associations guide. Then write some
Cucumber stories and try it!

Best,

Marnen Laibow-Koser
http://www.marnen.org
[email protected]

  1. Edited the models/course.rb to
    has_many :studets, :through => :enrollments

Check your spelling.