edit category
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
class EntriesController < ApplicationController
|
||||
before_action :set_entry, only: [ :show ]
|
||||
before_action :set_entry, only: [ :show, :edit, :update ]
|
||||
|
||||
def index
|
||||
@language_code = params[:language].presence
|
||||
@@ -49,6 +49,17 @@ class EntriesController < ApplicationController
|
||||
def show
|
||||
end
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
def update
|
||||
if @entry.update(entry_params)
|
||||
redirect_to entry_path(@entry), notice: "Entry updated."
|
||||
else
|
||||
render :edit, status: :unprocessable_entity
|
||||
end
|
||||
end
|
||||
|
||||
def download
|
||||
@entries = Entry.order(:id)
|
||||
respond_to do |format|
|
||||
@@ -64,4 +75,8 @@ class EntriesController < ApplicationController
|
||||
def set_entry
|
||||
@entry = Entry.find(params[:id])
|
||||
end
|
||||
|
||||
def entry_params
|
||||
params.require(:entry).permit(:category)
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user