I want to set up Spree using the core, backend, and api gems. I've installed Spree 2-2-Stable, successfully ran migrations, seed, and set up the admin user, and rake routes returns the Spree routes provided by the API and Backend gems. I had thought the admin login would be provided by the Backend gem, but none of the controllers in the backend are currently accessible by the application (API controllers work fine).
Spree Setup:
Installed 'spree', '2.2.2', then changed gemfile to include only core, backend, api. Did not include sample data. I would have started working from the default spree gem but was also getting errors there.
Spree.user_class = "Spree::User"
Gemfile:
gem 'rails', '4.0.5'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-2-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-2-stable'
gem 'spree_core', '~> 2.2.2'
gem 'spree_backend', '~> 2.2.2'
gem 'spree_api', '~> 2.2.2'
http://localhost:3000/admin/login => uninitialized constant Spree::Admin::UserSessionsController
http://localhost:3000/login => uninitialized constant Spree::UserSessionsController
I've looked for solutions to this issue but the results I've found are dealing with Spree extensions, or deal with much older versions of spree/rails.
Thank you!
The Spree gem(s) need to come before 'spree_auth_devise' in the gemfile. The application is now working using the full spree gem, and I am confident I can move forward using the custom spree gems as well.
Also, user controllers and routes for Spree are set up in this file: https://github.com/spree/spree_auth_devise/blob/master/config/routes.rb
The controllers are also defined in the spree_auth_devise gem.
Related
While adding spree_advanced_inventory gem to an existing spree application I am getting the following error.
/usr/local/rvm/gems/ruby-2.3.0/gems/activerecord-4.2.6/lib/active_record/dynamic_matchers.rb:26:in
'method_missing': undefined method 'attr_accessible' for
Then I added protected-attributes gem to my gem file, bundle install worked well, but when I tried bundle exec rails g spree_advanced_inventory:install giving me result as
"SPREE doesn't work with protected_attributes gem installed"
spree_advanced_inventory extension is for spree 1.3.2 which was most likely be tested for rails <= 3.x which uses attr_accessible whereas you are using spree 3.0 which uses rails >= 4.x which now supports permitted attributes.
Because of some compatibility issues spree do not support protected_attributes gem hence the error.
1) I create app using spree and in my gem file code.
rails 4.1.6
gem 'spree', '2.3.4'
gem 'spree_gateway', :git => 'https://github.com/spree/spree_gateway.git', :branch => '2-3-stable'
gem 'spree_auth_devise', :git => 'https://github.com/spree/spree_auth_devise.git', :branch => '2-3-stable'
2) bundle install
3) It works fine.
4) But i need to add extension gem 'spree_gift_card', github: 'jdutil/spree_gift_card'
5) bundle install
6) gives error like this,
Bundler could not find compatible versions for gem "spree_frontend":
In Gemfile:
spree_gift_card (>= 0) ruby depends on
spree_frontend (~> 2.2.0) ruby
spree (= 2.3.4) ruby depends on
spree_frontend (2.3.4)
you have two choices
use spree 2.2 - or whatever version the extension last worked with
for the extension, alter the gemspec file to use the later spree version, and cross your fingers that the new version didn't break the extension (or fix it if it did)
The idea is to implement benchmark tests, like it is done in rails-perftest. But I found some problems using it in rails 4.
Could you suggest simple benchmarker gem for rails 4?
there are some gems you can use in your project.
gem 'method_profiler'
gem 'rbench'
gem 'bench_press'
gem 'better-benchmark'
gem 'Tach'
I'm trying to install spree on my rails-4 application with only backend and api stuff. I've found on the web how to install spree for a rails4 application and I also found how to install only backend and api stuff. The problem is folowing, to install rails-4 I need to set it in branch :
gem 'spree', github: 'spree/spree', branch: 'rails4'
But if I want to use only spree's backend and api, I would usually specify them manually in gemfile :
gem 'spree_backend'
gem 'spree_api'
But since there is not specific git repo for them (they are all subfolders) I can't find out how to specify a subfolder in github in a specific branch.
Did I miss something?
Thanks
You're not missing something. The project in to separate gems when it is released. Spree doesn't have a subtree split of the subdirectories, so if you want to pull it in from git you'll have to do some work, or import the whole project.
Your best bet may be to try:
gem 'spree', github: 'spree/spree', branch: 'rails4', require: false
This will install the gem and maintain the dependencies, but not require anything. You can then manually require the sections that you want in an initializer.
When deploying to cloud-foundry its advised to change from 'jquery-rails' gem to 'cloudfoundry-jquery-rails'
# For Ruby 1.9 Cloud Foundry requires a tweak to the jquery-rails gem.
# gem 'jquery-rails'
gem 'cloudfoundry-jquery-rails'
so that jquery can seamlessly work with cloudfoundry.
What are those fixes refered to in this that are necessary to make it work on cloud-foundry?
The documentation for this is a little out of date and is in the process of being updated. For Rails 3.1 this may well be the case, but certainly not for 3.2, it should work fine as is.