Jeremy W. wrote:
I am having some trouble in trying to figure out how to add a date and
time to my URL and leave out the :id.
map.resources :events do |events|
the url I want to be shown is /events/1/showtimes/2007-2-14/18/00
but what I am getting is /events/1/showtimes/1
You may not be able to use restful routes with this. Simply because
that route is not restful. REST says every resource has a single ID,
yet that route has 3 bits of data to identify a showtime: date, hour and
you might be able to do a route like:
by doing something like
class Showtime < ActiveRecord::Base
But you will have to fetch all your stuff via
Since you id is now a time stamp, instead of a primary key.
ALSO, a buddy of mine thinks that REST conflicts with Object thinking, I
just wanted to get everyone else’s opinion on that.
Object thinking? Is that a cult?
If anything, it makes the web more object oriented by identifying a
specific url with a specific object or resource. HTTP verbs are like
the methods on that object. Makes more OO sense to me than a bunch of
controllers that you can’t really tell what data they manipulate without
looking at the source code.