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

  • SEARCH
  • Home
  • 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 9148911
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T11:23:58+00:00 2026-06-17T11:23:58+00:00

I can’t find why I get the following error in my view when using

  • 0

I can’t find why I get the following error in my view when using any method that has_many provides to its collection (such as ‘where’) :

NameError in History/hist_paquets_mesures#show
Showing /var/www-opf/opf/app/views/history/hist_paquets_mesures/show.html.haml where line #19 raised:
uninitialized constant HistPaquetMesures::HistVersionsPaquetsMesure

The part of my (HAML) view causing this issue :

// I want to make this work
//= @hist_paquet_mesures.hist_versions_paquets_mesures.where(:hist_origine_modification == nil).first.version
// So I debug with this, which is causing the same error
= debug @hist_paquet_mesures.hist_versions_paquets_mesures

I set up an exception for the special singular-plural names that I use in config/initializers/inflections.rb :

  ActiveSupport::Inflector.inflections do |inflect|
    inflect.irregular 'pub_liste_horizon', 'pub_listes_horizon'
    inflect.irregular 'hist_paquet_mesures', 'hist_paquets_mesures'
    inflect.irregular 'hist_projet_connexe', 'hist_projets_connexes'
    inflect.irregular 'hist_version_paquet_mesures', 'hist_versions_paquets_mesures'
    inflect.irregular 'hist_origine_modification', 'hist_origines_modification'
  end

Pluralize , singularize and classify methods are working as expected on rails console :

"hist_versions_paquets_mesures".singularize  => "hist_version_paquet_mesures"
"hist_versions_paquets_mesures".classify  => "HistVersionPaquetMesures"
"hist_version_paquet_mesures".pluralize  => "hist_versions_paquets_mesures"

My app/model/hist_paquet_mesures.rb model :

class HistPaquetMesures < ActiveRecord::Base
  belongs_to :pub_indice
  belongs_to :pub_liste_horizon
  belongs_to :admin_utilisateur
  has_many :hist_versions_paquets_mesures
end

My app/model/hist_version_paquet_mesures.rb model :

class HistVersionPaquetMesures < ActiveRecord::Base
  belongs_to :hist_paquet_mesures
  belongs_to :pub_modification
  belongs_to :vers_origine, :class_name => 'HistOrigineModification', :foreign_key => 'hist_origine_modification_id'
  # polymorphic association
  has_one :comme_origine, :class_name => 'HistOrigineModification', as: :hist_origine
end

My app/controllers/history/hist_paquets_mesures_controller.rb controller :

class History::HistPaquetsMesuresController < ApplicationController
  def show
    @hist_paquet_mesures = HistPaquetMesures.find_by_id(params[:id])
    respond_with(:history, @hist_paquet_mesures)
  end
end

The weird thing is where the “s” go in “HistVersionsPaquetsMesure” of the error message : HistPaquetMesures::HistVersionsPaquetsMesure

Shouldn’t it be HistPaquetMesures::HistVersionPaquetMesures ?
Why do I have this result ?

Any help is welcome

  • 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-17T11:24:00+00:00Added an answer on June 17, 2026 at 11:24 am

    It’s a BUG !

    I opened an issue on this case.
    It seems the problem comes from ActiveSupport library.
    To get the class name it performs a “camelize.singularize”. As my inflections are defined with underscore, the expected result is incorrect. It would have worked if the library had performed a “singularize.camelize”.

    Workaround : add another irregular inflection with camelized syntax.

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

Sidebar

Related Questions

Can find why i get this error can someone help? package Android.data; public class
Can any one tell, how to get the result of LINQ query contains group
Can some one confirm me that only one UIWindow instance is possible in any
Can anyone tell me how an IDE like NetBeans or any for that matter
Can I change the field public virtual ClassOne ClassOne { get; set; } to
Can I authenticate with just Google account username and password instead of using OAuth?
Can someone thoroughly explain the last line of the following code: def myMethod(self): #
I am trying to find ID3V2 tags from MP3 file using jid3lib in Java.
That's pretty much it. I'm using Nokogiri to scrape a web page what has
I'm new to using the Perl treebuilder module for HTML parsing and can't figure

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.