smallseo.info

spree

Spree is a complete open source e-commerce solution for Ruby on Rails. Ecommerce Storefront and Platform Solutions | Spree Commerce

Spree 's latest version does this on remote - undefined method `set_preference' for nil:NilClass

Everything works perfect on my local. I installed everything appropriately on the server, and when I run rake db:bootstrap or rake db:migrate, I get this :

rake aborted!
undefined method `set_preference' for nil:NilClass
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/whiny_nil.rb:48:in `method_missing'
/home/chrisisraw/webapps/rails/gems/bundler/gems/spree-17e74dd1e908/core/lib/spree/preference_access.rb:18:in `set'
/home/chrisisraw/webapps/rails/gems/bundler/gems/spree-17e74dd1e908/core/lib/spree/preference_access.rb:17:in `each'
/home/chrisisraw/webapps/rails/gems/bundler/gems/spree-17e74dd1e908/core/lib/spree/preference_access.rb:17:in `set'
/home/chrisisraw/webapps/rails/Live-Jolly-Foods/config/initializers/jolly.rb:1
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:235:in `load'
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:235:in `load'
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in `new_constants_in'
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:235:in `load'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/engine.rb:201
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/engine.rb:200:in `each'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/engine.rb:200
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `instance_exec'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/initializable.rb:25:in `run'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/initializable.rb:50:in `run_initializers'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `each'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/initializable.rb:49:in `run_initializers'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/application.rb:134:in `initialize!'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/application.rb:77:in `send'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/application.rb:77:in `method_missing'
/home/chrisisraw/webapps/rails/Live-Jolly-Foods/config/environment.rb:5
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:596:in `new_constants_in'
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:225:in `load_dependency'
/home/chrisisraw/webapps/rails/gems/gems/activesupport-3.0.5/lib/active_support/dependencies.rb:239:in `require'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/application.rb:103:in `require_environment!'
/home/chrisisraw/webapps/rails/gems/gems/railties-3.0.5/lib/rails/application.rb:216
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/local/ruby1.8.7ee/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:604:in `each'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
/usr/local/ruby1.8.7ee/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/home/chrisisraw/webapps/rails/gems/bundler/gems/spree-17e74dd1e908/core/lib/tasks/core.rake:71
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:636:in `call'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:631:in `each'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
/usr/local/ruby1.8.7ee/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
/home/chrisisraw/webapps/rails/gems/gems/rake-0.8.7/bin/rake:31
/home/chrisisraw/webapps/rails/bin/rake:19:in `load'
/home/chrisisraw/webapps/rails/bin/rake:19

Anyone figure this out?


Source: (StackOverflow)

Spree - i18n gem issue

I got a problem with a new version of spree gem (branch: '2-3-stable'). When i try to install it, I receive this error.

my_store$ rails server
The git source https://github.com/spree/spree_gateway.git is not yet checked out. Please  run `bundle install` before trying to start your application

my_store$ bundle install
Bundler could not find compatible versions for gem "i18n":
 In Gemfile:
  spree (= 2.3.1) ruby depends on
   spree_core (= 2.3.1) ruby depends on
    i18n (= 0.6.9) ruby

 rails (= 4.1.2) ruby depends on
  activesupport (= 4.1.2) ruby depends on
    i18n (0.6.11)

But according to gem list i got both of this gems installed i18n (0.6.11, 0.6.9). Can someone help me to fix this problem


Source: (StackOverflow)

Upgrade spree to 1.0.0

I'm trying to upgrade Spree from 0.7.0 to 1.0.0, I added in my gemfile

gem 'spree', '1.0.0'

and mounted the routes by adding this in routes.rb

Store::Application.routes.draw do
  mount Spree::Core::Engine, :at => "/"
end

after that I had override some controllers and model and I added the namespace Spree:: in this way

Spree::ProductsController.class_eval do

now I'm stuck on this error

Mysql2::Error: Table 'store_development.spree_product_groups' doesn't exist: SHOW FIELDS FROM `spree_product_groups`

and it is totally right cause the table does not exists, but it is named without the spree_ prefix, how can i quickly fix it? I suppose that some new column or table has been added to the database, how can i check this? Is there a procedure to upgrade safely spree?


Source: (StackOverflow)

Running Rails in Rubymine from subproject

I'm using RubyMine 3.1.1 with Rails 3.0.9.

I have the Spree project cloned from Github, and I want to debug the server while working on the code. To do this, Spree includes a sandbox rake command that creates a subfolder (called sandbox) that contains an instance of the rails app, one that refers to the parent directory containing the source as its spree gem.

If I close the original project and open the sandbox subfolder as a new probect, I get the correct run configurations for development and production and I can successfully debug. However, this doesn't let me edit the spree code in the parent directory.

If I'm in the parent directory, the subfolder is there of course, but there's no rails run configurations and you can't add one as it says there is no rails server launcher in the project (or some facsimile of that message).

Anyone know how to make RubyMine recognize the run configurations for a subfolder?


Source: (StackOverflow)

Rails 4 - strong parameters concept involvement in spree-2.1

How to add new fields for spree::user in Spree-2.1 + Rails4 ?

Like my old customization: ==========================

Spree::User.class_eval do

attr_accessible :f_name, :l_name :gender
validates :f_name, :presence => true, :length => {:maximum => 25}
validates :l_name, :presence => true, :length => {:maximum => 20}

end

new work with strong parameters: ================================

module Spree UserRegistrationsController.class_eval do

private
 def spree_user_params
   params.require(:spree_user).permit(:f_name, :l_name)
 end

end

end

Even though its not working as it got rollback..

Please let me know your comments.


Source: (StackOverflow)

How to access the admin section of Spree in production?

I have followed the Spree instructions for setting up, and I got it working in development mode. I deployed with Capistrano to rackspace to a production server, but the same default login ("spree@example.com"/"spree123") does not work. I created a user in the web interface, but of course it would not have admin priveleges.

There is nothing in the guide that takes this into account - how can I create an admin user in production when there are no users at all initially? Maybe I deployed incorrectly? I am using a very standard deploy.rb, must there be some spree-specific code for setting this up?


Source: (StackOverflow)

Spree search filter for properties and variants

I'm running Spree 1.3.1 and I'm trying to customize the Taxon show page.

I would like it to return the products contained inside the current Taxon, eventually filtered by a property or by an option value.

For example let's say that I'm seeing the Taxon of an underwear collection. I'd like to filter the products shown, by providing a certain size (option_type). In this case I should list only products that have variants with the requested size.

I would like also to be able to filter the products by the "fit" property. Filtering by the slip fit, I should be able to list only products inside the current Taxon that have the required property.

This is the Taxon controller show action:

Spree::TaxonsController.class_eval do

    def show
      @taxon = Spree::Taxon.find_by_permalink!(params[:id])
      return unless @taxon

      @searcher = Spree::Config.searcher_class.new(params)
      @searcher.current_user = try_spree_current_user
      @searcher.current_currency = current_currency
      @products = @searcher.retrieve_products

      respond_with(@taxon)
    end


end

How should I modify it to fit my needs?


Source: (StackOverflow)

What causes the "ArgumentError (dump format error)"?

While troubleshooting a misbehavior in Spree where the product list was not paginating and was only listing the first 10 products or so, I attempted to reproduce the error in my local development environment and on the first page load I received the error:

ArgumentError (dump format error)

As always, I checked my other brain first. The top search result was: https://github.com/rails/rails/issues/2509

Although the the user who started that thread and several of the other posters were attempting an upgrade from Rails 3.0.9 to Rails 3.1, I didn't think it would apply to my case. The Spree 0.60.2 app I'm running is at Rails 3.0.9.

However, as it turns out, simply clearing my localhost cookies solved the problem. Why?


Source: (StackOverflow)

Spree overriding helper method

I'm trying to overriding a helper method of base_helper.rb by using this:

module Spree
  module BaseHelper.class_eval do

    def taxons_tree(root_taxon, current_taxon, max_level = 1)
      .....
    end

  end
end

It's not working for me. Anyone know what I am missing here?

Thank you!

Fixed:

I should use:

Spree::BaseHelper.module_eval do

    def taxons_tree(root_taxon, current_taxon, max_level = 1)
      ...
    end

end

instead.


Source: (StackOverflow)

What does this Rails Engine code mean: config.to_prepare &method(:activate).to_proc

I'm working with Spree, which uses Rails engines extensively. A common pattern I find is this. However I have trouble understanding this code.

class Engine < Rails::Engine 
  def self.activate
    ...
  end     

  config.to_prepare &method(:activate).to_proc
end
  1. What does .to_prepare do
  2. What does the &method operator do?
  3. What is the overall effect of the code?

Many Thanks!


Source: (StackOverflow)

how to change the Spree default home page?

I want to change the root path of spree site to a static page.

Can anyone please tell how can I change the spree default home page?


Source: (StackOverflow)

Asset Path Error in Spree / Ruby on Rails

I am setting up my second "spree" store in a local development environment to work on an ecommerce project using the Spree gem for RubyOnRails.

The first store works, but when I shut off the "rails server" for store1 and try to fire it up for store2, when I go to http://localhost:3000 I get this this error:


Sprockets::Rails::Helper::AbsoluteAssetPathError in Spree::Home#index

Showing /Users/pivot/.rvm/gems/ruby-2.0.0-p481/gems/spree_frontend-2.3.2/app/views/spree/shared/_head.html.erb where line #7 raised:

Asset names passed to helpers should not include the "/assets/" prefix. Instead of "/assets/favicon.ico", use "favicon.ico"

Extracted source (around line #7):

  <meta content="width=device-width, initial-scale=1.0, maximum-scale=1" name="viewport">
  <%== meta_data_tags %>
  <%= canonical_tag(current_store.url) %>
  <%= favicon_link_tag image_path('favicon.ico') %> #THIS IS THE HIGHLIGHTED LINE
  <%= stylesheet_link_tag 'spree/frontend/all', :media => 'screen' %>
  <%= csrf_meta_tags %>
  <%= javascript_include_tag 'spree/frontend/all' %>

Trace of template inclusion: /Users/pivot/.rvm/gems/ruby-2.0.0-p481/gems/spree_frontend-2.3.2/app/views/spree/layouts/spree_application.html.erb


This error is coming from a spree view file, and the offending line is actually just passing in "favicon.ico" not "assets/favicon.ico", so I don't know what's going on.


Source: (StackOverflow)

Spree: customize the key attributes of a product

Does anyone know if it's possible to add a new attribute to the set of key attributes (Name, Description, Permalink, Meta Description etc) of a product? The idea is that I want to have these attributes available when I create a product instead of adding them afterwards through Product Properties.

Thanks.


Source: (StackOverflow)

Spree 2.1 strong parameters

Is there a easy way to add a new permitted parameter to controllers in Spree without altering the defaults ?

I'm trying to change the orders_params method in OrdersController.


Source: (StackOverflow)

Security Update for Spree Finding Nil for Money:Class

This security update for spree just released, but after running some Cucumber tests, I had this recurring issue:

undefined method `assume_from_symbol' for Money:Class (ActionView::Template::Error)

I searched the project repo on GH and we don't use the method. Searched the Money repo and also no findings. Searched Spree and found this. The method appears to be undefined on my development environment.

I don't know if its Spree or the project I'm dealing with. Does anyone know how to fix this?

Update: When I run bundle exec zeus cucumber I don't get these errors...


Source: (StackOverflow)