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. --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
You want to change :collection to :member. On Dec 18, 2007 11:44 AM, jcontonio <jcontonio-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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. > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I need to do more reading it looks like. Thank you Ryan On Dec 17, 8:16 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> You want to change :collection to :member. > > On Dec 18, 2007 11:44 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > 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. > > -- > Ryan Bigghttp://www.frozenplague.net--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Heh, that stumped me a few times when I was learning restful routing too. The way I remember it now is a :member is like a member of a group, whereas a collection is a collection of things. On Dec 18, 2007 11:51 AM, jcontonio <jcontonio-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I need to do more reading it looks like. Thank you Ryan > > On Dec 17, 8:16 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > You want to change :collection to :member. > > > > On Dec 18, 2007 11:44 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > 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. > > > > -- > > Ryan Bigghttp://www.frozenplague.net > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That''s easy to remember. Thanks again On Dec 17, 8:22 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Heh, that stumped me a few times when I was learning restful routing too. > > The way I remember it now is a :member is like a member of a group, whereas > a collection is a collection of things. > > On Dec 18, 2007 11:51 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I need to do more reading it looks like. Thank you Ryan > > > On Dec 17, 8:16 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > You want to change :collection to :member. > > > > On Dec 18, 2007 11:44 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > 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. > > > > -- > > > Ryan Bigghttp://www.frozenplague.net > > -- > Ryan Bigghttp://www.frozenplague.net--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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 On Dec 17, 8:22 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Heh, that stumped me a few times when I was learning restful routing too. > > The way I remember it now is a :member is like a member of a group, whereas > a collection is a collection of things. > > On Dec 18, 2007 11:51 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I need to do more reading it looks like. Thank you Ryan > > > On Dec 17, 8:16 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > You want to change :collection to :member. > > > > On Dec 18, 2007 11:44 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > 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. > > > > -- > > > Ryan Bigghttp://www.frozenplague.net > > -- > Ryan Bigghttp://www.frozenplague.net--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
By default, RJS files are not rendered with a layout. Are you sure it''s going in to the rjs file and the rjs file has valid code? Are you using Firefox? Do you have Firebug? Firebug will tell you about any javascript errors. On Dec 18, 2007 11:58 AM, jcontonio <jcontonio-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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 > > On Dec 17, 8:22 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > Heh, that stumped me a few times when I was learning restful routing > too. > > > > The way I remember it now is a :member is like a member of a group, > whereas > > a collection is a collection of things. > > > > On Dec 18, 2007 11:51 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > I need to do more reading it looks like. Thank you Ryan > > > > > On Dec 17, 8:16 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > You want to change :collection to :member. > > > > > > On Dec 18, 2007 11:44 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > 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. > > > > > > -- > > > > Ryan Bigghttp://www.frozenplague.net > > > > -- > > Ryan Bigghttp://www.frozenplague.net > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
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? On Dec 17, 8:31 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> By default, RJS files are not rendered with a layout. > > Are you sure it''s going in to the rjs file and the rjs file has valid code? > > Are you using Firefox? Do you have Firebug? Firebug will tell you about any > javascript errors. > > On Dec 18, 2007 11:58 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > 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 > > > On Dec 17, 8:22 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Heh, that stumped me a few times when I was learning restful routing > > too. > > > > The way I remember it now is a :member is like a member of a group, > > whereas > > > a collection is a collection of things. > > > > On Dec 18, 2007 11:51 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > I need to do more reading it looks like. Thank you Ryan > > > > > On Dec 17, 8:16 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > You want to change :collection to :member. > > > > > > On Dec 18, 2007 11:44 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > 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. > > > > > > -- > > > > > Ryan Bigghttp://www.frozenplague.net > > > > -- > > > Ryan Bigghttp://www.frozenplague.net > > -- > Ryan Bigghttp://www.frozenplague.net--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
That is weird. Have you not defined map.resources :tasks, :collection => { :complete => :post } above the default map.connect'':controller/:action/:id''? I think that''s what would be doing something like that, because it would be sending a url like /tasks/3/complete. Move the map.resources to above this default map.connect ''contro... and it should work. On Dec 18, 2007 12:08 PM, jcontonio <jcontonio-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > 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? > > On Dec 17, 8:31 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > By default, RJS files are not rendered with a layout. > > > > Are you sure it''s going in to the rjs file and the rjs file has valid > code? > > > > Are you using Firefox? Do you have Firebug? Firebug will tell you about > any > > javascript errors. > > > > On Dec 18, 2007 11:58 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > 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 > > > > > On Dec 17, 8:22 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > Heh, that stumped me a few times when I was learning restful routing > > > too. > > > > > > The way I remember it now is a :member is like a member of a group, > > > whereas > > > > a collection is a collection of things. > > > > > > On Dec 18, 2007 11:51 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I need to do more reading it looks like. Thank you Ryan > > > > > > > On Dec 17, 8:16 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > You want to change :collection to :member. > > > > > > > > On Dec 18, 2007 11:44 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > 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. > > > > > > > > -- > > > > > > Ryan Bigghttp://www.frozenplague.net > > > > > > -- > > > > Ryan Bigghttp://www.frozenplague.net > > > > -- > > Ryan Bigghttp://www.frozenplague.net > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
I have this: map.resources :tasks, :member => { :complete => :put } above map.connect '':controller/:action/:id'' map.connect '':controller/:action/:id.:format'' On Dec 17, 8:42 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> That is weird. Have you not defined map.resources :tasks, :collection => { > :complete => :post } above the default map.connect'':controller/:action/:id''? > > I think that''s what would be doing something like that, because it would be > sending a url like /tasks/3/complete. Move the map.resources to above this > default map.connect ''contro... and it should work. > > On Dec 18, 2007 12:08 PM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > 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? > > > On Dec 17, 8:31 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > By default, RJS files are not rendered with a layout. > > > > Are you sure it''s going in to the rjs file and the rjs file has valid > > code? > > > > Are you using Firefox? Do you have Firebug? Firebug will tell you about > > any > > > javascript errors. > > > > On Dec 18, 2007 11:58 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > 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 > > > > > On Dec 17, 8:22 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > Heh, that stumped me a few times when I was learning restful routing > > > > too. > > > > > > The way I remember it now is a :member is like a member of a group, > > > > whereas > > > > > a collection is a collection of things. > > > > > > On Dec 18, 2007 11:51 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > I need to do more reading it looks like. Thank you Ryan > > > > > > > On Dec 17, 8:16 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > You want to change :collection to :member. > > > > > > > > On Dec 18, 2007 11:44 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > 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. > > > > > > > > -- > > > > > > > Ryan Bigghttp://www.frozenplague.net > > > > > > -- > > > > > Ryan Bigghttp://www.frozenplague.net > > > > -- > > > Ryan Bigghttp://www.frozenplague.net > > -- > Ryan Bigghttp://www.frozenplague.net--~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
Weird. That''s the only thing I can think of that could cause it. On Dec 18, 2007 12:28 PM, jcontonio <jcontonio-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > I have this: > map.resources :tasks, :member => { :complete => :put } > > above > > map.connect '':controller/:action/:id'' > map.connect '':controller/:action/:id.:format'' > > On Dec 17, 8:42 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > That is weird. Have you not defined map.resources :tasks, :collection => > { > > :complete => :post } above the default map.connect > '':controller/:action/:id''? > > > > I think that''s what would be doing something like that, because it would > be > > sending a url like /tasks/3/complete. Move the map.resources to above > this > > default map.connect ''contro... and it should work. > > > > On Dec 18, 2007 12:08 PM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > > > > > 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? > > > > > On Dec 17, 8:31 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > By default, RJS files are not rendered with a layout. > > > > > > Are you sure it''s going in to the rjs file and the rjs file has > valid > > > code? > > > > > > Are you using Firefox? Do you have Firebug? Firebug will tell you > about > > > any > > > > javascript errors. > > > > > > On Dec 18, 2007 11:58 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > 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 > > > > > > > On Dec 17, 8:22 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > Heh, that stumped me a few times when I was learning restful > routing > > > > > too. > > > > > > > > The way I remember it now is a :member is like a member of a > group, > > > > > whereas > > > > > > a collection is a collection of things. > > > > > > > > On Dec 18, 2007 11:51 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > > > > > > > I need to do more reading it looks like. Thank you Ryan > > > > > > > > > On Dec 17, 8:16 pm, "Ryan Bigg" <radarliste...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > > > > You want to change :collection to :member. > > > > > > > > > > On Dec 18, 2007 11:44 AM, jcontonio <jconto...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> > wrote: > > > > > > > > > > > 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. > > > > > > > > > > -- > > > > > > > > Ryan Bigghttp://www.frozenplague.net > > > > > > > > -- > > > > > > Ryan Bigghttp://www.frozenplague.net > > > > > > -- > > > > Ryan Bigghttp://www.frozenplague.net > > > > -- > > Ryan Bigghttp://www.frozenplague.net > > >-- Ryan Bigg http://www.frozenplague.net --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---