* Validate for trailing slash instead of strict validation * Remove unused sign_in_count field * Add profile URLs to edit view * Add profile URLs to admin controller params * Add profile URLs to edit view * Clean up index and search views for user * Move around user fields to make more sense * Display more informative label * Remove name_of_user field in favor of new display label * Fix typo * Remove duplication for website, employer, and Mastodon URLs * Add score to comment params * Remove unused name_of_user field views * Fix typo for medium url
21 lines
614 B
Ruby
21 lines
614 B
Ruby
module Admin
|
|
class CommentsController < Admin::ApplicationController
|
|
def update
|
|
comment = Comment.find(params[:id])
|
|
if comment.update(comment_params)
|
|
flash[:notice] = "Comment successfully updated"
|
|
redirect_to "/admin/comments/#{comment.id}"
|
|
else
|
|
flash.now[:error] = comment.errors.full_messages
|
|
render :new, locals: { page: Administrate::Page::Form.new(dashboard, comment) }
|
|
end
|
|
end
|
|
|
|
private
|
|
|
|
def comment_params
|
|
accessible = %i[user_id body_markdown deleted score]
|
|
params.require(:comment).permit(accessible)
|
|
end
|
|
end
|
|
end
|