I get this error whenever I try to destroy a record. I don't get why this isn't working.
PG::InvalidTextRepresentation: ERROR: invalid input syntax for integer: "Notation"
My controller:
def destroy
Notation.find(params[:id]).destroy
respond_to do |format|
format.html { redirect_to @commentable, notice: 'Reply was eradicated.' }
end
end
I've also tried doing it this way:
def destroy
@notation = Notation.find(params[:id])
@notation.destroy
respond_to do |format|
format.html { redirect_to @commentable, notice: 'Reply was eradicated.' }
end
end
How I'm doing it in the view:
<%= link_to comment_notation_path(@comment, notation), method: :delete, data: { confirm: "Are you sure?" } do %>
<i class="fa fa-trash small ml-3" title="delete"></i><% end %>
The schema:
create_table "notations", force: :cascade do |t|
t.integer "comment_id"
t.integer "user_id"
t.text "content"
t.datetime "created_at", precision: 6, null: false
t.datetime "updated_at", precision: 6, null: false
end