cannot load such file -- devise/schema (LoadError) - ruby-on-rails

After I added the devise_rpx_connectable gem to my Gemfile, I cannot run rails server anymore or migrate to add a column to my Users table. I'm trying to follow the railscast example here:
http://railscasts.com/episodes/233-engage-with-devise?view=comments
I have tried several things over the last two days to try getting this thing to work. I've tried creating the migration file myself but when I run 'rake db:migrate --trace' the error I get is "rake aborted! cannot load such file -- devise/schema" and a lot of errors underneath starting with:
C:/.../devise/ruby/1.9.1/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251 in 'require'
I have tried googling this question and only found a handful of people with the same issue, none of which had their questions answered. Seems other people with 'cannot load such file' errors were told their versions of certain gems weren't compatible so I'll provide that info here:
Gemfile:
gem 'rails', '3.2.6'
gem 'devise', '2.1.2'
gem 'devise_rpx_connectable', '0.2.2'
Also my bundler version is 1.1.4 and my ruby version is 1.9.3
The only thing that stands out to me is that the version of ruby in the devise folder seems to be 1.9.1 and mine is 1.9.3 but I would like to know the possible consequences of downgrading to 1.9.1.
Any input would be greatly appreciated!
Thanks

So we decided to delete the contents of the schema.rb file that "require 'devise/schema.rb'" was in and our app magically worked! I had no idea the implications of this so i did some more research and found this-
https://github.com/nbudin/devise_cas_authenticatable/commit/44aacb23fb5b4cc9d22434c952b9d1d88fe28e88#commitcomment-1555733
turns out that with the newer version (> 2.1) of devise, the contents of this file aren't necessary. hope this solves a lot of other peoples issues, especially if they decide to update the devise gem and continue to use devise_rpx_connectable.

Related

Bundler 2, Gemfile not found error when running any rails or rake command

I am setting a new app, stack is:
ruby: 2.6.1 (using rvm)
rails: 5.2.2
bundler: 2.0.1
Now thing is, bundler 2 doesn't use Gemfile at all, i have proper gems.rb and gems.locked and everything was working properly until i pulled some code from a co-worker which got merged.
Issue is whenever i run any rake or rails command i get this error:
/path/to/proj/Gemfile not found
I then even tried going back to old master when that code was not merged and issue is still there. So it is probably not something in the code i pulled.
And issue seems persistent in different machines.
I know there are other issues which have similar errors of Gemfile not found but those are mostly those which had wrong directory opened or some gem issued fixed by bundle update or gem update type commands, this is not that issue because. This is something else, because bundler 2 doesn't even need Gemfile.
It looks like rails doesn't support using gems.rb and gems.locked. https://github.com/rails/rails/issues/31295
You could try what that guy did and edit some files, or you could rename your gems.rb back to Gemfile and gems.locked back to Gemfile.lock

Duplicated key at line 80 ignored: "name" rvm

