Activeadmin custom render if

My below code

ActiveAdmin.register Question do belongs_to :topic, :optional => true controller do def index @topic = Topic.find_by_id params[:topic_id] if @topic @questions = @topic.questions render 'settings/questions/_by_admin', :layout => 'active_admin' return end end end end 

throws

  NoMethodError in Admin/questions#index 

Display

/home/amol/.rvm/gems/ ruby-1.9.2-p290@xxx /gems/activeadmin-0.5.0/app/views/layouts/active_admin.html.arb where line # 1 is raised:

undefined `base 'method for nil: NilClass

Extracted source (around line # 1):

 1: insert_tag view_factory.layout 

any idea? what's going on here. The stack trace does not point to any of my code files.

What I want here if @topic is present then I want my view to be different by default.

0
source share
1 answer

I have this script working when calling super as the last line in a controller action.

Super will give you a default view.

0
source

Source: https://habr.com/ru/post/907128/


All Articles