Reputation: 74
am new to rails, and am using active admin for a work, and i get this error whenever i open active admin dashboard
NoMethodError in Admin::DashboardController#index
undefined method `asideSection' for #<Admin::DashboardController:0x00007fc544017d70>
here is my application_conrtoller.rb
class ApplicationController < ActionController::Base
before_action :asideSection
def hhome
end
def getAsideSection
@asideSections = Page.all
end
end
how can i fix it please.
Upvotes: 0
Views: 1069
Reputation: 28305
before_action :asideSection
tries to call a method named asideSection
.
This method does not exist.
However, you have defined a method named: getAsideSection
. I presume that this is what you want to be called.
So, you could either change that to: before_action :getAsideSection
, or rename the method to asideSection
.
Here is how I would write it, also following the ruby style guide convention of using snake_case
for variables and method names:
class ApplicationController < ActionController::Base
before_action :get_aside_sections
def home
# ...
end
private
def get_aside_sections
@aside_sections = Page.all
end
end
Upvotes: 2