Seedbank, nothing happens when doing rake db:seed anymore - ruby-on-rails-3

I just installed seedbank gem : https://github.com/james2m/seedbank which is exactly what I was looking for! (I'm actually surprised this kind of feature is not in the core Rails, but anyway, thanks james2m)
My problem is, nothing happens when doing rake db:seed -v. Not even the former seeds.rb generation.
I guess this is the best place to report the issue.
I don't really know what information will be useful to help me, so here I go, without order:
1- Content of /db:
/db
| candidate.seeds.rb
| item.seeds.rb
| seeds.rb
| user.seeds.rb
2- Gem file extract
source 'https://rubygems.org'
gem 'rails', '3.2.13'
gem "seedbank", "~> 0.2.1"
and I've run bundle install with no error.
3- Version numbers
$ rails -v
Rails 3.2.13
$ rake -V
rake, version 10.0.4
Thanks in advance for any help.

Not sure if you sorted this out or not but I think your directory structure was/is incorrect
/db/seeds.rb (runs on all environments)
/db/seeds/candidate.seeds.rb
/db/seeds/item.seeds.rb
/db/seeds/user.seeds.rb
These will run for all environments. If you only want development then do this structure instead
/db/seeds.rb (runs on all environments)
/db/seeds/development/candidate.seeds.rb
/db/seeds/development/item.seeds.rb
/db/seeds/development/user.seeds.rb

Related

Devise Installation Not Working

I am trying to install the devise gem but when i use the command
rails g devise:install
i get the error message :
Could not find generator 'devise:install'. Maybe you meant 'responders:install', 'simple_form:install' or 'scss:assets'
Run rails generate --help for more options.
can anyone assist me in rectifying this issue?
Try to to solve this by deleting my Gemfile.lock, doing bundle install again and then stopping spring with spring stop I could then call the generator without root privileges
OR
Try command:
sudo rails generate devise:install
This is mostly a typo if you copied it from the github repo.
I had a similar issue.
Make sure you added the gem in the gemfile as gem 'devise'
Run in your project directory: rails generate devise:install

require gem issue

I have installed google api client with the following code and it installed successfuly.
gem install google-api-client
I am using rails 3.0.3 so i also included the above line bundler and ran bundle install which went successfully.
I have also rvm installed. And created a gemset.
And when I run the following command in the terminal:
gem environment | grep INSTALLATION | awk '{print $4}'
It gives me the following result
/home/jamal/.rvm/gems/ruby-1.9.3-p194
When i try to execute the following code in scintilla outside the project directory. It gives me an error.
require 'rubygems'
require 'google/api_client'
ERROR:
usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- google/api_client (LoadError)
from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
What is the main reason of this kind of error?
Possible chances are your editor does not loading the specific gemset in which you install the gem.
Please provide output of gem list google-api-client -d in your questions. So that I can figure it out exactly what is going one.
EDIT:
Another issue which usually occurs are the dual installation of ruby. When we do have a system level installation and a rvm installation, many editor got confused in it. They load up original system installed ruby which do have prefixes like 1.8.7, 1.9.1and available in /usr/share/bin/. Where was you had installed the gem in rvm profile. To overcome this problem you must run your code from terminal after choosing the right gemset
I had that google/api_client (LoadError) message but, it concerned another Google gem.
gem 'google_drive', '~> 0.3.10'
gem 'google-api-client'
I just removed the , '~> 0.3.10' part in case of it was a compatibility problem. That did the trick:
Using google-api-client 0.7.1 (was 0.9.4)
Installing google_drive 1.0.6 (was 0.3.11)

RVM: Incorrect Ruby version referenced after removal

Just updated the version of Ruby (1.9.2 to 1.9.3) I have installed but now getting the following error when running rake:
$ rake
-bash: /Users/mike.simmonds/.rvm/gems/ruby-1.9.3-p0/bin/rake: /Users/mike.simmonds/.rvm/rubies/ruby-1.9.2-p180/bin/ruby: bad interpreter: No such file or directory
Any tips?
It appears reinstalling the rake gem has fixed it.
looks like a gem pristine task failed and you had older rvm, I have already changed the upgrade code to run upgrade for every gem separately and report you list of failed gems.
It's important to read outputs of rvm, even we try to automate things and make things very easy - sometimes there is not much we can do with the available tools.

How to uninstall a gem from Rubymine

I'm a n00b in Rails and Rubymine IDE. The Rubymine Help says to
To uninstall gems, use command line procedure. So doing, the
recommended command format depends on the Ruby gems version you use.
gem uninstall <gem_name>
Could not how to figure out where to run the command and the Help does show this either. Let me know if there are any add'l steps that need to be done, such as unbundling the gem.
Thanks in advance.
Just run in the terminal/console a command:
gem install <gem_name>
In case if you using several RVM sets, then go to File/Setting/Ruby SDK and Gems and check which gem set used by RubyMine. Then check the gemset in terminal by command:
rvm gemset list
You will see the current gem set, you can change it if you need by command:
rvm gemset use <gemset_name>
And then do the uninstalling.

Project broken with Bundler errors after RVM install

I installed RVM and installed 3 different rubies: 1.8.7, ree, and 1.9.2.
I have a Rails 3.0.9 project that uses 1.8.7.
Now when I try to run the 3.0.9 project, I get this error:
Could not find xml-simple-1.1.0 in any of the sources
However, the following command:
bundle show xml-simple
yields:
/Users/me/.rvm/gems/ruby-1.8.7-p334/gems/xml-simple-1.1.0
Looks right to me. What am I missing here? The application, when running, is clearly not seeing the right path. Yet Bundler, when run at the command line, sees it just fine. I am not certain where these paths are to be set. I am admittedly new to RVM, I installed it because I want to start a new edge project with 1.9.2.
Thank you for any help you can provide.
I needed to learn how to create a gemset, then switch to that gemset. You can always check your gem and ruby environment with rvm using:
rvm info
That's what clued me in. Once I "use"d the appropriate gemset where the gem was installed, it worked great.