NameError wrong constant name primary — yet `primary` doesn't exist? - ruby-on-rails

I am getting an error that randomly pops up whenever I make changes. If I refresh the page after getting the error, it goes away. The error:
NameError wrong constant name primary
I have searched my entire application and I do not have any methods or constants using the word primary. Why is my Rails application trying to call something that doesn't exist?

Okay, so it looks like this will be fixed in the next release. The fix was referenced here:
https://github.com/rails/rails/issues/36757
So, wait a week or two, update Rails and this will be resolved.
Edit: As a workaround, I reverted from 6.0.0.rc2 to 6.0.0.rc1

Related

Which does RailsAdmin initialize models from ("Uninitialized Constant" Error)?

I am trying to use RailsAdmin and am getting an Uninitialized Constant TableNameX error. I did indeed misspell TableNameX originally.
I figured that if I went and changed all the mis-spelled spots the problem would resolve itself. It hasn't, so I seem to be missing a spot--but my searches within Eclipse are not turning anything up!
Which folder/folder would RailsAdmin be reading from?
What does your trace look like?
Also have you looked into /config/initializers/rails_admin.rb to see if your TableNameX is there and you simply forgot to change it? :)
P.S: And don't forget to restart the server, initializers only run once at the server bootup.

Rails: Reloading code in development environment gives a "ApplicationHelper has been removed from the module tree but is still active!" error

I upgraded to Rails 4 and now when some changes are made to the code, or when I do a reload! in rails console, I will get an ArgumentError: A copy of ApplicationHelper has been removed from the module tree but is still active! error.
I'm not the only one with this problem but still cant find existing solutions that work yet.
I've never encountered that problem before. I'm using Rails4 as well.
I think you have to call your controller(which is shown in the ArgumentError) explicitly in your dependent controllers.
Can you try adding this line on top inside the class?
require "_controller"
Then try rails server -e production
See if this helps. Sorry I wish I could give you more detailed solution.
If all else fails, rollback might be an option to consider.

uninitialized constant Users ruby on rails

I have an app that I am working on, and there appear to be two key problems: due to a problem undetectable by me, the webapp I am working on returns the error "uninitialized constant Users" and the error "uninitiallized constant SubmitController." The code for the webapp is here. I have tried renaming multiple, possibly violating variables, and attempted to rid the app of the errors. However, I have not been sucessful. The code where the errors most likely originate are from app/views/users/show.html.erb, app/views/users/show.html.erb, app/controllers/user/submit.html.erb, app.controllers/user/submit_controller.rb, app/models/Submit.rb, app/models/user.rb, app/controllers/users_controller.rb, config/routes.rb.
Thanks in advance.
You have error because you don't have SubmitsContoller. Also you need to move app/controller/users/submit.erb to views folder. And one more rename file Submit.rb to submit.rb.
And to make it works create submit_controller.rb in controller folder.

Rails NoMethod Error when calling a dynamic attribute find

I am currently working on an app. In this app, I created a Person model and I was using rail's dynamic attribute find feature. In the Person model I have an attribute called uid, so I was calling Person.find_by_uid(some numerical value). This worked fine in my development mode and the app was totally functioning. However, once I deployed this app to heroku. The app failed and the log complains about NoMethodError (undefined method `find_by_uid' for #):
I have been looking all places, but still unable to track down the problem. I tried to define the method find_by_uid under the Person model, and still does not work.
I was wondering if anyone has had similar experience or knows how to solve this issue?
Thank you very much ahead of the time!
Did you try running the migrations in heroku (heroku rake db:migrate)? Most provably that attribute is not in the heroku data base so you don't have that dynamic method.
I ran into the same problem. heroku restart has saved me.

Cucumber/Selenium newbie trying to use RoR session-data in step-definitions ... and failing

I'm spending my first few days with cucumber/selenium trying to figure out whether RBB is the thing I want to use in my latest RoR project.
My setting: Rails 2.3.5, selenium-client 1.2.17, cucumber 0.4.4 etc, quite current in my view.
Following the instructions on https://github.com/cucumber/cucumber/wiki/Setting-up-Selenium I got cucumber/selenium sorts of up and running. Simple step-definitions do work and do produce outpout that makes sense (I dont usually expect more on my first few days with anything :-) ).
My problem: I am trying to access the rails session-hash in my step-definition...and failing miserably. Refering to "session" in any "given"-clause just presents me with "undefined method `session' for nil:NilClass (NoMethodError)"
Is there any secret handshake I am missing in the docs???? Anything that has to be configured my my environment so using the session-hash is possible?
Regards
Michael
This should happen right out of the box. If you add a debugger line right to a step definition you should be able to type "session" and see something like:
{:session_id=>"f978d4220252b7e1ca51fb7319d5a365", "flash"=>{}}

Resources