J'essaie d'obtenir un peu plus de familiarité avec Rails/ActiveRecord. En essayant de faire ainsi j'essaye d'employer le concombre pour aider avec quelques essais de "découverte".Question sur le concombre/cornichon
Je donne les résultats suivants
Feature: Describing a task
In order to work with tasks
As a user
I want to be able to know what makes up a task and to improve my understanding of ActiveRecord
Scenario: A task has certain core fields
Given the following tasks exist
| id | name |
| 1 | some task |
And the following estimates exist
| task_id | hours | explanation |
| 1 | 8 | initial estimate |
| 1 | 6 | better undertsanding of task |
| 1 | 16 | no control over inputs to create task |
| 2 | 22 | for other task |
Then a task: "task" should exist with name: "some task" #this works
Then the estimate "estimate" should exist with explanation: "initial estimate" #this works
Then the estimate "estimate" should be one of task: "task"'s estimates #this works
Then the task "task" should have 3 estimates #this one fails
EDIT
Je n'ai pas pas de mesure - essayer d'utiliser l'utilisation ce qui sort de la boîte avec le concombre et cornichon (juste pour limiter ma confusion).
Les modèles sont
class Estimate < ActiveRecord::Base
belongs_to :Task, :class_name => "Task", :foreign_key => "Task_id"
end
et
class Task < ActiveRecord::Base
has_many :estimates
end
Quelqu'un peut-il me diriger dans la bonne direction (ou si je dois poster plus de code)?
Merci,
Joe
Pouvez-vous poster vos étapes/modèles pls. – jonnii
Ajouté Merci d'avoir regardé – Joe