Skip to content

Commit 10b8feb

Browse files
committed
url_for(@list) #=> '/ruby-dev'
1 parent 9e87fdd commit 10b8feb

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

app/models/list.rb

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,12 @@ def find_by_id(id)
2727

2828
alias find find_by_id
2929
end
30+
31+
def to_param
32+
name
33+
end
34+
35+
def persisted?
36+
true
37+
end
3038
end

config/routes.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Rails.application.routes.draw do
22
get '/:list_name/:list_seq', to: 'messages#show'
3-
get '/:list_name/', to: 'messages#index'
3+
get '/:list_name/', to: 'messages#index', as: :list
44

55
get '/attachments/:encoded_key/*filename' => 'attachments#show', as: :attachment
66

0 commit comments

Comments
 (0)