我快到了,我正在尝试找出 simple_private_messages 插件的其余部分。有谁知道我该如何解决这个问题?
这是我的 rake 路由输出
delete_selected_user_messages POST /users/:user_id/messages/delete_select
ed(.:format) messages#delete_selected
user_messages GET /users/:user_id/messages(.:format)
messages#index
POST /users/:user_id/messages(.:format)
messages#create
new_user_message GET /users/:user_id/messages/new(.:format)
messages#new
edit_user_message GET /users/:user_id/messages/:id/edit(.:fo
rmat) messages#edit
user_message GET /users/:user_id/messages/:id(.:format)
messages#show
PUT /users/:user_id/messages/:id(.:format)
messages#update
DELETE /users/:user_id/messages/:id(.:format)
messages#destroy
users GET /users(.:format)
users#index
POST /users(.:format)
users#create
new_user GET /users/new(.:format)
users#new
edit_user GET /users/:id/edit(.:format)
users#edit
user GET /users/:id(.:format)
users#show
PUT /users/:id(.:format)
users#update
DELETE /users/:id(.:format)
users#destroy
这是我的 routes.db
resources :users do
resources :messages do
collection do
post :delete_selected
end
end
end
ActiveAdmin.routes(self)
devise_for :admin_users, ActiveAdmin::Devise.config
resources :users do
member do
get :following, :followers
end
end
resources :sessions, only: [:new, :create, :destroy]
resources :microposts, only: [:create, :destroy]
resources :relationships, only: [:create, :destroy]
resources :microposts do
resources :comments
end
root to: 'static_pages#home'
这是我的 _sent.html.erb
<h2>Sent</h2>
<table>
<tr>
<th>Delete?</th>
<th>Subject</th>
<th>To</th>
<th>Sent</th>
</tr>
<% if @messages.size == 0 %>
<tr>
<td colspan="4">
No messages
</td>
</tr>
<% else %>
<% for message in @messages %>
<tr>
<td><%= check_box_tag "delete[]", message.id %></td>
<td><%= link_to h(message.subject), user_message_path(@user, message) %></td>
<td><%= link_to h(message.recipient_id), user_path(message.recipient) %></td>
<td><%=h message.created_at.to_s(:long) %></td>
</tr>
<% end %>
<tr>
<td colspan="4">
<%= submit_tag "Delete" %>
</td>
</tr>
<% end %>
</table>
<%= link_to "Inbox", user_messages_path(@user)%>
我正在尝试使此链接正常工作 (localhost:3000/users/2/messages?mailbox=sent) 但我收到此错误消息
Routing Error
No route matches {:action=>"show", :controller=>"users"}