After setting up Spree, cannot start new Rails App - ruby-on-rails

I completed the Spree tutorial and and set-up an extension named spree_simple_sales. I created it in the directory of the Spree App I was creating, but problem is now I'm getting this message when I try rails new new_app_name (obviously not in same directory).
Users/me/.rvm/rubies/ruby-2.2.2/lib/ruby/site_ruby/2.2.0/rubygems/dependency.rb:315:in 'to_specs': Could not find 'spree_simple_sales' (>= 0) among 485 total gem(s) (Gem::LoadError)
I'm using Rails 5.0.
Any clue what's going on?

The spree_simple_sales gem is not installed by the looks of your error. It looks like 2.0.5 is the most recent version.
In gemfile
gem 'spree_simple_sales', '~> 2.0.5'
in terminal
bundle udpate
bundle install
It looks like you need to run a generator after that
bundle exec rails g spree_simple_sales:install
Documentation for the gem.

Related

Spring is troubling rails console to start

When i am trying to execute:
bundle exec rails console
It is throwing me error as:
/gems/spring-3.1.1/lib/spring/application.rb:96:in `preload': Spring only supports Rails >= 5.2.0 (RuntimeError)
Earlier it was working fine.
Can anyone help me with a workaround for this.
The workaround I did for this was to create a new project with rails 5.2.3 or something.
If you want to do the same, you can first list all your local gems by doing gem list rails --local
You will see all your rails versions installed locally.
Then do gem install rails -v '5.2.3'
Now go to a new project directory and run rails _5.2.3_ new appname
Now, you should be able to use the console, generate, migrate and other commands.
You can do bundle install after adding other relevant gems based on your apps requirement.

Geokit issue - "could not find generator"

I am trying to get started with Geokit, and I ran the install command and was greeted with the following:
rails g geokit_rails:install
Could not find generator geokit_rails:install.
Any idea what's going on? I am so confused. bundle install works just fine. I run bundle exec rake db:migrate. but when I go into the console, when I try require 'geokit', I get false. I assume it's because the config file is missing? But how do I generate a sample config file to modify if the install script is failing??
The problem is that your version of the geokit-rails gem does not contain the generator. It was added with https://github.com/geokit/geokit-rails/commit/bb4261acef62a26de823c4b7306634ffb7c3381f. The latest version of the gem is 2.1.0, and as you can see here, the generators were not part of that release.
If you want to use the head version of the gem, then you can change your Gemfile to match gem 'geokit-rails', github: 'geokit/geokit-rails'.

Specifying rails version to use when creating an api (rails-api)

I would like to create a rails-api with a specific version number for rails (i.e. 4.0.5) I would like to know how to proceed through the command line. Up to now I proceeding as if I would have to specify a rails version for an app but I'm getting some obvious error that it's not the way to proceed
rails-api _4.0.5_ new application_name -d mysql
error
Could not find 'rails-api' (= 4.0.5) - did find: [rails-api-0.2.1] (Gem::LoadError)
I think you need to install rails the standard way:
gem install rails -v=4.0.5
I am not familiar with rails-api but looks like it will only accept the rails-api version as a parameter, not rails itself. If it creates a rails app itself, it will certainly create a Gemfile. You could always change the rails version in the gemfile later and run bundle again:
gem 'rails', '4.0.5'
And run
bundle install

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

Kaminari gem doesn't seem to install

I added "gem 'kaminari'" to my gemfile and ran bundle per the instructions, and it looked like it installed, but I'm getting errors like 'current_page' method not found messages. The documentation indicates that there should be a kaminari directory created in my app/views directory, but there isn't one. I'm using rails 3.0.7. Is there a different/better way of installing this gem?
Thanks
Could you have forgotten to run the generator?
rails g kaminari:views default
That should create your kaminari directory.

Resources