Unable to use spree_advanced_inventory in spree 3.0 - spree

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.

Related

I am working to generate nifty_layout in rails 4

Ubuntu 13.10 Terminal
Rails 4.2
Ruby 2.1
nifty-generators (0.4.6)
Command =>
rails generate nifty_layout
result=> Could not find generator 'nifty_layout'. Maybe you meant 'nifty:layout' or 'nifty:config' or 'nifty:scaffold'
Runrails generate --helpfor more options.
Please provide a solution.Thank you
Add this to your gemfile: gem 'nifty-generators', group: :development
Run: bundle install
And then use rails generate nifty:layout

PG pg_ext load error in rails

I recently updated to rails 4.1.6 and ruby 2.1.3p242. I also updated all gems on my system. After creating a new app, I keep getting a pg_ext load file error on running the server. I'm on windows 8 x64 with PostgreSQL 9.3. The pg gem was working fine under my previous RoR installation which was rails 3.2 and ruby 1.9.3.
Under the gem's installation directory, I've a 2.0/pg_ext.so file. I tried renaming the folder to 2.1 and ran the server. The result was the same. I assume it's cause Ruby doesn't allow to Require a .so file. Below is the screenshot of the error:
Any help would be really appreciated. Thanks!
Posted question on the official Gem page:
https://bitbucket.org/ged/ruby-pg/issue/192/pg_ext-load-error
As per the suggestion, I installed the pre-version of the next release. That gave me another error which was solved using:
https://github.com/tzinfo/tzinfo/wiki/Resolving-TZInfo::DataSourceNotFound-Errors
TZInfo::DataSourceNotFound error starting Rails v4.1.0 server on Windows
Posting the answer to help people facing similar problems in the future.
1) In the command line enter:
gem install pg --pre
gem list pg
2) In the Gemfile set the gem to the newly installed version:
gem 'pg', '~> 0.18.2'

Adding authentication to Spree 2-2-Stable

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.

Spree backend + Core rails 4

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.

cloudfoundry-jquery-rails in place of jquery-rails

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.