link_to_remote

view:

<%= link_to_remote "Remove", :url => { :controller => "auth_user",
:action => :remove_req }, :id => "post.requirement_id" %></td>

controller:

  def remove_req
redirect_to :action => :index
end

When I click on the link, it doesn't redirect. What's the problem?

Thanks

view:

<%= link_to_remote "Remove", :url => { :controller => "auth_user",
:action => :remove_req }, :id => "post.requirement_id" %></td>

controller:

def remove_req
redirect_to :action => :index
end

When I click on the link, it doesn't redirect. What's the problem?

You probably want link_to not link_to_remote. link_to_remote does an ajax call

link_to: http://api.rubyonrails.com/classes/ActionView/Helpers/UrlHelper.html#M001601
link_to_remote:
http://api.rubyonrails.com/classes/ActionView/Helpers/PrototypeHelper.html#M001628

Justin To wrote:

view:

<%= link_to_remote "Remove", :url => { :controller => "auth_user",
:action => :remove_req }, :id => "post.requirement_id" %></td>

controller:

  def remove_req
redirect_to :action => :index
end

When I click on the link, it doesn't redirect. What's the problem?

Thanks

An Ajax request cannot redirect the page... at least not this way. I
don't think you want link_to_remote in this case. Try link_to. Note: you
want to be careful making links (HTTP GETs) do destructive things like
deleting data.

Great, thanks!