私はフィードバックシステムを作成しました。アーカイブのためのフィードバックを得ようとしています。私は複数の異なる設定を試みましたが、うまく動作しないようです。私はエラーを受け取っていません、そして、私は通知を受けているようにコントローラのアクションを打っているようです。ただし、ブール値はDBでは変更されず、特定のフィードバックは非表示になりません。Rails 4で特定のフィードバックをアーカイブしようとしています
助けていただけたら幸いです!
- 私はテーブルにArchiveブール値を追加しました。
- アーカイブのルートを作成しました。
- アーカイブ用のコントローラアクションを作成しました。
ここでは私のコードです:
また**Controller:**
def archive_feedback
@listing_feedback = ListingFeedback.find(params[:id])
respond_to do |format|
format.html { redirect_to listing_listing_feedbacks_path, notice: "That feedback has been archived." }
format.json { render :index }
end
end
**Routes: (My feedback feature is using nested resources)**
resources :listings do
member do
get 'like'
get 'unlike'
get 'duplicate'
get 'gallery'
delete 'gallery' => 'listings#clear_gallery'
get 'manage_photos'
get 'craigslist'
get "add_to_collection"
end
resources :listing_feedbacks do
member do
put 'archive_feedback'
end
end
end
**Index.html.erb:**
<p><%= link_to 'Archive', controller: "listing_feedbacks", action: "archive_feedback", id: listing_feedback.id, archive: :true, method: :put %></p>
、どのように私はそれがアーカイブされた後のフィードバックを非表示にすることになるだろうか?
.... てみてくださいする@ listing_feedback.update_attributes(:属性=>値) – Boltz0r
更新するトリングされている属性の名前は何ですか?コントローラでただ更新する – Thorin