You might as well skip the timestamps as well, as the "HABTM table
with extra fields" functionality disappeared in 2.3.

--Matt Jones

On Jun 29, 10:39 am, Jose Ernesto Suarez <suarez.erne...@gmail.com>
wrote:
> Solved.I write a comment for newbies as me...sorry for the english.
>
> The problem raises from the generation of the join table.This table,
> cannot must have a id attribute as a primary key, instead of this,
> must have a primary key composed by the two foreign keys.In Rails,
> this means a :id => false in the migration like this...
>
> class DocumentosExpedientes < ActiveRecord::Migration
>   def self.up
>     create_table :documentos_expedientes,:id => false do |t|
>       t.integer :documento_id
>       t.integer :expediente_id
>       t.timestamps
>     end
>   end
>
> After this, the only thing that I must do is
>
> documento.expedientes_ids << expedientes #expedientes is a array of
> #Expediente
>
> On 29 jun, 10:46, Jose Ernesto Suarez <suarez.erne...@gmail.com>
> wrote:
>
>
>
> > Hi!
>
> > I have a little problem in a HABTM relationship.
> > I  have this schema:
>
> > expedients <---> expedients_documents <---> documents
> > expedients(HABTM)docuements <-> documetns(HABTM)expedients
>
> > From the expedients view, I add a new document, passing as parameter
> > the expedients ids (maybe more than one).However, at time that I
> > create the document, I cannot put the values in the table
> > expedients_documents.
>
> > Should I use nested attributes for this? Im reading about, and i think
> > that putting in the documents/new view a fields_for :expedients must
> > complaint this, but I cannot get a correct result.
>
> > Thanks, and best regards.
--~--~---------~--~----~------------~-------~--~----~
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+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to