Displaying 11 results from an estimated 11 matches for "course_id".
2005 Apr 20
2
Has And Belongs To Many Validations
Here is the schema that I am working with:
courses -> courses_teachers <- teachers
I want to ensure that a teacher is not assigned the same course more
than once. In other words, if I''m in the courses_teachers table as
teaching Spanish 101, if someone tries to add that same teacher/course
combination to the table again, it will not be allowed.
I thought I could use something
2006 Jan 22
2
Relationship not working
Hi all
I''m in the process of trying to make my first project on Rails after
doing the tutorial in AWDR. I picked a project which I thought would be
easy as I already have the PHP/MySQL implementation. Unfortunately I''ve
now hit a snag and was wondering if you could help?
I have a table called "races" and a table called "courses". The
relationship is:
2007 Dec 02
3
Better way for select list for belongs_to?
I''m currently doing all of this just to have a drop-down list of
Courses for a particular student:
===== edit template =====
<%= f.select :course, @courses, :selected => @student.course.id %>
===================
===== students controller =====
def edit
@student = Student.find(params[:id])
@page_title = "Edit #{@student.full_name}"
@courses =
2006 Apr 20
4
Question about Associations
...rse. There are a fixed number of schools (set
up in the migration). Each course is assigned a school and a school
will be associated with multiple courses...
How do I set up the associations? Do (can) I have School :has_one
:course and Course :has_many :schools?
Does the schools table then get a course_id field or the other way around?
I don''t think I should have course :belongs_to School, as there will
only be one instance of a school in the Schools table.
Thanks!
jt
2013 Apr 02
4
gmaps4rails: undefined method `model_name' for NilClass:Class
...;
<%= f.label :name %><br />
<%= f.text_field :name %>
</div>
<div class="field">
<%= f.label :coordinates %><br />
<%= f.text_field :coordinates %>
</div>
<div class="field">
<%= f.label :course_id %><br />
<%= f.number_field :course_id %>
</div>
<div class="field">
<%= f.label :college_id %><br />
<%= f.number_field :college_id %>
</div>
<div class="actions">
<%= f.submit %>
</div&...
2006 Apr 05
4
Self-referential join creation/deletion and :through
...id''
belongs_to :course, :class_name => ''Course'', :foreign_key =>
''corse_id''
end
class Course < ActiveRecord::Base
has_many :requisite_courses, :class_name => ''CourseRequisite'',
:foreign_key => ''course_id''
has_many :requisites, :through => :requisite_courses, :source =>
:requisite
has_many :courses_requiring, :class_name => ''CourseRequisite'',
:foreign_key => ''requisite_id''
has_many :requisite_for, :through => :courses...
2006 Apr 09
1
Join using :THROUGH - SQL is wrong even when using :SOURCE
...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 supervisor. Its model is defined
as:
class StudentAppointment < ActiveRecor...
2011 Aug 19
0
find_by_sql Method
...how to restructure my query will be highly appreciated.
Here is my query!
<%= select ("course_code", "course_name",Course.find_by_sql("select
i.name, c.course_name from institutes as i, courses as c ,
institute_courses as ic where i.id = ic.institute_id and c.id =
ic.course_id and i.id = 1;").collect {|c| [ c.course_name, c.id ] })%>
--
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-/JYPxA39Uh5TLH3Mb...
2006 May 10
2
HABTM - How do I do a select box for this?
...e courses, each individually selected from a drop-down select
box:
Student: John
Course 1: (select box)
Course 2: (select box)
Course 3: (select box)
I tried the following for my select box code in my view (this is
pseudo-code, I don''t have the source with me):
<% select :student, :course_id, Course.find(:all) %>
The error I''m getting is with the second parameter above. I think I''ve
got that wrong. Is there any way to do what I''m doing? I think the
problem is that I don''t understand how to modify a collection of many
courses when I''ve...
2008 Aug 31
6
why's my course_duration being reset
...:firstname,
:surname,
:address1,
:phone,
:country,
:nationality,
:course_duration,
:english_level,
:course_id,
:accomodation_id,
:message => "can''t be blank"
validates_format_of :email, :with => RFC2822::EmailAddress
end
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received...
2011 Sep 25
4
checkbox use question
Hi,
how can I use checkbox in a form to show all customers from table
customers,
Course Users Customers
========= ========= =============
user_id customer_id Customer_name
I would like to select customers from the checkbox list, then add to the
course table only users of the selected customers.
thanks dani
--
Posted via http://www.ruby-forum.com/.
--
You received