Я пытаюсь использовать скрепку с рельсами 3.1, но постоянно получаю эту ошибку маршрутизации.
Не найдено ни одного маршрута {: action => "show",: controller => "users"}
Я следовал инструкциям в thinkbot / paperclip на github.
<%= form_for :user, @user, :url => user_path, :html => { :multipart => true } do |f| %>
<% if @user.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :FirstName %><br />
<%= f.text_field :FirstName %>
</div>
<div>
<%= f.label :avatar%>
<%= f.file_field :avatar %>
</div>
<div class="field">
<%= f.label :LastName %><br />
<%= f.text_field :LastName %>
</div>
<div class="field">
<%= f.label :Email %><br />
<%= f.text_field :Email %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
User.rb
class User < ActiveRecord::Base
has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }
end
rout.rb
City::Application.routes.draw do
resources :users
end
show.html.erb
<p id="notice">
<%= notice %>
</p>
<p>
<b>Firstname:</b>
<%= @user.FirstName %>
</p>
<p>
<b>Lastname:</b>
<%= @user.LastName %>
</p>
<p>
<b>Email:</b>
<%= @user.Email %>
</p>
<p>
<b>Avatar</b>
<%= image_tag @user.avatar.url %>
<%= image_tag @user.avatar.url(:medium) %>
<%= image_tag @user.avatar.url(:thumb) %>
</p>
<%= link_to 'Edit', edit_user_path(@user) %> |
<%= link_to 'Back', users_path %>
! UPDATE!
$ rake маршрутизирует события GET /events(.:format) {: action => "index",: controller => "events"} POST /events(.:format) {: action =>" create ",: controller =>" events "} new_event GET
/events/new(.:format) {: action =>" new ",: controller => "events"} edit_event GET /events/:id/edit(.:format)
{: action => "edit",: controller => "events"} событие GET / events /: id (.: format) {: action => "show",: controller => "events"} PUT /events/:id(.:format) {: action => "update",: controller => "events"} DELETE/events/:id(.:format) {: action => "destroy",: controller => "events"} root / {: controller => "events",: action => "index"} /: controller (/:action(/:id(.:format)))