This doesn't seem to have affected anything, it's just irritating in my terminal - I regularly receive the following warning (sometimes I receive multiple, calling out different lines, and sometimes the path after /gem/ varies, but other than that, this is the output:
/Users/alecwilson/.rvm/gems/ruby-2.2.1/gems/fog-1.23.0/lib/fog/rackspace/mock_data.rb:42: warning: duplicated key at line 80 ignored: "name"
It's most common when bundling and running rake test. Any idea on how to fix it? I'm generally pretty wary of editing files in my .rvm directory, as I've royally screwed it up before, and still sometimes get a warning about my PATH being incorrectly set up (but only occasionally). If anyone can walk me through what is causing this, I'd be very grateful.
As #jBeas said in the comments go find the latest fog gem version https://rubygems.org/gems/fog
Then update the fog gem in your rails gemfile, currently your fog gem should be:
gem 'fog', '1.38.0'
This used to be a recurring error for users who had followed along with the Rails Tutorial for Rails 4 where the Tutorial guided the users to use an outdated version of the Fog gem, 1.23.0 (it was the updated version at the time the Rails Tutorial was written).
Now that the rails tutorial has been recently updated for Rails 5 the fog gem is currently up to date: '1.38.0'.
UPDATE for those coming from Rails Tutorial
The latest prevailing wisdom is to use carrierwave-aws gem rather than fog, significantly reducing your app's footprint. The switch took me about 15 minutes and reduced my gem dependencies by 33. Advice taken from Mike Perham, the creator of Sidekiq: http://www.mikeperham.com/2016/02/09/kill-your-dependencies/

Installing/Running Spork-Rails on Rails 4

After installing spork-rails I get this error when running 'spork':
Andrews-Mac-Pro-4:lb_final chapmanf16$ spork
/Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/spork:23:in load': cannot load such file - - /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/gems/spork-1.0.0rc3/bin/spork (LoadError)
from /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/spork:23:in'
from /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in eval'
from /Users/chapmanf16/.rvm/gems/ruby-2.0.0-p247/bin/ruby_noexec_wrapper:14:in'
If I run 'sudo spork' none of my gems are being located. I will get the following errors:
Using RSpec, Rails
Preloading Rails environment
Could not find actionpack-4.0.0 in any of the sources
It literally can't find any gems because if I list the versions of the gem being mentioned and install only the version it is asking for, it will tell me the next gem is not install. I'm just trying to figure out why the path to my gemfile is not being recognized by spark. I have only started learning ruby/rails for the past 3 days so I'm completely out of my element, but I am really not sure what to do. Any help would be appreciated.
I also posted this question I have on spark-rails github -https://github.com/sporkrb/spork-rails/issues/20
spork-rails from RubyGems doesn't support Rails 4. Try to update you Gemfile with a github reference for the spork:
gem 'spork-rails', github: 'sporkrb/spork-rails'
and run bundle update

Ruby on Rails - How can I resolve this 'rake db:create' error?

I am trying to get a simple tutorial app up and running with Rails, but have run into this problem almost right away. I create the new ruby app, cd to the directory and run rake db:create. I get the following
Please install the sqlite3 adapter: 'gem install activerecord-sqlite3-adapter' (sqlite3 is not part of the bundle. Add it to the Gemfile.)
But I do have the gem added to the Gemfile, like so:
gem 'sqlite3'
Also, when I tried to gem install the adapter, I was given an output saying that it did not exist in any repository. This is my first time using rails, any ideas on how to fix this?
*Edit
gem install activerecord-sqlite3-adapter produces the following:
Error: Could not find a valid gem 'activerecord-sqlite3-adapter' in any repository.
The it offers some alternatives, only one of them being sqlite3. It is called activerecord-jdbcsqlite3-adapter. Is this the one I need possibly?
Thank you for everyone's input. I never was able to resolve this issue, and ended up just using the Rails Installer instead. So much easier, just make sure you delete all your previous versions of Rails, Ruby, Gems, everything. Then use the installer.

How can my Rails app accept RAILS_GEM_VERSION minor version bumps

My rails project has this line in /config/environment.rb
# Specifies gem version of Rails to use when vendor/rails is not present
RAILS_GEM_VERSION = '2.3.2' unless defined? RAILS_GEM_VERSION
As we now have 2.3.5 as the most recent upgrade, is there a way to make my environment.rb accept minor version bumps?
(without I have to explicitly change 2.3.2 to 2.3.5)
No, there isn't.
You application needs to use a specific Rails version mostly because different tiny releases might require additional steps to upgrade the framework such as changes to boot.rb.
$ rake rails:update
Things have evolved a bit since Rails 2, so Ill share what I had to do to get from 5.0.0 to 5.0.0.1 today.
My Gemfile read gem 'rails', '~> 5.0.0'. I figured that was enough, but bundle install was not updating anything new. So I tried to force it with gem 'rails', '~> 5.0' which also did nothing new when I ran update (note: this is for an experimental app of my own, and not someone else's app I am working on - don't just default to allowing minor version updates to solve problems like this ;) ). So I had to try a few other ways to force this security patch/hotfix.
First, I had to install the package locally:
gem install rails --version 5.0.0.1
Next, I updated bundler:
bundle install
...and I saw this in the output: Using rails 5.0.0.1 (was 5.0.0)
When I ran ./bin/rake rails:update, it wiped the contents of my config/routes.rb file, changed many of my settings in various config files (some of which were dangerous security settings to change), among a few other seemingly benign changes. While this is the expected behavior, I am pointing this out as not exactly a desirable method for updating a minor patch/hotfix for rails.
Firstly, you need to change the version to 2.3.5 from 2.3.5 and then run
rake rails:update

Resources