I just installed Ruby 2 and Rails 4, and I created a new project. I made a devise user, and then I went to run the server. I got the error
/Users/michaeldunnegan/.rvm/gems/ruby-2.0.0-p247#rails-4.0.0/gems/railties-4.0.0/lib/rails/application/routes_reloader.rb:10:in `rescue in execute_if_updated': Rails::Application::RoutesReloader#execute_if_updated delegated to updater.execute_if_updated, but updater is nil: #<Rails::Application::RoutesReloader:0x007f85ac132458 #paths=["/Users/michaeldunnegan/projects/SoundShare/config/routes.rb"], #route_sets=[#<ActionDispatch::Routing::RouteSet:0x007f85ac188e48>]> (RuntimeError)
I have absolutely no idea what to do. Configuration is pretty weird to me. I think the error might be in my path, whatever that is, but I can't be sure.
My rvm current looks like: ruby-2.0.0-p247#rails-4.0.0, if that's relevant
This is a known bug with rails 4 and devise.
Please see the rails issue on github
Related
Im in the middle of performing an edge ruby and rails update for a web app built in rails 2.3.18 and running ruby 1.9.3.
I have been incrementally been updating the rails version and fixing breaks and things have been moving forward at a steady pace. I have currently made it to ruby 2.1 and rails 3.2.x.x. and have made the push to rails 4.0.0
I have dealt with alot of breaks and errors since the 4.0.0 update and can now get the server to start using rails s but im now getting a new error.
I cannot find literally anything about this error online so im hoping i'll have better luck here. Thx in advance.
This is the line in my controller that triggers this error. Keep in mind this is not my code. Im updating a 8 year old system.
class WpPosts < ActiveRecord::Base
establish_connection "blog"
end
This is the specific line that is firing off the error, but I get this error wherever the is any active record call. Even simpley calling a model in rails console get me this same error.
Things like calling User in rails console get me that same error.
I have already tried:
gem install activerecord -v=4.0.0
and that still gets me the same error. Ive also unistalled all other versions of activerecord.
There is a very short stack trace wich leads me to believe the railties lib is not loading. Or that maybe theres an issue with the path to that lib.
app/models/wp_posts.rb:1:in `<top (required)>'
app/controllers/default_controller.rb:28:in `start'
this is a screenshot of the top of my application.rb file
An application I work on is using Rails 3.2.18 and Active Record 3.2.18. It was using Ruby 2.0.0, but someone from DevOps needed to upgrade to Ruby 2.2.4 today. Once users started making traffic on the site, everything started to explode. The administrators can't even access Active Admin.
After digging into this for quite some time, I realized I was thrown off by an error I was constantly seeing:
NoMethodError: undefined method `name' for nil:NilClass
Since some of my models have a name attribute, I assumed this was the culprit.
Long story short, the issue is with calling size on an Active Record has_many relation that has not yet been loaded into memory. Here is how I can demonstrate this in Rails' console:
model_instance = MyModel.find(12345)
model_instance.some_relations.size
# the error from above will be thrown (nomethoderror on name: for nil)
model_instance.some_relations
model_instance.some_relations.size
# it works fine and produces expected output
Also, model_instance.some_relations.count will always work (though I do understand the differences between count and size).
I have found surprisingly little on this issue. There is a related GitHub issue here, but I can't prove it's the same issue I am having.
I am going to rollback my release which upgrades to Ruby 2.2.4 for now, but was wondering if anyone can shed some light on this. Is there a bug between Active Record 3.2.18 and Ruby 2.2.* ? Is the only solution, assuming I need to upgrade to Ruby 2.2.4, to upgrade Rails as well?
This is indeed a conflict between Rails 3.2.18 (and a few other patch versions) and Ruby 2.2.*. It is documented here.
Aside from updating to a supported version of Rails, which may not be viable solution for some production applications, the Rails version could be updated to branch: 3-2-stable.
I had this issue a couple of months ago, posted it on Spree's GitHub page, then figured out the solution myself and posted it on that same issue. Two months later, I'm still getting comments on that same issue from Googlers who had the same error message, so I figure it's worth posting my solution on this website as well just in case anyone is having the same problem but isn't looking on GitHub.
The issue: trying to create a brand new Spree app, following the exact instructions in Spree's documentation, gives the following error when you try to run spree install --auto-accept or rails g spree:install:
undefined method `raise_in_transactional_callbacks=' for ActiveRecord::Base:Class (NoMethodError)
Solution below...
The problem: I'd created a new rails app with rails new, which had automatically created an app using rails 4.2.0beta. Then I had issues with gem incompatibilities, so I'd changed the version number of a few gems, including downgrading Rails back to 4.1.8.
BUT the config setting raise_in_transactional_callbacks is new in Rails 4.2.0, so in earlier versions of Rails it will raise an error. If you're getting this error message you need to remove the line config.active_record.raise_in_transactional_callbacks = true from config/application.rb.
I have AS (as a plugin) working in another app just fine (I dont remember this
issue...) - its also using Rails 2.3.9, on same dev box.
Now trying to add it to a new app and getting this error when running
the webrick, script/server:
/Users/kimptoc/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.9/lib/
active_support/core_ext/module/aliasing.rb:33:in `alias_method':
undefined method `number_of_pages' for class `Paginator' (NameError)
from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p302/gems/
activesupport-2.3.9/lib/active_support/core_ext/module/aliasing.rb:
33:in `alias_method_chain'
from /Users/kimptoc/Documents/ruby/borisbikestats/vendor/plugins/
active_scaffold/lib/extensions/paginator_extensions.rb:9
I couldn't find any previous references to this error.
Embarassingly I dont know which version of AS I am using successfully... it says 1.2RC1 in the CHANGELOG file, but I seem to remember trying a few of the forks...(is there somewhere I can see which fork is in use...). I have tried using the the 'main' activescaffold in the new project, but it fails as above, but so does using the same plugin that is in the working project :(
Thanks in advance for any pointers as to what I am doing wrong.
Thanks,
Chris
PS Just realised that new Rails was using Rails 3 and old/working one was 2.3.9. It seems you need to use an alternate branch of AS for Rails 3, like this : https://github.com/vhochstein/active_scaffold/wiki
This is just a guess, but built in pagination was removed in Rails 2 as I recall, and you needed to install the classic_pagination plugin to get that functionality back.
I only used ActiveScaffold once, but the error there says paginator_extensions.rb ... it's probably monkey patching the old Rails paginator? Therefore the class exists but the number_of_pages method doesn't.
As you can see at https://ssl.virtualweb.at/redmine/ i try to get Redmine up & running.
At the start i got this error:
undefined method `mattr_accessor' for ActiveSupport::Deprecation:Module
Could someone be so nice an give some tipps how to get it to run?
t.i.a.
Can you give us a little more information? For example - can you go and look at the logs and find the full backtrace of the error that is occurring?
Otherwise we don't know where the error is occurring. Then we can narrow it down a bit better
My best guess atm, though, is that you have the wrong version of ruby or rails or rake (or something similarly important). mattr_acessor is a fundamental method in ruby - so I'd start by reading the redmine docs to see what version of ruby you need.
Then go check if you've got that version installed... repeat with rails, required gems etc.