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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T11:20:12+00:00 2026-06-07T11:20:12+00:00

I am writing a plugin in Rails 3.2.6 – my plugin is supposed to

  • 0

I am writing a plugin in Rails 3.2.6 – my plugin is supposed to modify my User model (located in app/models/user.rb) – however, I cannot find the proper way to reference that file from the plugin in a require statement.

I tried require 'user', require 'app/models/user', and a bunch of stuff trying to use Rails.root and other variables – nothing works and I get an error “Uninitialized constant User” when trying to run the app.

Can someone please point me in the right direction? BTW, this plugin was build as a gem and is included in my Gemfile (which pulls it from github).

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-06-07T11:20:14+00:00Added an answer on June 7, 2026 at 11:20 am

    If you are on ruby 1.9, you should be able to use require_relative

    #assuming /lib/yourfile.rb
    require_relative '../app/models/user.rb'
    

    If you are on an older ruby, you might try

    require File.dirname(__FILE__) + '../app/models/user.rb'
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a Rails 3 plugin and I'm using Engines. I have and app/
In brief i'm writing a plugin for a Rails app and I want to
I am writing my first ever plugin for rails. The plugin is supposed to
Rails does model loading on demand. For a rake task that I'm writing, I
I'm writing a Rails plugin (lets call it Foo). I want it to provide
I'm writing my first rails plugin and could use a little help. In a
I'm writing a plugin that needs some inflections of it's own. Using rails 2.3
How reliable is this plugin for writing down migrations. Some people in the rails
I'm trying to start a Rails app from Maven exec plugin. I'm using ./script/rails
I'm writing a Rails plugin, and need to be able to dynamically determine which

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.