Reputation: 48555
I'm thinking something like this could be accomplished with routing in Rails 3, but how would I handle it in my controller afterwards?
match 'items/:letter' => 'items#index', :letter => /[A-Z]/
Then I think I would have a param :letter
in my controller, then I'd need to return the items that have that as the first letter in it's name
. Does this make sense or am I crazy?
Upvotes: 0
Views: 132
Reputation: 14983
It makes sense.
Look for the letter in your query call as follows.
@items = Item.where("name LIKE ?%", params[:letter])
Upvotes: 1