Rails generator error rspec [not found] - ruby-on-rails-4

I am using rails 4.1.1
When I execute the command rails g generator my_generator
The generator runs but always ends with error rspec [not found]
I have added the rspec and rspec-rails gems to my Gemfile.
What step am I missing to get this working?

You do not need to add rspec to your gem files, just rspec-rails.
After you bundle install run rails generate rspec:install and everything should work fine.

The recommended way to install RSpec by the the rspec-rails repository is:
Add rspec-rails to both the :development and :test groups in the Gemfile:
group :development, :test do
gem 'rspec-rails', '~> 3.0'
end
After that run bundle install and your RSpec should run fine.

Related

Rails:Is it possible to use active_scoffold gem in rails 4.2.6

I installed that gem,when I run
rails g active_scaffold:install
It says
Running via Spring preloader in process 6001
Could not find generator 'scoffold'. Maybe you meant 'scaffold', 'css:scaffold' or 'erb:scaffold'
Run rails generate --help for more options.
gemfile
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'active_scaffold', github: 'activescaffold/active_scaffold', branch: 'master'
I found the solution
I changed the steps to install the gem, that steps are
1.Insert the gem in gem file, gem 'active_scaffold' and run bundle install.
2.Run the command "rails g active_scaffold User name:string".
3.In gemfile change gem 'active_scaffold' to "gem 'active_scaffold', github: 'activescaffold/active_scaffold', branch: 'master' " and install the bundle once again.
4.Create a DB by "bundle exec rake db:create".
5.Run "rails g active_scaffold:install".
6.Finally migrate it "rake db:migrate"

Rails 4 bundler: command not found: rails

I am guessing that this answer has been already answered somewhere but I was not able to find it. I am having troubles with installing Rails 4. I have put in the Gemfile:
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.1'
And I have run bundle install --path vendor/bundle and all the gems are installed, but when I run bundle exec rails s then I receive an error:
bundler: command not found: rails
Install missing gem executables with `bundle install`
which rails doesn't returning anything. I am using ruby 2.0.0 and rvm and it seems everything has been set up.
What am I missing and how to set-up Rails 4?
What solved my problem for Rails 4, in this case, was running a command in the root directory of the application:
bundle exec rake rails:update:bin
After that , running a bundle exec rails s reported no errors and was working as expected.
In Gemfile please add
ruby 2.0.0
or
Try to use .ruby-version and .ruby-gemset.
Please read this

Rails Gem Kaleidescope Won't Install

I am trying to use the rails gem Kaleidoscope and I'm having some trouble getting it installed. For reference here is the github site: https://github.com/JoshSmith/kaleidoscope
I include it in the Gemfile and it bundles just fine. But it does not install the config/initializers/kaleidoscope.rb.
I then tried to gem install directly, but it keeps telling me that
$ rails generate kaleidoscope:install
Could not find generator kaleidoscope:install
Does anyone have any ideas to help get it working?
Change your gemfile entry for the kaleidoscope gem to this:
gem 'kaleidoscope', :git => "https://github.com/JoshSmith/kaleidoscope"
The run
$ bundle update
This solved the issue on a Rails 4 app just now for me.

ActiveAdmin: gem not checkout, run bundle install first

In a Rails 4 app, I am trying to use ActiveAdmin 1.0.pre2. bundle install doesn't complain and seems to have included the gem and it works properly.
I am having this in my gem file:
gem 'activeadmin', github: 'gregbell/active_admin'
$> bundle show activeadmin
/home/aslam/.rvm/gems/ruby-2.1.0#monaeo/bundler/gems/active_admin-3fb7f03335b1
Even after running bundle install several times, I keep getting the following error:
git://github.com/gregbell/active_admin.git (at master) is not yet checked out.
Run `bundle install` first.
I am using
Bundler version 1.6.0.rc2 (upgraded from 1.5.3)
Ruby: ruby 2.1.0p0 (2013-12-25 revision 44422) [i686-linux]
Rails: 4.0.4
I am not sure what is going wrong here?
Try to install a prerelease version of Bundler:
gem install bundler --pre
It should solve the problem.
Use following in the Gemfile
gem 'activeadmin', :git => "git://github.com/gregbell/active_admin.git"
This way when you run bundle install, activeadmin would be sourced from its github repository.
Two things
A. You need to include like this in the gem file since 0.6.x is stable and maintained.
gem 'activeadmin', github: 'gregbell/active_admin', branch: '0-6-stable'
B. You can give a try by forking from the stable version of activeadmin
My solution:
rake rails:update:bin
bundle install

How to install activerecord-sqlserver-adapter (~> 4.0.0)?

I have a Rails 4 project and use activerecord-sqlserver-adapter. The readme installation suggests:
gem 'tiny_tds'
gem 'activerecord-sqlserver-adapter', '~> 4.0.0'
However, bundle install returns:
Resolving dependencies...
Could not find gem 'activerecord-sqlserver-adapter (~> 4.0.0) ruby' in the gems available on this machine.
rubygems.org show the latest version as 3.2.12. How can I bundle install version ~> 4.0.0 as 3.2.12 only supports ActiveRecord 3.x?
Why not just Source version 4.0.0 of activerecord-sqlserver-adapter directly from Github.
In Gemfile
Replace
gem 'activerecord-sqlserver-adapter', '~> 4.0.0'
With
gem 'activerecord-sqlserver-adapter', '~> 4.0.0', :git => "git://github.com/rails-sqlserver/activerecord-sqlserver-adapter.git"
They have not provided support for Rails 4 yet, you can try below gem to obtain same thing.
sudo gem install sic-activerecord-sqlserver-adapter
This will work with Rails 4 definitely, i have tried this. thanks.
It says that the adapter is missing.
You should install ruby-odbc and it should work.
gem 'ruby-odbc', '0.99995'