Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Solution to the problem when scaffold inherits the inherited class due to active admin

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 343
    Comment on it

    Solution to the problem when scaffold inherits the inherited class and not the application controller due to active admin

     

    While creating a web application in rails we always need an admin panel through which we can manage the content and users of our website. Today the blog which I'm writing is the problem which I discovered when I used Active Admin gem to create an admin panel for my application. 

    Active admin uses inherited classes with further conflicts with rails scaffold.

    When I scaffolded a Products model for my app, it didn't give me all the crud operations in the controller that was because it was inheriting an inherited class instead of application controller which is the base class like this.

    class ProductsController < InheritedResources::Base

     

    but actually it should have been like this

    class ProductsController < ApplicationController

     

    So to achieve our normal scaffold controllers we need to add this to our config/application.rb file

    config.app_generators.scaffold_controller = :scaffold_controller

    This will tell the app generators that scaffold controllers have to be used instead of inherited classes.

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: