Adam Akhtar wrote:
> Hi again, thanks so much for your help i really appreciate it. I wanted
> to write another association like you said before but there is no
> Alphabet_Partner class to write it in. Its just a self reference to
> Alphabet table.
[...]
You don't need an AlphabetPartner class
Thanks again.
Ok i know why your saying to have a consistent sorting method, its so as
to avoid a duplicate situation i.e. if i always sort by the letter and
id then i will always save as ab and not ba. If theres already an ab
there and i have some validations i can avoid reading in another ab.
Hi again, thanks so much for your help i really appreciate it. I wanted
to write another association like you said before but there is no
Alphabet_Partner class to write it in. Its just a self reference to
Alphabet table.
Alphabet_Partner is only defined in
class Alphabet < ActiveRecord::Base
Adam Akhtar wrote:
> Thanks again.
> Ok i know why your saying to have a consistent sorting method, its so as
> to avoid a duplicate situation i.e. if i always sort by the letter and
> id then i will always save as ab and not ba. If theres already an ab
> there and i have some validations i can
Adam Akhtar wrote:
>
> Marnen many thanks again for your help.
You're welcome.
> So if i sort them by their name then id, and I have A and B with ids 1
> and 2 respectively then in my pairing controller id do
> @pairing = Pairing.new(params[:pairing])
> @pairing.save (Which would use the callb
"So A has an Ingredient_Partner B"
was a typo, should have read alphabet_partner
--
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 thi
> No, I am saying you would *not* have to have two pairs. Rather, when
> you construct a Pairing, pick an unambiguous way of sorting the two
> Alphabet objects so that ab and ba will map to the same thing. For
> example (untested):
>
> class Pairing < AR::B
> before_create do
> [...@
Adam Akhtar wrote:
[...]
[...]
>> Use a Pairing class with a polymorphic association.
>
> I thought polymorphic associations are used when you have several
> different models which have the same relationship with anohter one. I.e.
> You want to have comments associated with your models for Phot
Hi Thanks for your reply and your suggestions. Im a bit confused, could
you help clarify the following -
>> Hi if i have one model say with objects for each letter of the alphabet
>> e.g a,b,c ... x,y,z and i want to allow users to create there own
>> favourite pairings of these e.g.
>>
>> ab,
Adam Akhtar wrote:
> Hi if i have one model say with objects for each letter of the alphabet
> e.g a,b,c ... x,y,z and i want to allow users to create there own
> favourite pairings of these e.g.
>
> ab, cd, ef, gp and allow them to discuss via comments on each pairing,
> whats teh best way to mo
10 matches
Mail list logo