Displaying 20 results from an estimated 300 matches similar to: "An object that initializes multiple objects?"
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
2006 Jun 03
8
confused about ActiveRecord relationships
I am very confused about where to put the belongs_to and the has_one
(and other relationship identifiers). I have read the RDoc and the
agile book many times about this and I think i still see it backwards.
Let me outline my app so you have an understanding...
I have 2 tables:
Schools { id, school_name, address_id }
and
Addresses { street1, street2, city, state, zip, country }
*** this
2011 Jan 15
3
has_many :through with Single Table inheritance
I have the following model structure setup.
class User < ActiveRecord::Base
end
class Parent < User
has_many :relationships
has_many :children,
:class_name => "Student",
:through => :relationships,
:conditions => "related_as = ''parent''"
end
class Student < User
has_many :relationships
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
2006 Jan 04
4
HOWTO: Render partial in div
Hey-
I''m using ROR 1.0 and script.aculo.us 1.5.1. I''ve been trying
unsuccessfully to render a partial in a DIV, but can''t seem to get the
right combination of stuff to make it work. There seems to be a few
different ways of going about it. Right now I can render a partial.
What do I need to to render the partial in a div? Here is what it
looks like so far:
#
2006 Apr 04
5
Database usage technique -- user-specified fields
Hello folks-
In one particular app, it would be useful for the customers to be able
to specify the significance (and presence) of fields. For example,
consider a CONTACTs database. User 1 wants to have phone1, phone2,
phone3, and User 2 wants to have 4 address fields.
Generically, this could be done by having a CONTACT with, say, 10
strings, 10 integers, etc. The user''s account
2013 Jun 22
4
ActiveRecord::Base.transaction - SystemStackError - stack level too deep:
Im having an issue that seems to only happen when trying to use a
transaction. Ive used transactions many times in the past and Im at a loss
as to why im getting the stack level too deep problem.
SystemStackError - stack level too deep:
actionpack (3.2.13) lib/action_dispatch/middleware/reloader.rb:70:in `''
I have a StackOveflow with more detail -
2006 Apr 16
1
Design question: Years/Teams/Students
People,
I want to design a historical sports db for my old school. I think at
the moment it should be like:
A year has many teams
A team has many students
A student has one lastname, firstname 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
2008 Apr 11
2
Validating an ActiveRecord object and its has_many :through associations
Considering an object with several has_many :through => associations,
what is the ''best'' way to handle validations?
As an example:
class Student < ActiveRecord::Base
# some attrbutes like
# :name
# :grade
# relationships
has_many :students_assignment, :dependent => :destroy
has_many :assignments, :through => :students_assignment
has_many
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
2007 May 14
0
building and saving has_many and has_one relations
Hi,
I am very confused about an aspect of has_one and has_many relations,
with regard to using the build method, and saving 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)
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
2007 Feb 04
0
Very strange observe_form problem
I am doig something very simple here and this is not working correctly.
So any help is greatly appreciated.
I ahve this code in my template:
<% form_for :company_branch, @company_branch, :html => {:id =>
"company_branch_form"} do |f| %>
<%= f.text_field :street1 %>
<%= f.text_field :street2 %>
<% end %>
<%= observe_form("company_branch_form",
2007 Oct 11
0
display problem with to_csv
Hi all,
I need to export the document as csv file, i have exported
successfully, but the problem is not displayed as per my format, in csv
file the format is suffuled, i want the orderwise as how i have
mentioned in my query, please help me to come out in the order wise.
My coding is:
@report_data=EdiaUserContact.find_by_sql(
"SELECT '''' as ''Title'',
2005 Oct 05
0
has_and_belongs_to_many on legacy DB
I am working with mapping ActiveRecord onto a legacy database. All is going
well (using set_table_name, set_primary_key, etc), but I can''t get my
many<=>many relationships to work.
My contrived example of the situation:
Student 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
2006 Jan 18
22
Creating multiple child objects from the same form
I''ve been digging into rails, but this one question has been a two day
stumper. I''ve got a question/answer model that I''m trying to work out.
Each question has multiple answers (they''re more like choices, it
doesn''t matter whether they''re right or wrong), and I''d like to have the
question creation form also have multiple fields in
2006 Jan 06
0
Rails ActionWebService and gSOAP interoperability problem
Hi!
I''ve successfully created a Rails web service. I can connect to it
with an XML-RPC client, without any problems at all. However, when I
try to use a gSOAP application to connect to the web service, it
doesn''t work. The back trace that I get is at the end of this
message. From the back trace, it appears that the SOAP request is not
being recognized as a SOAP
2006 Jan 07
0
gSOAP and ActionWebService interop problems
Hi!
I''ve successfully created a Rails web service. I can connect to it with
an XML-RPC client, without any problems at all. However, when I try to
use a gSOAP application to connect to the web service, it doesn''t work.
The back trace that I get is at the end of this message. From the back
trace, it appears that the SOAP request is not being recognized as a
SOAP request, and