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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T23:24:53+00:00 2026-05-20T23:24:53+00:00

I am getting this error when running some unit tests (using the Test::Unit module

  • 0

I am getting this error when running some unit tests (using the Test::Unit module included in Ruby/Rails) that call a method that uses some SettingsLogic feature:

RuntimeError: Called id for nil, which would mistakenly be 4 — if you
really wanted the id of nil, use
object_id

More specifically, I have written some unit test in order to test some methods in my models. These methods use SettingsLogic feature but it seems that something wrong is happening here. I run a test console and checked that Settings class is defined. However, I cannot access my Settings value hash.

script/console test
Loading test environment (Rails 2.3.10)
DEPRECATION WARNING: require "activesupport" is deprecated and will be removed in Rails 3. Use require "active_support" instead. (called from /var/lib/gems/1.8/gems/activesupport-2.3.10/lib/activesupport.rb:2)
>> Settings
=> Settings
>> Settings.blah
RuntimeError: Called id for nil, which would mistakenly be 4 -- if you really wanted the id of nil, use object_id
    from (erb):32
>> exit

Whereas in development environment I get:

script/console
Loading development environment (Rails 2.3.10)
>> Settings
=> Settings
>> Settings.blah
=> {"gadget_type"=>{"alarm_history_table"=>{"max_printable_rows"=>200, "max_visible_rows"=>14, "_id"=>5, "rows_per_page"=>100}, "text"=>{"_id"=>2}, "current_state_table"=>{"max_printable_rows"=>200, "max_visible_rows"=>14, "_id"=>1, "rows_per_page"=>10}, "column_based_history_table"=>{"max_printable_rows"=>200, "max_visible_rows"=>14, "_id"=>6, "rows_per_page"=>100, "related_states"=>{"unit"=>17, "description"=>49}}, "entity_history_table"=>{"max_printable_rows"=>200, "max_visible_rows"=>14, "_id"=>4, "rows_per_page"=>100}, "chart"=>{"_id"=>3}, "access_type"=>{"url"=>1, "file"=>2}}}
>> exit

I am running tests manually, i.e. not with rake test but with ruby unit/my_model_test.rb

The settings.rb model is the following:

class Settings < Settingslogic
  source "#{Rails.root}/config/application.yml"
  namespace Rails.env
end

And the application.yml settings file:

defaults: &defaults
  blah:
    gadget_type:
      access_type:
        url: 1
        file: 2
      current_state_table:
        _id: 1
        max_visible_rows: 14
        rows_per_page: 10
        max_printable_rows: 200
      text:
        _id: 2
      chart:
        _id: 3
      entity_history_table:
        _id: 4
        max_visible_rows: 14
        rows_per_page: 100
        max_printable_rows: 200
      alarm_history_table:
        _id: 5
        max_visible_rows: 14
        rows_per_page: 100
        max_printable_rows: 200
      column_based_history_table:
        _id: 6
        max_visible_rows: 14
        rows_per_page: 100
        max_printable_rows: 200
        related_states:
          description: <%= Property.find_by_name('description').id %>
          unit:  <%= Property.find_by_name('units').id %>

development:
  <<: *defaults

test:
  <<: *defaults

production:
  <<: *defaults

RUBY VERSION: ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
RAILS VERSION: 2.3.10
SETTINGS LOGIC: 2.0.6
Thanks!!

  • 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-20T23:24:54+00:00Added an answer on May 20, 2026 at 11:24 pm

    FIXED

    The problem was the embedded ruby in the yaml:

    Property.find_by_name('description').id
    

    I did not have the properties fixtures so for this reason it failed.

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

Sidebar

Related Questions

I am getting this weird error while running cucumber test: ERROR Mongo::OperationFailure: Database command
I am getting this R6034 error when running program that I just updated (and
I'm getting this error pointing to some .so file when running my application on
I'm running Ruby ruby 1.9.3p125 and I keep getting this error which is making
I am getting this error While running this LoadError: Expected /home/user/Desktop/Tripurari/myapp/app/models/host.rb to define Host##
I'm getting this error message whiile running a Webservice I'm working on. it builds,
I'm getting this error when trying to access my webservice running inside tomcat. Caused
I'm running Valgrind and I'm getting the following error (this is not the only
I am getting ERROR when I am running this program at the line static
I'm getting this error when running an SSIS package through SQL Agent Failed to

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.