Reputation: 11
I want to update attributes in a data table called "rang" from 0
to 1
using a link.
I have an action:
def ready
@task = Task.find(params[:id])
@task.update_attributes(:ready => '1')
@task.save
redirect_to :action => :index
end
And a link:
<%= link_to 'READY', { :action => :ready, :id => task.id } %>
But nothing happens. What am I doing wrong?
Upvotes: 0
Views: 104
Reputation: 6568
Try :
in routes.rb
resources :tasks do
member do
get 'ready'
end
end
Then link like:
<%= link_to 'READY', ready_task_url(task.id) %>
Upvotes: 2