Displaying 20 results from an estimated 1000 matches similar to: "team captain - habtm w/has_one..."
2006 Apr 03
2
HABTM migrations
Bad rails day for Matt-
In a migration, for a habtm:
create_table :teams_users do |t|
t.column :team_id, :integer
t.column :user_id, :integer
end
Ok, fine. In a controller (well really a migration script):
@user.teams << Team.find( 3 )
And the SQL pumped at my server is:
INSERT INTO teams_users (`team_id`, `id`, `user_id`) VALUES (3, 3, 34)
Which
2006 Sep 28
5
Eager loading using find_by_sql
Here''s the problem I have the following models
User - is a person
Team - is a team
Wherenote - snipet of info about a user''s whereabouts on a certain day
Team has_and_belongs_to_many :users
User has_and_belongs_to_many :teams
has_many :wherenotes
Wherenote belongs_to :user
each Wherenote has a note_date
On one page I want to pull back all the Users from a particular Team
2006 Jan 31
1
Updating :has_many - :through related items
Hi,
I''ve got my little app working pretty well. I''m using pretty much the
model and table layout from my previous thread, as suggested by Bill
Katz:
<http://www.ruby-forum.com/topic/52506#26260>
I have the Create page working and a delete Match page working, which
along with the appropriate record in the Matches table, removes the
linked items in the competitions table.
2009 Jul 29
5
[newbie] double relationships in database
I have the following tables
teams
id :string
name :string
and
matches
id:
home_team :team_id
visitor_team :team_id
how can I reflect that kind of relationship in a RoR model?
thanks and keep up the good work.
2005 Dec 31
6
habtm recursion via destroy_without_callbacks
I am having a problem with two models that each have a HABTM
relationship to the other. For example:
CREATE TABLE people (id INT, name TEXT);
CREATE TABLE teams (id INT, name TEXT);
CREATE TABLE people_teams (person_id INT, team_id INT);
The person model has:
has_and_belongs_to_many :teams
And the team model has:
has_and_belongs_to_many :people
The trouble comes when trying to destroy
2006 Jul 18
1
Saving an ActiveRecord object
I get this error when I try to save an object that extends of
ActiveRecord:
NoMethodError in TeamController#add_player
You have a nil object when you didn''t expect it!
The error occured while evaluating nil.keys
....
....
#{RAILS_ROOT}/app/models/player.rb:17:in `create_player''
#{RAILS_ROOT}/app/controllers/team_controller.rb:53:in `add_player''
And my Player model
2009 Jun 25
7
Join Tables
I just have a few questions about join tables. From my understanding
the following applies (correct me if I''m wrong):
1.Join tables are always named with the names of the two associated
tables, in alphabetical order, separated by an underscore.
2.The foreign key fields are named with the name of the table they are
referencing, with _id appended.
3.The foreign key is referencing a
2007 Mar 19
1
Why is app defaulting to Captain Podd font?
I'm running Personal Ancestral File (PAF) 5.2 under Wine
0.9.26, and it defaults to the bizarre "Captain Podd" font
as its default screen and print font. It appears there are
no knobs or registry entries to override this default font
for some things when printing.
My Wine is compiled from source to include the patch fix for
bug #5669 (unrelated to fonts and printing). I'm
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
2006 Jun 22
4
Filter on variable
Hi all,
I have a question about filtering on a variable.
If I have the following code in my controller to select a list of
users
> @allusers = User.find(:all,
> :conditions => [''team_id = ?'', @params["id"],
> :order => ''created_at'')
Is there an easy way to find out all users who
2010 Jan 25
0
has_many, :finder_sql, setting attributes
Hi all,
My question is somewhat complicated, but bear with me. My project has a
number of models: User, Program, and Team. Users belong to multiple
Programs. Programs have multiple teams, but Teams belong to one
program. For each Program a User belongs to, he can belong to multiple
Teams. (Think of this in an athletic context where users are athletes,
programs are universities). So my
2008 Jan 27
4
(REST) Nested routes
Hello, I''m in troubles with nested routes. I have three models: Team,
Tournament and TeamTournaments
class Team < ActiveRecord::Base
has_many :tournaments, :through => :team_tournaments
has_many :team_tournaments
class TeamTournament < ActiveRecord::Base
belongs_to :team, :foreign_key => ''team_id''
belongs_to :tournament, :class_name =>
2006 Jul 28
2
has_many :through with multiple paths
Hi all.
I am currently thinking about how to do the following:
I have the following models.
Team
Person
Team has various positions (manager, programmer etc.) I would like each
one of those positions to reference one or more Person records. A single
Person record could be on 6 different teams at the same time in
different roles. the same person could even be on the same team multiple
times
2009 Jul 16
9
Please help me understand how arrays are translated in rails
I''ve spent hours researching the subject and have tried many test
sequences in IRB, and rails console but I''m just having trouble making
headway into what is probably a very easy subject.
I understand arrays with at least 4 other languages but with Ruby I
haven''t found a mental connection with how I can assign variables to
arrays..
Take for example:
def
2006 May 14
3
Strange Database Mapping Question
Dear Rails List,
I am new on the list so will assume straight away that this question has been
answered before. As I can see no immediate way of searching the list, I will
ask the question. I apologize in advance for any disruption this may cause.
Question time:
I am trying to write a web application for the staff at my office to play a
form of virtual Super14. Its a bit like any of the
2008 Sep 17
0
permalink_fu and classes with different primary_key than id?
Has anyone else had problems with this scenario?
class Team < ActiveRecord::Base
# Primary key
self.primary_key = ''team_id''
has_many :players, :foreign_key => :team_id
has_permalink :city, :param => true
end
I am getting all kinds of trouble - that goes away if I comment out
the has_permalink declaration.
With PermalinkFu:
>> fs = Team.new
=>
2009 Jul 17
19
I need help saving table data from a rake task
I need to find out how I can create and save a large dataset to a table
based on multiple returned arrays from a Rake task.
Here is my example using just two arrays (there are 14 in this
particular rake task):
update_tsos_offense = TsosOffense.new
to_team_id, to_ppcs = update_tsos_offense.calculate_tsos(TotalOffense,
"ydspgm", "desc")
ro_team_id, ro_ppcs =
2014 Mar 31
0
DIPON^ Captain America: The Winter Soldier (2014) Full Movie Free Download
Captain America: The Winter Soldier (2014) Full Movie Free Download:
http://captainamerica.metroblog.com/
https://www.facebook.com/captainamericathewintersoldiermovie
http://tweetvite.com/event/captainamericathewinter
HELLO Movie LOVERS!!! Welcome to download and watch here Captain
America: The Winter Soldier (2014) Full Movie Free online HD Quality.
Hope you will really enjoy this New movie
2020 Oct 02
3
Lahman Baseball Data Using R DBI Package
I?m trying to pull data from one table (batting) in the Lahman Baseball database. Notice X2B for doubles and X3B for triples ? fourth and fifth from the right.
The dbGetQuery function runs fine when I leave there two out but I get error messages (in red) when I include 2B/3B or X2B/X3B.
Can anyone give me some direction?
Thanks,
Philip Heinrich
2011 May 19
0
Re: broken controls in "Captain Claw" game
Running "xset r off" has no effect to Claw :(