Displaying 20 results from an estimated 6000 matches similar to: "Nuby: HABTM and drag-and-drop views"
2006 May 12
2
How to declare several HABTM-relationships?
Hello,
Is it possible to have several HABTM-relationships for the same object?
Example: Imagine I have 3 objects (classroom, student, teacher) and
define the associations for the student as:
class Student < ActiveRecord::Base
has_and_belongs_to_many :classrooms
has_and_belongs_to_many :teachers
class Classroom < ActiveRecord::Base
has_and_belongs_to_many :students
class Teacher <
2005 Dec 29
4
Many-to-Many: Where to add the children?
I have two classes Person and Job defined as follows:
class Person < ActiveRecord::Base
:has_and_belongs_to_many jobs
def add_job(job_name)
job = Job.find_by_name(job_name) # See if this job exists
if job.nil? # If this job doesn''t exist
job = Job.new # Create a new job
job.name = job_name #
2015 Jul 13
2
Crear datos aleatorios con restriciones
Hola,
Esta pregunta la hice en stackoverflow
<http://stackoverflow.com/questions/31137940/randomly-assign-teachers-to-classrooms-imposing-restrictions/31143808#31143808>pero
nadie pudo contestarla.
1. Quiero generar N escuelas, con G grados y C divisiones.
2. Quiero asignar cada uno de T maestros a 2 divisiones en un grado y
escuela
Si tengo C=4 divisiones, puedo lograr lo que quiero con
2015 Jul 13
2
Crear datos aleatorios con restriciones
Hola,
0. La falta de 'elegancia' hace que sea mas dificil hacer cambios al
codigo. Por ejemplo cambiar n.classrooms <- 4 a n.classrooms <- 20
1. Cuando tengo solo 4 puedo hacer esto:
schoolGrade$A <- Teachers$Teacher.ID[1:cuttoff1]
schoolGrade$B <- Teachers$Teacher.ID[1:cuttoff1]
schoolGrade$C <- Teachers$Teacher.ID[(cuttoff1+1):n.teachers]
schoolGrade$D <-
2015 Jul 13
2
Crear datos aleatorios con restriciones
Gracias Carlos,
Tu codigo es un gran paso en el sentido correcto pero no produce
exactamente lo que estoy buscando.
Mi "solucion" en stackoverflow
<http://stackoverflow.com/questions/31137940/randomly-assign-teachers-to-classrooms-imposing-restrictions/31143808#31143808>
produce un data frame `schoolGrade` con 240 observaciones y 7 variables. Mi
objetivo es poder generar un data
2015 Jul 13
2
Crear datos aleatorios con restriciones
Perdon por no se lo suficientemente claro :(
Tu codigo produce `validPairs` que tiene 7 variables y 360 observaciones.
Donde
> validPairs[1,] V1 V2 V3 V4 V5 V6 valid
60 e1 g1 c1 e1 g1 c2 Valid
indica que un maestro tiene asignado c1 y c2 en la escuela e1 y el grado
g1. Correcto? Si es asi, esto es casi lo que queira producir y creo que
puedo llegar a donde quiero usando tu codigo de base.
2006 Jan 23
3
create and update with has_many :through
I''m using Edge Rails and the new has_many :through in my code. What
I''m trying to do is modify my create and update code to use the new
relationships. I''m using a table called course_teachers for the joins.
Here is what I have so far:
def create
@course = Course.new(params[:course])
@teacher = Teacher.find(params[:primary_teacher])
@course.teachers =
2010 Nov 04
9
Delete action is not working and redirects to edit action
Hello,
i have a strange problem here. I have made a teacher controller using
scaffold. All actions work fine but the delete does not. When i click
the delete link, it redirects me to the edit of this teacher. I have
restarted the server and i have tried in firefox (i use chrome) but
problem still remains. Here is the code from my view.
<%= link_to(image_tag("/images/
2006 Aug 03
12
More than one has_many :through association between the same 2 models
I wonder if you can have more than one has_many :through association between
2 models.
For example...
I have a model Teacher and a model Class
Now, 1 Teacher works in many Classes, right?. So I need a join model like
class Work < ActiveRecord::Base
belongs_to :teacher
belongs_to :class
end
But I also would like to know if a teacher CAN teach a class before I
2008 Aug 01
2
Is this a many to many relationship??
So i have one table of data, each data object has two owners from the
users table.
so it''s
data table
id owner1_id owner2_id
---------------------
5 1 2
10 1 2
owner table
id name
---------------
1 bob
2 cornholio
so when i pull records from the data table for owner1_id how would i
access the name field of owner id 2?
--
Posted via
2006 Feb 20
0
No Magic for HABTM forms?
Hi,
I posted yesterday asking how to get form tags to reference the
associated objects in a habtm relationship. I was hoping for Rails
Magic, but it looks like Rails doesn''t have habtm magic beyond a
certain point.
Here was my solution for others who might have the problem. Also, I
hope someone shows me that there is a simpler way.
The Database Model:
class Registration <
2003 Jun 19
2
Fitting particular repeated measures model with lme()
Hello,
I have a simulated data structure in which students are nested within
teachers, and with each student are associated two test scores. There
are 20 classrooms and 25 students per classroom, for a total of 500
students and two scores per student. Here are the first 10 lines of
my dataframe "d":
studid tchid Y time
1 1 1 -1.0833222 0
2 1 1
2006 Mar 13
3
HABTM: two habtm''s between the same two tables
Imagine I want to track people, and the clubs that they belong to.
table people with columns person_id, person_name
table clubs with columns club_id, club_name
And I have the association table:
table clubs_people with columns person_id, club_id
Now I know how to do this habtm between the two, in order to associate
people with clubs that they belong to.
However my application also needs a
2004 Jul 05
1
on the fly access and privilege determination
Hi,
I have a active directory domain of windows 2000.
inside AD i have three user groups. Teachers, students
and administration.
every user has his home directory created on the
fly. the umask is 0022.
now what i want is that apart from users accessing
there home directories there should be some other
folders too which they can access.
like teachers would like to access the
2006 Aug 24
1
Strange permissions problems
I had this problem some last year and never got it figured out. Now it
is bugging me. It seems that sometimes when a student writes his/her
file to a directory, it will not keep the correct group. It puts
his/her main group as the group owner and that fouls things up. Here is
what I have.
Unix Permissions
/school 3777 admin.teacher
/school/bhs 3777 admin.teacher
/school/bhs/reese
2006 Feb 28
8
HABTM count table
Hello,
I have a question about HABTM and counting records.
I have these models
class Sort < ActiveRecord::Base
has_and_belongs_to_many :reports
end
class Report < ActiveRecord::Base
has_and_belongs_to_many :region
has_and_belongs_to_many :subjects
has_and_belongs_to_many :sorts
end
And i would like to get a count like
@sort.reports.count
The problem is get this query:
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 Feb 19
4
Multiple HABTM to one table
I have a class Player, and a class Game.
Game has two HABTM relationships to the Player table through seperate
relationship tables.
class Game < ActiveRecord::Base
has_and_belongs_to_many :players, :uniq => true
has_and_belongs_to_many :victors, :class_name => ''Player'', :uniq => true
end
When I add Player A to players, and Player B to victors, and save the
2008 Dec 09
4
HABTM checkboxes insert but don't delete
I have a problem related with the HABTM relationships with checkboxes.
I''ve got a profile and a service model, both related with
has_and_belongs_to_many.
The problem is that i can insert new data in the profiles_services
table, however, i cant delete already existing data.
What could be the problem?
--~--~---------~--~----~------------~-------~--~----~
You received this message
2006 Mar 27
1
Best way about doing this?
Hi All,
I''m super a super ruby nuby, so bare with me. I am working on a small
app that has a particular form that I am having a rough time figuring
out the best to way to handle.
Basically here it is, each school has one or more classrooms, and each
classroom can have one or more teachers.
Here''s what I am trying to do (edit a school):
- click on a link to edit a School
-