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
- rails App
- script/generate scaffold Student name:string email:string
- script/generate scaffold Course name:string section:string
- Edited the models/course.rb to
has_many :studets, :through => :enrollments
- Edited the models/course.rb to
has_many :courses, :through => :enrollments
- Created script/generate model Enrollment
- Added to the models/enrollement.rb
belongs_to :student
belongs_to :course
- script/server
- 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.
On 18 August 2010 00:11, Allspam O. [email protected] wrote:
- 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]