Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update the readme to include a step about autoload_paths #50

Closed
kayzee opened this issue Jan 5, 2015 · 6 comments
Closed

Update the readme to include a step about autoload_paths #50

kayzee opened this issue Jan 5, 2015 · 6 comments

Comments

@kayzee
Copy link

kayzee commented Jan 5, 2015

I followed the steps in the readme to create an enum for Gender, however I kept getting the following error after updating my model:

NameError: uninitialized constant Gender

I ended up adding the following line to application.rb:

config.autoload_paths += %W(#{config.root}/app/enums)

For the record, I'm using Rails 4.1.6 and Ruby 2.2.0.

Should this step be in the Readme or is it assumed that we should know to update the paths?

@beerlington
Copy link
Owner

I used to have a note about this in the README but then pulled it out because I didn't think it was needed. I haven't had to add it for any recent Rails apps I've worked on, but maybe it's a change with Ruby 2.2.0?

I'll dig into it more, thanks for reporting!

@beerlington
Copy link
Owner

I'm not able to recreate this issue win a new Rails application. Would it be possible for you to create an example app that demonstrates the issue? If not, maybe post your Gender enum class? Can you also confirm that the enum is in app/enums/gender.rb?

@beerlington
Copy link
Owner

Closing since I haven't received a response in over a month.

@sakirtemel
Copy link

I'm having the same problem, I've added enums folder to autoload_paths and now solved.

Rails 4.2.0
ruby 2.2.1p85 (2015-02-26 revision 49769) [x86_64-linux]

@beerlington
Copy link
Owner

Reopening since @sakirtemel reported the same issue. I haven't been able to recreate it, but maybe someone who's experiencing it might have some insight.

@beerlington beerlington reopened this Mar 12, 2015
@patrickberkeley
Copy link

I hit this issue using Rails 4.2.1 and Ruby 2.2.0p0. Adding enums to the autoload paths fixed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants