I just went through the very helpful video tutorial from peepcode.com.
Nice work Geoff!
I have a setup similar to Geoff''s todo list application from the start
of the tutorial. Link: http://roughunderbelly.com/user/login
While i understand how it is done with non rest, through the tutorial.
Im not sure how to implement the routes for my restful app.
(current routes)
#resource mappings
map.resources :releases, :collection => {:accept => :get, :approve =>
:get, :publish => :get} do |release|
release.resources :tracks
end
(example rjs, im using simply_helpful plugin also)
page.remove dom_id(@release)
page.insert_html :bottom, ''outbox_releases'',
:partial=>''release'',
:locals => {:release => @release}
(example partial)
<tr id="<%= dom_id(release) %>" class="<%=
cycle(''odd'',''even'') %>">
<td><%=
link_to(image_tag(release.cover.public_filename(''small'')),
tracks_path(release)) %></td>
<td><%= link_to release.title, tracks_path(release)
%></td>
<td><%= release.artist %></td>
<td>
<%= link_to_remote "Accept",
:url => { :controller => "releases",
:action => "close_release",
:id => release.id } %>
</td>
</tr>
(controller for releases)
def close_release
@release = Release.find(params[:id])
@release.update_attribute(:closed, 1)
end
The idea is to progress the releases through states using the aspects
specified above. Eg the releases;accept page shows all releases that are
to be accepted. You then move the release from the inbox table to outbox
table to accept.
The problem occurs when i try to link_to_remote with an action like
close_release_state, there is obviously no route for this. Im already
using aspects. How does one allow for the normally non crud rjs actions
with rest?
Is it standard to fill out the domain model a bit to allow for crud only
rjs actions?
regards,
Adam
--
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
-~----------~----~----~----~------~----~------~--~---