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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:20:32+00:00 2026-05-27T08:20:32+00:00

I have a small library, say widget_utils.rb, that lives in the lib/ directory of

  • 0

I have a small library, say widget_utils.rb, that lives in the lib/ directory of the app. (I’ve set the config to autoload source files from lib/)

The utils include the ‘spira’ gem which does ORM mapping based on RDF.rb. In the widget_utils.rb file are class objects based on my RDF repository, and they refer to a type called Spira::Types::Native.

I have a static method in WidgetUtils that returns a hash based on RDF data for use in rendering, WidgetUtils.options_for_select.

If I launch the console, I can call WidgetUtils.options_for_select and get back my hash perfectly.

But if I run the server, and try to render /widget/1234 or /widget/1234/edit to show one widget, I get the error Unrecognized type: Spira::Types::Native

At the bottom of my stack trace is widget_controller.rb, and at some point the haml file is doing a “load” of “lib/widget_utils.rb”, and crashing with the Unrecognized type at the point where it’s referenced in the util source file.

From the console if I do “load ‘lib/widget_utils.rb'” I get no error, the type is recognized successfully.

I’m stumped, and too new to rails to successfully come up with a strategy to solve this problem outside of trial and error.

  • 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-27T08:20:33+00:00Added an answer on May 27, 2026 at 8:20 am

    As it turns out, this problem is specific to the Spira library I’m working with, and JRuby when serving pages.

    Spira keeps its collected known RDF types in a “settings” hash that it makes thread local. In most ordinary circumstances on MRI Ruby/Rails this isn’t an issue, since the requests are usually handled in the same thread as the Spira initialization.

    Similar problems will occur under JRuby if you attempt to make data global through, for instance, class variables. Some other mechanism needs to be found to make global reference data available to all service threads. (Mutable shared data is not even something to consider unless you like headaches.)

    There is a workaround for Spira that will keep its settings available. In my utility class I added this monkey patch to take the settings out of Thread.local:

    module Spira
      def settings
        @settings ||= {}
      end
      module_function :settings
    end
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have small web app that generate PDF files as a report. I'm trying
I have an ActionScript 2.0 file that contains a small library. This library parses
A bit context. Let's say I have source files, which need to end up
I have a small library of code that I am documenting with YARD .
When you need to have very small objects, say that contains 2 float property,
I have a small C# library with a static class that holds a very
I have small library i want to use for creating games. First, i tried
I have small test app: Socket socket = new Socket(jeck.ru, 80); PrintWriter pw =
i have small function that running on condintion, if text box value is not
The GMP docs say that static linking may provide a small performance improvement. I

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.