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)
<%= link_to(image_tag(release.cover.public_filename('small')), tracks_path(release)) %> <%= link_to release.title, tracks_path(release) %> <%= release.artist %> <%= link_to_remote "Accept", :url => { :controller => "releases", :action => "close_release", :id => release.id } %> (controller for releases) def close_release @release = Release.find(params[:id]) @release.update_attribute(:closed, 1) endThe 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