I'm trying to show info into a dialog. I want such info to be loaded from a view (template). The thing is that, when i use
<%= render template:'panels/product_specifications' %>
it tries to load the info but, as i have global variables used in my view that were defined in the controller, and the controller isn't executed it throws me:
undefined method `banner_image_with_arrows_filename' for nil:NilClass
Extracted source (around line #2):
1:
2: - banner_image = "banners/panels/#{@panel.banner_image_with_arrows_filename}"
3: #image-info
4: %table
5: %tr
@panel variable is defined in controller here:
def load_panel
@panel = Panel.find_or_build_from_id(params[:id])
if !@panel.available_in_market?(market)
add_flash_notice(t("pages.panel.text.not_available_in_market", :market => market.name), true)
end
end
in a before_filter
.
I have also tried with render partial:'panels/products_specifications
(having underscored 'product_specifications.html.erb' first), render action:'panels/product_specifications', controller:'product_specifications
with different errors.
How can i load that partial or view from another with the controller being executed too?
EDIT:
To give you a big picture, what i'm trying to do is to show the user (when he passes the mouse over a link) a dialog with a preview of what he will see if he click that link.