If I understand as well, you hit a action that execute the method load_panel
with a before_filter and, the view associated, you're trying to render a template with the variable.
The first thing you should to try is to see if there is a record returned by Panel.find_or_build_from_id(params[:id])
. You can use the puts
method or use a debugger like pry.
You can also try to do this <%= render template:'panels/product_specifications', panel: @panel %>
and use panel
as a local variable in your template like this : banners/panels/#{panel.banner_image_with_arrows_filename}
.
I think a best practices can be to use a presenter.
Final answer after a chat
You must to use ajax to show a new panel and hit a controller action. You can see an example here.