Displaying 5 results from an estimated 5 matches for "dog_id".
Did you mean:
doc_id
2006 Mar 17
2
Controller/View Organization (Newbie Question)
...ler for each of the auxiliary objects
(TrainingSessionsController, TestsController, etc), each with a view
to show information only relating to the current Dog in question. So
for example, the overview URL "/dogs/show/1" might link to a detail
page at "/training_sessions/list?dog_id=1" .. This seems ugly to me,
as I will need to keep passing around parameters in the URL wherever
I go to make sure we''re still working on the right dog. For example,
I''ll need to remember to pass ?dog_id=... to "/training_sessions/new"
so that dog_id in the...
2006 Feb 19
0
creating a model that has other models as elements
...cipie.
Now I want to create a model, Cookoff, that will contain arrays of
Dog, Cat and Recipie objects. There is no associated database table
for Cookoff because it''s merely a container for a specific request,
not an actual data item.
My users will submit a form with the following data:
dog_id: 10
cat_id: 12
A Cookoff instance will be created, with the following parameters:
- a Dog model object with data from the dogs table where id=dog_id
- a Cat model object with data from the cats table where id=cat_id
- a Recipe model object with data from the recipies table where the
recipie_text...
2006 Aug 16
3
AR: column methods?
...e column method on an object is accessed. So, how can one
override the default column methods?
For instance:
create_table "dogs", :force => true do |t|
t.column "color", :string
end
create_table "tails", :force => true do |t|
t.column "dog_id", :integer, :null => false
t.column "color", :string
end
If a dog''s tail indicates its own color, I want to use it. Otherwise,
the tail''s color is the same as the dog''s color:
class Dog < AR::Base
has_one :tail
end
class Tail < AR::...
2006 Feb 06
4
Relationship Question (STI)
...are unique enough to
break into their own models. I could use STI, but I think the table would
just have too many columns.
Now, I wanted to let the Dog''s, Whale''s and Monkey''s be buddies, and keep
track of their relationships.
I created a Buddies table (with monkey_id, dog_id, whale_id), and had
has_many relationships to link them all up.
This will work... however, if I wanted to list all of a Monkey''s Buddies...
it get''s tricky.
I have to query the Buddies table to get the relationships, then query both
the Whale and Monkey to get the appropriate obje...
2006 Feb 22
15
Fixtures and Relationships
In my daily development, I migrate back and forth between versions, and
often do: rake load_fixtures...
... in order to populate my development database with fun data.
Now, with any HABTM relationship, there are failures, as there is no way to
say "which" fixtures to load first.
Within an actual functional or unit test case, you could simply load them in
the proper order, but