search for: student_id

Displaying 17 results from an estimated 17 matches for "student_id".

2006 Jan 18
5
Inserting the parent Id to the child table
Hi All, I need your suggestions for the following. I am still learning RoR and pardon my ignorance. I have say two tables. Table A : students Table B : addresses Table B has student_id as the foreign key to Table A If I am displaying the list of students and wanted to get individual students addresses based on their id, is the only option is to get the id from students controller method list into the session and use that session value to populate the student_id in the addresses...
2011 Jan 15
3
has_many :through with Single Table inheritance
...ike parent/child, friend/friend, husband/wife etc. With the above setup when I go to console I get the following >> c = Student.find(144) => <Successfully get the Student object> >> c.parents ActiveRecord::StatementInvalid: Mysql::Error: Unknown column ''relationships.student_id'' in ''where clause'': SELECT `users`.* FROM `users` INNER JOIN ` relationships` ON `users`.id = `relationships`.user_id WHERE ((`relationships`.student_id = 144) AND ((related_as = ''child''))) AND ( (`users`.`type ` = ''Parent'' ) ) The...
2010 Dec 24
1
Running scripts in hadoop
R-help group, I'm looking for some assistance on using an R-script to read STDIN from hadoop. Example, say I have two tables. One is a student table, the other is a class roster table (tables join on student_id). Student SAT score is in the student table, whether the student passed or not is in the roster table. So to determine if a student passed or failed based on their SAT score, I'd run this: SELECT student.SAT, roster.pass FROM student JOIN roster ON student.student_id=roster.student_id Easy en...
2006 Jan 04
4
HOWTO: Render partial in div
...start_form_tag :action => ''search'' %> Enter Student Name: <%= text_field_with_auto_complete :student, :full_name %> <%= submit_tag "Get Student Records" %> <%= end_form_tag %> # CONTROLLER def search # Get all the PLogs associated with user_id, student_id studentid = params[:student] fullname = studentid[:full_name] name = Student.find_by_full_name(fullname) @archives = PhoneLog.find(:all, :conditions => ["user_id = ? AND student_id = ?", @session[''user''].id, name.id]) # Render the tabs render :partial =>...
2007 May 14
0
building and saving has_many and has_one relations
...ing the belongs_to side. It''s a somewhat long post. so please bear with me :) First let''s consider the has_one scenario. Let''s say I have a student who must own exactly one car: class Student has_one(:car) end class Car belongs_to(:student) validates_presence_of(:student_id) end When I do student = Student.new(attributes_of_student) car = student.build_car(attributes_of_car) The car is created, and I can do: student.save! car.save! I don''t understand why build_car also assigns the car to the student. According to the docs [1], build is an equivalent, in...
2006 Apr 09
1
Join using :THROUGH - SQL is wrong even when using :SOURCE
Here''s a join table for an educational institution: create_table "student_appointments", :force => true do |t| t.column "supervisor_id", :integer, :default => 0, :null => false t.column "student_id", :integer, :default => 0, :null => false t.column "course_id", :integer, :default => 0, :null => false [other columns omitted for clarity] end It is meant to be created when a student is accepted as a participant of a course and also records the student''s...
2013 Jun 22
4
ActiveRecord::Base.transaction - SystemStackError - stack level too deep:
...to figure out how to pass exception message back to controller return @resource.errors end end end end Resource Model class Resource < ActiveRecord::Base include TransactionAttributes attr_accessible :resource_name, :resource_type, :source_id, :teacher_id, :student_id, :success, :errors belongs_to :teacher, :class_name => "Teacher", :foreign_key => "teacher_id" belongs_to :student, :class_name => "Student", :foreign_key => "student_id" has_many :resource_documents # has_many :resource_images # has_many :reso...
2006 Jan 17
6
An object that initializes multiple objects?
Hi, Something that I have noticed is that every class that inherits from ActiveRecord::Base has a database table of its own. However what if I don''t want a class to have its own table, but to actually serve as a proxy to initialize other entries? For instance as an example, let''s have a form with the fields for "student name", "student id number",
2006 Apr 16
1
Design question: Years/Teams/Students
...and middlename but a student can also have many teams (eg summer/winter abd over a number of years) . . Is there a problem with this? Doesn''t it just mean that there will be a student table with: id lastname firstname middlename and a separate "studentteams" table with: id student_id team_id ? Thanks, Phil. -- Philip Rhoades Pricom Pty Limited (ACN 003 252 275 ABN 91 003 252 275) GPO Box 3411 Sydney NSW 2001 Australia Mobile: +61:(0)411-185-652 Fax: +61:(0)2-8221-9599 E-mail: phil@pricom.com.au
2005 Oct 05
0
has_and_belongs_to_many on legacy DB
...t has_and_belongs_to_many Teachers. This is mapped via table student2teacher where the foreign keys are studentId and teacherId. The primary key in Student is studentId, and in Teacher is teacherId. However, when I run my unit tests I am getting this error: Mysql::Error: Unknown column ''j.student_id'' in ''where clause'' This is confusing, because I explicity specify that the association foreign key is studentId, not student_id. Any idea what I''m doing wrong here? Thanks. Student < ActiveRecord::Base set_table_name :student set_primary_key :studentId has_a...
2006 Jan 06
0
Rails ActionWebService and gSOAP interoperability problem
...a little too heavyweight due to its reliance on libwww. I''d appreciate some help. -- G. > Processing FeePaymentsController#api (for 10.0.0.5 at 2006-01-06 > 23:26:39) [POST] > Parameters: {"<SOAP-ENV:Envelope><SOAP- > ENV:Body><n1:FindStudent><student_id>0</student_id></ > n1:FindStudent></SOAP-ENV:Body></SOAP-ENV:Envelope>"=>"", > "action"=>"api", "controller"=>"fee_payments"} > > > RuntimeError (No valid method call - missing method name!)...
2006 Jan 07
0
gSOAP and ActionWebService interop problems
...XML-RPC library seems a little too heavyweight due to its reliance on libwww. I''d appreciate some help. -- G. Processing FeePaymentsController#api (for 10.0.0.5 at 2006-01-06 23:26:39) [POST] Parameters: {"<SOAP-ENV:Envelope><SOAP-ENV:Body><n1:FindStudent><student_id>0</student_id></n1:FindStudent></SOAP-ENV:Body></SOAP-ENV:Envelope>"=>"", "action"=>"api", "controller"=>"fee_payments"} RuntimeError (No valid method call - missing method name!): /opt/local/lib/ruby/...
2008 Apr 11
2
Validating an ActiveRecord object and its has_many :through associations
...eca''s and again from classes. i would like to handle this through a validates_associated so that the Student is validated whenever an association is changed or added. However, I can''t see how this would work. To illustrate: >>ss = StudentsSchool.new(:school_id => 1, :student_id => 10) => #<StudentsSchooll>... >>ss.student => #<Student>... >>ss.student.students_school => [] So the ss is still a temporary object that won''t be seen in the Student validation. Can anyone share some ideas? --~--~---------~--~----~------------~-----...
2006 Jun 30
2
has_many through - getting the parent
has_many :through is great. Is there anyway to find the association that it went through? Example: class Student has_many :projects has_many :grades, :through => :projects end student.grades[3].project Is it clear what I''m asking? How would this be done? -- Posted via http://www.ruby-forum.com/.
2006 Apr 20
3
has_many :through with has_many/has_many join models
It seems that using a join model that joins with two has_many''s will fail to generate proper SQL class StudentSemesterRecord < ActiveRecord::Base belongs_to :semester has_many :discipline_records, :through => :semester end class Semester < ActiveRecord::Base has_many :student_semester_records has_many :discipline_records end class DisciplineRecord <
2007 Feb 13
5
default database schema and relationships
hi everyone.. i''m a high school teacher who wrote a webapp in PHP and MySQL for my curriculum.. i use it to keep attendance, take notes per student or class and keep track of activities. i would like to soup it up and have read both the pickax and version 2 of agile web dev... now i''m starting to work and i''d like to rename columns and relationships in the database so
2009 Feb 27
3
Making tapply code more efficient
Previously, I posed the question pasted down below to the list and received some very helpful responses. While the code suggestions provided in response indeed work, they seem to only work with *very* small data sets and so I wanted to follow up and see if anyone had ideas for better efficiency. I was quite embarrased on this as our SAS programmers cranked out programs that did this in the blink