I have a single model that's creating this issue, the model appears in the index page, however the error is raised when I try to show, edit, or delete it in the Rail Admin Dashboard (it works fine in the app, the error is only raised in the Rails Admin dashboard.
The error I recieve is:
LocalJumpError in RailsAdmin::Main#show
Showing /home/shalashtein/.rbenv/versions/2.6.6/lib/ruby/gems/2.6.0/bundler/gems/rails_admin-f0c46f1e128b/app/views/rails_admin/main/show.html.haml where line #3 raised:
no block given
Extracted source (around line #101):
# Reader for the association's value unformatted
def value
bindings[:object].send(association.name)
end
Model:
class Product < ApplicationRecord
belongs_to :catch
has_many :items, dependent: :destroy
end
Controller:
class ProductsController < ApplicationController
before_action :set_product, only: [:show, :edit, :update, :destroy]
# GET /products
# GET /products.json
def index
@products = Product.all
end
# GET /products/1
# GET /products/1.json
def show
authorize @product, policy_class: ProductPolicy
end
# GET /products/new
def new
@product = Product.new
authorize @product, policy_class: ProductPolicy
end
# GET /products/1/edit
def edit
authorize @product, policy_class: ProductPolicy
end
# POST /products
# POST /products.json
def create
@product = Product.new(product_params)
authorize @product, policy_class: ProductPolicy
respond_to do |format|
if @product.save
format.html { redirect_to @product, notice: 'Product was successfully created.' }
format.json { render :show, status: :created, location: @product }
else
format.html { render :new }
format.json { render json: @product.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /products/1
# PATCH/PUT /products/1.json
def update
authorize @product, policy_class: ProductPolicy
respond_to do |format|
if @product.update(product_params)
format.html { redirect_to @product, notice: 'Product was successfully updated.' }
format.json { render :show, status: :ok, location: @product }
else
format.html { render :edit }
format.json { render json: @product.errors, status: :unprocessable_entity }
end
end
end
# DELETE /products/1
# DELETE /products/1.json
def destroy
authorize @product, policy_class: ProductPolicy
@product.destroy
respond_to do |format|
format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }
format.json { head :no_content }
end
end
private
# Use callbacks to share common setup or constraints between actions.
def set_product
@product = Product.find(params[:id])
end
# Only allow a list of trusted parameters through.
def product_params
params.require(:product).permit(:catch_id, :price)
end
end
I have a single model that's creating this issue, the model appears in the index page, however the error is raised when I try to show, edit, or delete it in the Rail Admin Dashboard (it works fine in the app, the error is only raised in the Rails Admin dashboard.
The error I recieve is:
Model:
Controller:
log
Ruby version: 2.6.6 Rails 6