jcontonio
(jcontonio)
December 18, 2007, 1:14am
1
Here's where I am right now:
View:
<div id="tasks">
<% for task in @tasks %>
<%= link_to "Complete", complete_task_path(task) %>
<%=h task.body %>
<%= link_to 'Edit', edit_task_path(task) %>
<%= link_to 'Destroy', task, :confirm => 'Are you sure?', :method
=> :delete %>
<% end %>
</div>
routes.rb:
map.resources :tasks, :collection => { :complete => :post }
Controller:
def complete
@task = Task.find(params[:id])
@task.completed = true
end
Right now I am getting undefined method for complete_task_path. Why is
that? And how do I turn this into a checkbox? I want the checkbox to
call the complete method.
jcontonio
(jcontonio)
December 18, 2007, 1:21am
2
I need to do more reading it looks like. Thank you Ryan
jcontonio
(jcontonio)
December 18, 2007, 1:24am
3
That's easy to remember. Thanks again
jcontonio
(jcontonio)
December 18, 2007, 1:28am
4
Maybe you can answer this Ryan.
Do I still do :render layout => false when pushing out an rjs format
when using a RESTful design? My complete.js.rjs isn't being called.
def complete
@task = Task.find(params[:id])
@task.completed = true
render :layout => false
end
jcontonio
(jcontonio)
December 18, 2007, 1:38am
5
Ah ok, here is my problem:
in my log I see:
Parameters: {"action"=>"3", "id"=>"complete", "controller"=>"tasks"}
That's pretty weird no? Why would
<%= link_to "Complete", complete_task_path(task) %>
let it think the action = the id?
jcontonio
(jcontonio)
December 18, 2007, 1:58am
6
I have this:
map.resources :tasks, :member => { :complete => :put }
above
map.connect ':controller/:action/:id'
map.connect ':controller/:action/:id.:format'