【发布时间】:2018-09-06 19:05:08
【问题描述】:
在我的应用程序中,我有一个名为配置文件的视图。在此视图中,用户可以更新您的相册和这些相册的照片。
一个用户有很多相册。一个相册有很多照片。
我正在我的个人资料视图中创建一个表单来保存相册。像这样:
#routes.rb
get '/profile/edit/profile_albums', to: 'profiles#edit_profile_albums'
#/view/profile/edit/profile_albums.html.erb
<%= form_for album do |f| %>
<div class="dialog dialog-centered" id=<%= album.id %> style="display: block;">
<div class="dialog-container dialog-wide">
<div class="dialog-content panel">
<div class="form-group bottom-7">
<label for="">Album Name</label>
<input type="text" id="" value=<%= album.name %> placeholder="Add Album Name">
</div>
<div class="edit-photo-album bottom-5">
<% album.photos.each do |photo| %>
<span class="edit-photo">
<img src="<%= asset_path ix_refile_image_url(photo, :media, fit: 'fill', bg: '0fff') %>" class="photo-preview">
<a href="" title="Remove" class="remove-item">Remove</a>
</span>
<% end %>
<span class="btn btn-default btn-file">
<i ></i> Upload Photos
<%= f.attachment_field :photos_media, multiple: true, direct: true, presigned: true %>
</span>
</div><!-- end photo album -->
<p>
<div class="actions">
<%= f.submit 'Save Album', class: 'btn btn-lg btn-solid-red btn-margin-right' %>
</div>
<button type="button" class="btn btn-lg btn-outline-green dialog-close">Cancel</button>
</p>
</div><!-- end dialog content -->
</div><!-- end dialog container -->
</div>
<% end %>
当我按下按钮保存时:
<%= f.submit 'Save Album', class: 'btn btn-lg btn-solid-red btn-margin-right' %>
我收到这条消息:
Routing Error
No route matches [PATCH] "/profile/edit/albums"
有人可以帮助我吗?
谢谢
【问题讨论】:
-
为什么需要这样的 URL:
'/profile/edit/profile_albums',而不是'/profile/:id/edit/profile_albums'?
标签: ruby-on-rails ruby