I'm using Authlogic 2.1.6 in Rails 3.0.1.
Everything works fine but I am consistently getting the same two errors, which stem from the acts_as_authentic command in my user model.
DEPRECATION WARNING: Base.named_scope has been deprecated, please use Base.scope instead. (called from <class:User> at /Developer/Products/sphr/app/models/user.rb:271)
I recall seeing an Authlogic commit that claimed to have fixed this bug but I can't find it.
Could you please tell me how to stop seeing these messages?
Thanks!
The calls to the deprecated methods have not been fixed in the master Authlogic repository. There are about two dozen pull requests fixing them on Github, though. If you feel so inclined, you can simply change your Gemfile to point to one of them instead.
gem 'authlogic', :git => 'git://github.com/exceed/authlogic.git'
Update: Those pull requests have finally been integrated in and you can use the standard gem again.
Related
I am using devise with Rails 4. I had a problem with some fields not rendering in the user views and I realised it's because of the attr_accessible that's not supported any more so I had a look around and came to the conclusion I should use the latest version of the gem (3.0.3).
And that's when the problem appeared:
I cannot run any rails commands now as I am getting the undefined method 'secret_key=' for Devise:Module (NoMethodError) error and it's not going away even if I downgrade the gem.
Rolling back to some previous git commit doesn't solve it, remove the gem and doing a bundle install again doesn't solve it, and I starting to think I should probably start from scratch.
Does anyone know how to walk past this?
I believe this setting is only available in the more recent versions of Devise, 3.1.x and above. You should either upgrade the gem to this version or remove that line that references secret_key= from your config/initializers/devise.rb file.
I just installed the newrelic_rpm gem in my RefineryCMS Rails 3.2.3 application. I copied in the newrelic.yml config file as per the instructions. My app is being deployed with Heroku on the Cedar stack, so the instructions were pretty simple.
https://devcenter.heroku.com/articles/newrelic#cedar
However, running "rails server" on my development box gave me this error message:
/home/xxx/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.2.3/lib/active_record/connection_adapters/abstract/connection_pool.rb:398:in `retrieve_connection': ActiveRecord::ConnectionNotEstablished (ActiveRecord::ConnectionNotEstablished)
Setting the agent_enabled value to "false" in the newrelic.yml file allowed the server to start up again. Setting my license key and app name environment variables made no difference.
Interestingly, even though I couldn't get the app to start on my dev box, when I deployed it to Heroku, everything worked fine - and I am now getting new relic stats. Great!
My workaround has been to remove newrelic_rpm from the gemfile (which is what the install instructions say to do), and put it only into a :production group. Obviously, new relic is only useful in production, so it's no big deal.
group :production do
... other gems
gem 'newrelic_rpm'
end
Anyone else ever experienced this, or know why it should be causing an ActiveRecord error (with no mention in the error trace of new relic at all)?
The issue you were running into looks like a bug in the newrelic_rpm gem that was addressed with our (I work at New Relic) recent 3.6.4 release. I'd suggest that you try updating to 3.6.4 to see if the issue persists.
By way of explanation: we have something in the newrelic_rpm gem called an EnvironmentReport, which gathers information about the environment your application is executing in (Rails version, gem versions, DB adapter, Ruby version, etc) to display in the UI. In version 3.6.0 of the newrelic_rpm gem, we pushed the generation of the EnvironmentReport into a background thread. Because the EnvironmentReport potentially referenced the ActiveRecord::Base constant, generating it could trigger some ActiveRecord initialization code paths that are not thread-safe. If the EnvironmentReport happened to hit ActiveRecord::Base at just the wrong time, it could trigger errors like what you were seeing on the main thread.
We addressed this in 3.6.4 by moving the generation of the EnvironmentReport back onto the main thread.
Sorry for the headache, and please let us know if 3.6.4 doesn't solve your issue.
Edit - hmm, just noticed that you asked about this before 3.6.0 was released. I'd still suggest trying 3.6.4, since I suspect a similar race condition may have existed in older versions of the newrelic_rpm.
Most rails projects have a very specific version included in their gemfile, right after a rails new foo.
For example gem 'rails', '3.1.3'
Would it not be better to change this to allow dot-version and e.g. define rails as gem 'rails', '~>3.2'?
How is rails version-numbering done? I see major changes between dot-releases, e.g. upgrading from 3.0 to 3.1 requires quite severe changes (mostly to the asset pipeline). How is that for subreleases? Is 3.2.1 a bugfixonly release of 3.2.0?
There's not really any reason not to use the ~> constraint, but you should put:
gem 'rails', '~>3.1.3'
since that will mean any 3.1.x that is at least 3.1.3. Putting ~>3.1 implies compatibility with any Rails version 3.x.
Rails versioning follows semantic versioning, as far as I know.
However, I think the idea of specifying the exact version is that you read the release notes with every release and make a specific effort to validate that it's okay. Ultimately it's all up to you, though. You should be sure you're somehow following a feed for Rails versions so you always know about security releases either way.
I have an app that runs great locally. Everything seems to be set up correctly to transfer over to Heroku, including the Postgres gem (and dev was done using a postgres server).
The problem is, when I try to push it up, I get error messages surrounding the three currently problematic dependencies, bson_ext, bson, and mongoid, 1.4.1. It seems that Sorcery requires these (at 1.4.1) to run. I got them installed locally by downloading the manually, but they were yanked from the online sources. So when Heroku tries to find them, it can't, and it aborts. I tried specifying to use 1.4.0 for all of them, and the app then installs fine (and does the database setup stuff for the Cedar stack, etc).
The problem is that when I load the app on their server, I get the generic "oops, there's been a problem" Heroku message. Upon checking the actual heroku log, I can't really find anything wrong. What is the way to make this work?
Thanks for your help.
I ran into the same problem, and I was able to get past it by specifying version 1.3.1 for the mongo, bson, and bson_ext gems. I just put this in my Gemfile:
gem 'mongo', '1.3.1'
gem 'bson', '1.3.1'
gem 'bson_ext', '1.3.1'
I was watching railscasts episode 177, as I need to implement some versioning in my app. But this episode was not done in Rails 3. So i went to the site of the gem itself.
https://github.com/laserlemon/vestal_versions
Now, it says it was tested with Rails 3, but even placing that line in the gemfile didn't let me install it. I just installed using gem install etc.
Now to even generate the migration is an issue, as I get the error
$ rails generate vestal_versions:migration
Could not find generator vestal_versions:migration.
Has anyone managed to succesfully use the gem that could give me advice?
Thanks a lot!
Do you have this line in your Gemfile?
gem 'vestal_versions', :git => 'git://github.com/adamcooper/vestal_versions'
and ran bundle install? That's the one that is in the readme on github and works for me. I had the same error of the missing generator when I used
gem 'vestal_versions'
in my Gemfile, which fetches the gem from rubygems.org, which is pretty old and does not contain the proper generators yet. Using the gem from Github should work.
Btw, I'm not sure which fork on github is the best. There are several that do contain some fixes.