ActiveRecord has_one and has_many relation with the same :foreign_key?

Relying on the code == '1a' to find the first chapter is a bit wonky. I'd probably add a flag to the chapters table like 'first_chapter' or something that was true or false indicating whether it was the first chapter. This way the first_chapter-ness of a chapter would survive a change to the code field, but this is a bit nitpicky.

Relying on the code == '1a' to find the first chapter is a bit wonky. I'd probably add a flag to the chapters table like 'first_chapter' or something that was true or false indicating whether it was the first chapter. This way the first_chapter-ness of a chapter would survive a change to the code field, but this is a bit nitpicky.

Also, to avoid repeating yourself, you could change the declaration of has_one :start to something like: has_one :start, :through => :chapters, :conditions => { :code => '1a' }.

Oh, I didn't know :through could be used not only for join models, but also subsets. That's definitely cleaner. – Kristóf Marussy Dec 11 at 11:47 ...except that CanCan suddenly stopped working after I re-created my development database.

If I revert to the more verbose association, it's all good again. How odd. – Kristóf Marussy Dec 11 at 12:17.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions