Sunday, 15 May 2011

ruby on rails - NoMethodError undefined method -


calculate

I separate GPA in your major credit and non-core credit for working on a final class project Copy Page need I below as a controller, it works fine and major and non-major but when I code

@GPA_for_major = (course.credits * me course.grade Show total credit hours when I run this code .scale) / course.credits

If the statement I transcontroller # Undefined method
# course get NoMethodError the transcript 'credit' :: ActiveRecord_Relation: 0x00000007b99798>

  class Transcript def initialize (Kors_are) @ course = Kors_are @total_non_major_credits = 0 @total_major_credits = 0 @GPA_for_major = 0 @GPA_for_non_major = 0 item if @corse item.is_for_major @total_major_credits = @total_major_credits + item credit any other @total_non_major_credits = @total_non_major_credits + item.credits end end end DEF course @course end DEF total_non_major_credits @total_non_major_credits end DEF @total_major_credits End Def GPA_for_major @ GPA_for_major end def GPA_for_non_major @GPA_for_non_major finally end total_major_credits  

This is my copy page

  class TransController is & lt controller, ApplicationController def transcript @courses = Course.all @transcript = Transcript.new (@courses) end-end  

I'm not sure what to include and this is my first post, but there is no help because not much It's gonna be awesome! Thanks!

course refers to an array of courses and if Given statement within a loop that repeats the items to a local variable before set for each course that you should use instead definitely items:

  @GPA_for_major = (item.credits * item.grade.scale) / item.credits  

No comments:

Post a Comment