Displaying 1 result from an estimated 1 matches for "persona_entidad".
2007 Jan 10
0
many_to_many relationship problem
...the entity/es he
belongs to and viceversa, so far so good.
The thing im getting stuck is with the form that handles the editing to
add more people to an entity, heres what i got (mostly scaffold code
with some additions):
In the controller:
def edit
@persona = Persona.find(params[:id])
@persona_entidad = Persona.find(params[:id]).entidades
@entidades = Entidad.find(:all, :order => "nombre").map {|u|
[u.nombre, u.id] }
end
def update
@persona = Persona.find(params[:id])
@persona.entidades << @entidades
@persona.save
if @persona.update_attributes(params...