J'ai créé une petite application appelée plis auxquels j'ai assigné quelques paramètres. J'ai décidé que je voulais ajouter une photo à chaque pli et suis allé à travers un tutoriel pour trombone.Rails erreur de routage
Alors maintenant, j'ai installé paperclip et ImageMagick, et quand je modifier un pli, je peux choisir une image de mon disque dur, et quand je clique sur le volet de mise à jour j'obtenir une erreur de routage qui dit
Routing erreur
No route matches "/folds/2/edit"
Je suis très nouveau à cela, que puis-je ajouter cela me obtenir une réponse claire? Itinéraires de râteau?
fold_comments GET /folds/:fold_id/comments(.:format) {:action=>"index", :controller=>"comments"}
fold_comments POST /folds/:fold_id/comments(.:format) {:action=>"create", :controller=>"comments"}
new_fold_comment GET /folds/:fold_id/comments/new(.:format) {:action=>"new", :controller=>"comments"}
edit_fold_comment GET /folds/:fold_id/comments/:id/edit(.:format) {:action=>"edit", :controller=>"comments"}
fold_comment GET /folds/:fold_id/comments/:id(.:format) {:action=>"show", :controller=>"comments"}
fold_comment PUT /folds/:fold_id/comments/:id(.:format) {:action=>"update", :controller=>"comments"}
fold_comment DELETE /folds/:fold_id/comments/:id(.:format) {:action=>"destroy", :controller=>"comments"}
folds GET /folds(.:format) {:action=>"index", :controller=>"folds"}
folds POST /folds(.:format) {:action=>"create", :controller=>"folds"}
new_fold GET /folds/new(.:format) {:action=>"new", :controller=>"folds"}
edit_fold GET /folds/:id/edit(.:format) {:action=>"edit", :controller=>"folds"}
fold GET /folds/:id(.:format) {:action=>"show", :controller=>"folds"}
fold PUT /folds/:id(.:format) {:action=>"update", :controller=>"folds"}
fold DELETE /folds/:id(.:format) {:action=>"destroy", :controller=>"folds"}
home_index GET /home/index(.:format) {:controller=>"home", :action=>"index"}
root /(.:format) {:controller=>"home", :action=>"index"}
fold.rb?
class Fold < ActiveRecord::Base
validates :model, :presence => true
validates :folder, :presence => true
has_many :comments, :dependent => :destroy
has_attached_file :photo, :styles => { :small => "150x150>" },
:url => "/assets/folds/:id/:style/:basename.:extension",
:path => ":rails_root/public/assets/folds/:id/:style/:basename.:extension",
:dependent => :destroy
validates_attachment_presence :photo
validates_attachment_size :photo, :less_than => 5.megabytes
validates_attachment_content_type :photo, :content_type => ['image/jpeg', 'image/png']
end
routes.rb
Folds::Application.routes.draw do
resources :folds do
resources :comments
end
get "home/index"
end
_form.html.erb
<%= form_for :fold, :html => { :multipart => true } do |f| %>
<% if @fold.errors.any? %>
<div id="error_explanation">
<h2><%= pluralize(@fold.errors.count, "error") %> prohibited this fold from being saved:</h2>
<ul>
<% @fold.errors.full_messages.each do |msg| %>
<li><%= msg %></li>
<% end %>
</ul>
</div>
<% end %>
<div class="field">
<%= f.label :model %><br />
<%= f.text_field :model %>
</div>
<div class="field">
<%= f.file_field :photo_file_name %>
</div>
<div class="field">
<%= f.label :folder %><br />
<%= f.text_field :folder %>
</div>
<div class="field">
<%= f.label :base %><br />
<%= f.text_field :base %>
</div>
<div class="field">
<%= f.label :creator %><br />
<%= f.text_field :creator %>
</div>
<div class="field">
<%= f.label :body %><br />
<%= f.text_area :body %>
</div>
<div class="field">
<%= f.label :fold_id %><br />
<%= f.text_field :fold_id %>
</div>
<div class="field">
<%= f.label :diagram %><br />
<%= f.text_field :diagram %>
</div>
<div class="actions">
<%= f.submit %>
</div>
<% end %>
Pouvez-vous poster 'config/routes.rb' et la vue que vous obtenez cette erreur? –
ajouté, rien d'autre d'utile? – Jeff