aledustet
aledustet

Reputation: 1001

Error in a brand new rails 4.0.5 app using spree

I created a brand new project in Rails 4.0.5, and added to my Gemfile spree 2.1.7, after that I executed the generator spree:install. Here is my Gemfile:

source 'file:///Users/dustet/rubygems/'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.0.5'

gem 'spree', '2.1.7'

...

Since i am working offline i am using a local gem server generated with gem generate index, inside this directory i have all the gems needed by rails and spree. The problem is that when I go to my store_front_end in it throws the following error:

NameError in Spree::Home#index
Showing /Library/Ruby/Gems/2.0.0/gems/spree_frontend-2.1.7/app/views/spree/shared/_products.html.erb where line #12 raised:

undefined local variable or method `active_record' for  #<ActiveRecord::Associations::JoinDependency::JoinAssociation:0x007fb11095adf8>

and the code that throws the error is:

*<% if products.empty? %>*
 <%= Spree.t(:no_products_found) %>
<% elsif params.key?(:keywords) %>
  <h6 class="search-results-title"><%= Spree.t(:search_results, :keywords => h(params[:keywords])) %></h6>

The error in the stared line. Using spree 2.2.2 the error is the same but the code is different, the error in the stared line:

<div data-hook="homepage_products">
  *<% cache(cache_key_for_products) do %><---- Error
    <%= render :partial => 'spree/shared/products', :locals => { :products => @products } %>
  <% end %>
</div>

Upvotes: 2

Views: 196

Answers (1)

aledustet
aledustet

Reputation: 1001

There seem to be a problem regarding an internal gem dependency. When i used a fast internet connection and used https://rubygems.org as the source in my Gemfile everything worked like a charm. This problem was another regarding working with Rails offline.

Upvotes: 1

Related Questions