In your config/router.rb define your routes as such:
Merb::Router.prepare do |r|
r.resources :pages
r.resources :contents
r.resources :folders
r.resources :functions
r.resources :messages
#Allows me to call link_to('Home', :home)
r.resource :home, {:controller => 'home', :action => 'index'}
end
Update 2008.04.11:
The Rails way adds a bunch of methods for you after defining a resource (like I did with :folders). However, Merb operates differently. I actually think I prefer Merb's approach because it funnels all url generation to the "url" method instead of giving a bunch of different ways to do the same thing.
So, after you define your :folders resource you can do the following:
<%= link_to "List Folders", url(:folders)%>
<%= link_to "Show Folder", url(:folder, @folder)%>
<%= link_to "Create Folder", url(:new_folder)%>
<%= link_to "Edit Folder", url(:edit_folder, @folder)%>
<%= link_to "Delete Folder", url(:delete_folder, @folder)%>
As I learn more, the information will be posted here.
back to Merb index

1 comments:
hey, thanks for posting this. the documentation appears to be a bit lacking when it comes to interacting with resources.
this was immensely helpful. :-)
Post a Comment