hello everybody I have this in my view
<tr id= "id_<%= x.nombre%>">
<td width="200"><%= x.nombre%></td>
<td width="10"><%= link_to_remote
image_tag("delete.png"),
:url=>{:controller=>"merca_usuarios",
:action=>"destroy", :id=>x}, :complete => "new
Effect.Fade(''id_#{x.nombre}'')" %> </td>
when I click in delete image this line fade n the view but don''t delete
this id of the database, so action destroy never call, why??? what
happen???
i inpruve write :update=> "contener" in link_to_remote but this
return
me an error
unknown method 55 in this case when x= 55 params id of url
thanks for all
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Maite Piedra wrote:> hello everybody I have this in my view > > <tr id= "id_<%= x.nombre%>"> > <td width="200"><%= x.nombre%></td> > <td width="10"><%= link_to_remote image_tag("delete.png"), > :url=>{:controller=>"merca_usuarios", > :action=>"destroy", :id=>x}, :complete => "new > Effect.Fade(''id_#{x.nombre}'')" %> </td> > > when I click in delete image this line fade n the view but don''t delete > this id of the database, so action destroy never call, why??? what > happen???Please post your controller''s action code, too, and your test cases. And shouldn''t :id => x be :id => x.id ? -- Phlip --~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
On Jan 17, 7:53 pm, Phlip <phlip2...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Maite Piedra wrote: > > hello everybody I have this in my view > > > <tr id= "id_<%= x.nombre%>"> > > <td width="200"><%= x.nombre%></td> > > <td width="10"><%= link_to_remote image_tag("delete.png"), > > :url=>{:controller=>"merca_usuarios", > > :action=>"destroy", :id=>x}, :complete => "new > > Effect.Fade(''id_#{x.nombre}'')" %> </td> > > > when I click in delete image this line fade n the view but don''t delete > > this id of the database, so action destroy never call, why??? what > > happen??? > > Please post your controller''s action code, too, and your test cases. > > And shouldn''t :id => x be :id => x.id ?that doesn''t matter. url_for special cases :id and tries to call to_param on what you give it if it''s an AR object, and the default definition of to_param is just id. Fred> > -- > Phlip--~--~---------~--~----~------------~-------~--~----~ 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org 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 -~----------~----~----~----~------~----~------~--~---
ok, the accion to controller is this
def destroy
empre=params[:id]
empre=empre.to_i
@todo=MercaUsuario.find(:all)
@todo.each do |x|
if (x.user_id == current_user.id)&&(x.empresa== empre)
x.destroy
end
end
end
but link_to_remote no call function if I push debugger in this funcion
nothing happen
thaks again
--
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---