Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4265304
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 21, 20262026-05-21T06:36:22+00:00 2026-05-21T06:36:22+00:00

I have an engine, with this routes file: Rails.application.routes.draw do resources :comments, :controller =>

  • 0

I have an engine, with this routes file:

Rails.application.routes.draw do
  resources :comments, :controller => 'opinio/comments'
end

When I run the rake routes task, I get the correct output

     comments GET    /comments(.:format)           {:action=>"index", :controller=>"opinio/comments"}
              POST   /comments(.:format)           {:action=>"create", :controller=>"opinio/comments"}
  new_comment GET    /comments/new(.:format)       {:action=>"new", :controller=>"opinio/comments"}
 edit_comment GET    /comments/:id/edit(.:format)  {:action=>"edit", :controller=>"opinio/comments"}
      comment GET    /comments/:id(.:format)       {:action=>"show", :controller=>"opinio/comments"}
              PUT    /comments/:id(.:format)       {:action=>"update", :controller=>"opinio/comments"}
              DELETE /comments/:id(.:format)       {:action=>"destroy", :controller=>"opinio/comments"}

My controller is pretty simple:

class Opinio::CommentsController < ApplicationController
  include Opinio::Controllers::InternalHelpers

  def index
    resource.comments.page(params[:page])
  end

  def create
    @comment = resource.comments.build(params[:comment])
    @comment.user = current_user
    if @comment.save
      flash[:notice] = I18n.translate('opinio.comment.sent', :default => "Comment sent successfully.")
    else
      flash[:error]  = I18n.translate('opinio.comment.error', :default => "Error sending the comment.")
    end
  end
end

But when I try using any action that goes to the engine’s controller I get the following error:

uninitialized constant Comment::CommentsController

I sincerely don’t know where Rails is magically adding this Comment namespace on the controller, and I don’t have a clue of how to solve this.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-21T06:36:22+00:00Added an answer on May 21, 2026 at 6:36 am

    Wow, this deserves an answer so nobody ever do such stupidity like I did.

    Basically, I added this to my engine’s module:

    mattr_accessor :name
    @@name = "Comment"
    

    and internally, there is already a method name on every module, which I accidentally overrided, and causing all the errors. AS tried to load the missing constant, but when called for name inside my Opinio model, it got "Comment" instead of Opinio.

    A reminder for myself and any others out there.
    Don`t use obvious names and attributes without checking if they already exist first.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

So I have this code in a google app engine template: <select name='voter'> {%
I'm a newbie to python and the app engine. I have this code that
I have been writting a keyword search script based on this tutorial: http://www.hackosis.com/2007/11/06/howto-simple-search-engine-with-php-and-mysql/ Like
We have an engine that loads dlls dynamically (whatever is located in a certain
In my engine I have a need to be able to detect DXT1 textures
I have a Google App Engine app - http://mylovelyapp.appspot.com/ It has a page -
I have my own game engine using C++ and OpenGL, but I have models
I have a custom view engine in ASP.NET MVC and since upgrading to RC1
I have a simple Google App Engine app, that I wrote using ordinary strings.
I have discovered through trial and error that the MATLAB engine function is not

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.