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. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Please guys reply. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
On 18 August 2010 00:11, Allspam Only <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> 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.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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
> 4) Edited the models/course.rb to > has_many :studets, :through => :enrollmentsCheck your spelling. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Thanks. I understood the models and controllers. I''m not able to understand how to add the code when it comes to enrolling students. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
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 marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.