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 8096569
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:29:34+00:00 2026-06-05T21:29:34+00:00

I have namespaced model Equipment::Feature and namespaced controller in my admin part Admin::Equipment::FeaturesController .

  • 0

I have namespaced model Equipment::Feature and namespaced controller in my admin part Admin::Equipment::FeaturesController. Model is generic and is used as from within :admin namespace and for public website. I’ve set up the routing for :admin and :equipment namespaces

namespace :admin do
  namespace :equipment do
    resources :features
  end
end

Which gives me following routes:

 admin_equipment_features     GET /admin/equipment/features(.:format)          admin/equipment/features#index
                              POST /admin/equipment/features(.:format)         admin/equipment/features#create
 new_admin_equipment_feature  GET /admin/equipment/features/new(.:format)      admin/equipment/features#new
 edit_admin_equipment_feature GET /admin/equipment/features/:id/edit(.:format) admin/equipment/features#edit
 admin_equipment_feature      GET /admin/equipment/features/:id(.:format)      admin/equipment/features#show
                              PUT /admin/equipment/features/:id(.:format)      admin/equipment/features#update
                              DELETE /admin/equipment/features/:id(.:format)   admin/equipment/features#destroy

Pretty standard stuff. But when I address /admin/equipment/features it throws uninitialized constant Admin::Equipment::FeaturesController::Equipment exception

#index action in my Admin::Equipment::FeaturesController looks like

def index
  @features = Equipment::Feature.all
end

It did seem to work, until I declared Admin::Equipment namespace. Before it was like Admin::EquipmentFeaturesController

I guess this is some sort of namespace collision, but I don’t get it – where does it come from?

Thanks in advance!

UPDATE Feature model (uses STI pattern)

class Equipment::Feature < ActiveRecord::Base

  attr_accessible :category_id, :name_en, :name_ru, :type

  belongs_to :category, :class_name => 'Equipment::Category'

  has_many :item_features, :class_name => 'Equipment::ItemFeature'
  has_many :items, :through => :item_features

  translates :name
end

class FeatureBoolean < Equipment::Feature

end

class FeatureNumeric < Equipment::Feature

end

class FeatureString < Equipment::Feature

end

class FeatureRange < Equipment::Feature

end

UPDATE2
Fixing #index action as per answer below resolved the issue. New code:

def index
  @features = ::Equipment::Feature.all
end
  • 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-06-05T21:29:35+00:00Added an answer on June 5, 2026 at 9:29 pm

    I think it’s now looking for Feature in Admin::Equipment, rather than in ::Equipment

    Try specifying that there is no namespace, i.e.

    def index
      @features = ::Equipment::Feature.all
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; namespace UnitTest.Model { [TestFixture] public class
I have the following models: WeatherForecast: namespace TravelAssistant.Model.HelperModels.Weather public class WeatherForecast:EntityBase<int> { public IList<DayForecast>
I have a simple model namespace StackOverflow.Models { public class Test { public Test()
I have a code first model: namespace InternetComicsDatabase.Models { public class Issue { [Key]
In one namespace (Ventosa.Graphics) I have a public class named Model namespace Ventosa.Graphics {
I have the following model: namespace Storage.Models { public class AdminDetail { public string
I have an Interface like this: namespace QuickRoutes.Model.Utilities { public interface IRoutesManager { bool
I have a nested ActiveResource model (i.e. it's within another model's namespace). Trying to
I have a class in my domain model root that looks like this: namespace
I'm using Doctrine ODM with MongoDB. I have a product model like this: namespace

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.