Finne Jager wrote in post #971329:
>> Still using the data model I advised you against, I see...
>
> Yes, unfortunately my boss has been pushing to get a first version
> online within two weeks. I've decided to use this current structure for
> now and then restructure after launch.
I advise against this course of action in the strongest possible terms.
Normalizing the schema will be easy. Refactoring the application code
will be easy if you have proper tests. But normalizing the data already
entered into the denormalized schema will be nearly impossible.
This is one of those things that you want to get right the first time.
Normalize your schema. It's easier to denormalize later than to
normalize later.
>
>> ...but in any case, I think you want @timesheet.fire_fighters.create,
>> not @timesheet.create_fire_fighter , which doesn't exist on has_many.
>
> Thanks, I did not know that 'create_modelname' was only available with
> has_one relationships.
Did you check the docs? :)
>
>>> I tested it with the console, Tiemsheet.last.fire_fighters returns an
>>> empty array []
>>
>> You do know that Timesheet.last will return an arbitrary timesheet, and
>> that you can't predict which one it returns, right?
>
> Yes, I was just using that to test if the association was working
> correctly.
OK. You'd probably be better served to get good automated tests
working.
Best,
--
Marnen Laibow-Koser
http://www.marnen.org
marnen@marnen.org
Sent from my iPhone
--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment