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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T19:41:35+00:00 2026-05-20T19:41:35+00:00

I have these three models. Student. Evaluation. Grade (student_id, evaluatioin_id, value) I want to

  • 0

I have these three models.

Student.
Evaluation.
Grade (student_id, evaluatioin_id, value)

I want to make a form so that a User can set the grade for each student of a evaluation…

I want to keep this is as clean as possible (and restful)…

Im open to any suggestions on how to get this done.

Please Help.

  • 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-05-20T19:41:36+00:00Added an answer on May 20, 2026 at 7:41 pm

    What I ended up doing was..

    In Grade Model

    scope :for_student,lambda{|student, evaluation| where("student_id"=>student.id).where("evaluation_id"=>evaluation.id)}
    

    In EvaluationsController

    def assign_grades])
        @evaluation = Evaluation.find(params[:id])
        @students = Student.all  
        @students.each do |s|
          grade = Grade.for_student(s,@evaluation)
          if !grade.exists?  
           @evaluation.grades.build(:value=> 0,:student_id=>s.id)       
          end   
        end
      end
    
      def save_grades
        @evaluation = Evaluation.find(params[:id])
        @evaluation.update_attributes(params[:evaluation])
    
        redirect_to [@evaluation.batch_subject, @evaluation]
    
      end
    

    In View

    <table class="medium">      
    <thead>
       <tr>
       <th>name</th>
       <th>Grade</th>
       </tr>
    </thead>
    <tbody>
       <%=f.fields_for :grades do |g|%>
        <tr>
          <td><%=g.label :value,g.object.student.full_name%> <%= g.hidden_field :student_id%></td>
    <td><%=g.text_field :value%></td>
    </tr>
    <%end%>
    </tbody>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Suppose I have three models: Student , SchoolClass , and DayOfWeek . There is
I'm using rails 3.0 and MySql 5.1 I have these three models: Question, Tag
I have the following models in an app. Lesson Student Evaluation Parent Lesson and
I have three Django models that exist in a hierarchy: Protocol -> has Test
Let us suppose i have these three methods defined: int F1(int, int); int F1(float,
I have three tables (lots in reality but these three are the ones I
I have an iphone app where I call these three functions in appDidFinishLaunching: glMatrixMode(GL_PROJECTION);
Anyone have any comparative thoughts on these three technologies? Each addresses a different VM,
I've got these 5 models: Guardian, Student, Relationship, RelationshipType and School. Between them, I've
I have 3 models: Student, Course and StudentCourse. Course 'hasAndBelongsToMany' Student, Student 'hasMany' Course,

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.