GithubHelp home page GithubHelp logo

jipiboily / spree_multi_lingual Goto Github PK

View Code? Open in Web Editor NEW
49.0 9.0 56.0 541 KB

Spree multi-lingual is a plugin to make multi locale store with Spree possible

License: BSD 3-Clause "New" or "Revised" License

Ruby 95.15% JavaScript 0.98% CoffeeScript 3.87% CSS 0.01%

spree_multi_lingual's Introduction

SpreeMultiLingual Build Status

SpreeMultiLingual is originally a proof of concept for what could become a multi-lingual Spree plugin.

Since then integration tests and features have been added.

Requirements

  • Spree 1.3.X
  • Rails 3.2.X

Installation

Add gem to your Gemfile:

gem 'spree_multi_lingual', :git => 'git://github.com/jipiboily/spree_multi_lingual.git'
gem 'globalize3', :git => 'git://github.com/svenfuchs/globalize3.git'

Globalize3 edge version fixed important bug with dynamic finder : https://github.com/svenfuchs/globalize3/commit/b771fb87d3dda4a78cfe294da1fab7df266e72c9

Run Bundler

bundle install

Assets

In app/assets/javascripts/admin/all.js

//= require admin/spree_multi_lingual
//= require admin/spree_multi_lingual_class

This is required for the language dropdown!

Add an initializer file and set SpreeMultiLingual.languages to an array containing the languages you support.

# config/initializers/spree_multi_lingual.rb
SpreeMultiLingual.languages = ["fr", "en", "es"] # Add your own locales here

For the moment, enable locale fallbacks for i18n (makes lookups for any locale fall back to the i18n.default_locale when a translation can not be found)

# config/application.rb
config.i18n.fallbacks = true

Run spree_multi_lingual install:

rails g spree_multi_lingual:install

If you want to use browser language detection using rack-contrib Locale :

# config.ru
require 'rack'
require 'rack/contrib'

use Rack::Locale

require ::File.expand_path('../config/environment',  __FILE__)
run MyRailsApp::Application

Use

On views where there is translated fields, there should be a dropdown to switch currently edited locale.

Products: http://dl.dropbox.com/u/6210261/spree_multi_lingual.swf

Taxons: ** /!\ Using the taxonomy tree you can only edit another locale taxons name, to do so click on the links next to "Edit Taxonomy" to show the taxonomy for a given locale. If you want to create taxons using the taxonomy tree, please only use the default locale for the moment.**

To edit taxons permalink please do as following: Taxon TaxonEdit

What is translated?

For now :

  • products : name, permalink, description, meta description and meta keywords.
  • taxonomies : name.
  • taxons : name, permalink and description.

WARNING

there is no fallback of default language for now unless you speficy i18n.fallbacks as previously stated.

Notes

It uses Globalize3, easy_globalize3_accessors and routing-filter. Thanks to Tomash that told me about those two awesome gems: easy_globalize3_accessors and routing-filter.

SpreeMultiLingual depends on a fork of routing-filter because it supports :exclude option in routes, used for /admin. I hope it this feature can me merged into the original repo.

The flags are from the flags icon set from famfamfam (http://www.famfamfam.com/).

TODO

  1. Make taxons multi languages editable from the taxonomy tree
  2. Dynamically show taxon prefix permalink depending on dropdown language selected : Taxons#edit
  3. Add things to translate:
    • Option values
    • Properties
    • Alt text on images
  4. Dropdown or something to change locale
  5. Rake task for store that already have users

Contributors

Special thanks to sbounmy for the amount of contributions he did. Thanks to Radar for merging spree_localize.

Testing

Be sure to bundle your dependencies and then create a dummy test app for the specs to run against.

$ bundle
$ bundle exec rake test_app
$ bundle exec rspec spec

Copyright (c) 2012 Jean-Philippe Boily, released under the New BSD License

spree_multi_lingual's People

Contributors

bitdeli-chef avatar daniel-devolute avatar davidslv avatar davidslvto avatar j15e avatar jipiboily avatar matteofuzz avatar pigoz avatar prathe avatar radar avatar sbounmy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

spree_multi_lingual's Issues

spree 2-4-stable compatible?

I need something like this where I can have a unique translated title and description for each product. Is spree_multi_lingual the best thing available now for spree/solidus? I'm still on 2.4-stable.

Something wrong in README.md

In the installation part, I can't bundle the gem with adding the following code to Gemfile

gem "spree_multi_lingual", :git => "[email protected]:jipiboily/spree_multi_lingual.git"

And it should be

gem 'spree_multi_lingual', :git => 'git://github.com/jipiboily/spree_multi_lingual.git'

spree_shipping_categories

Any reason why there is no spree_shipping_categories translation ?
used in admin... but as other contents are translated ... the method name could be too
In this case the value is correctly translated but not the property label ...

Capture d e cran 2013-04-05 a 16 44 45

spree_asset_translations table not created

there is an image decorator, but the spree_asset_translations table is not created ..

ActionView::Template::Error (Mysql2::Error: Table 'my_store_dev.spree_asset_translations' doesn't exist: SHOW FULL FIELDS FROM spree_asset_translations):

got it working by adding a new migration

class AddTranslationToAsset < ActiveRecord::Migration
def up
Spree::Asset.create_translation_table! :alt => :string
end
def down
Spree::Asset.drop_translation_table!
end
end

and a new decorator :
module Spree
Asset.class_eval do
translates :alt
end
end

seems the image decorator is not anymore useful w latest Spree 1.3

Huge bug in routing-filter

Due to a bug in the routing-filter gem, which incorrectly monkey patched rack-mount (svenfuchs/routing-filter#15), the use of spree_multi_lingual (which depends on routing-filter) causes errors when using multiple constrained catch all routes. What to do?

Translated Attributes Customization.

I added some attributes to my Product model which I'd need to support locales.
I'm already using spree_multi_lingual and I tried to take advantage of easy_globalize3_accessors and override in my product_decorator the translated attributes (after creating and running the corresponding migrations).
Yet, only the ones defined in spree_multi_lingual get translated.
I'll solve this problem by forking the gem and making it suit my requirements, but
what about adding the possibility of add/remove the translated attributes of a product?

root_path vs request.fullpath issues

I am having an issue with i18n and spree. If you look this file:

https://github.com/spree/spree/blob/1-1-stable/core/app/helpers/spree/admin/navigation_helper.rb

If you look line 27, I'm having a particular issue where request.fullpath returns does not return the locale at the beginning of the path, while root_path is '/:locale', in my case '/:fr'. So the string comparison made at this line is never met.

I could not think of a proper fix for this particular case. Anyone got a clue?

multi currency with multi lingual

i want to add different price for each language.
it can not possible with multi lingual now but can you attach this funtionality?

spree_multi_lingual and spree_editor doesn't work together until we create a new coffeescript class

On my spree 1.2.x, i have spree_multi_lingual and spree_editor.

In the admin, when i switch locale with the spree_multi_lingual dropdown, the tinyMCE doesn't reload with the translated content because translated_fields are created only if we change the locale.

I worked on a solution who need to be improved.

At this time, i'm able to use those extensions if i override the spree_multi_lingual_class.js.coffee. It works only for 2 languages on the website, it use a setTimeout (i hate that) and he doesn't check if spree_editor is running or not.

This is my concept proof :

$(document).ready ->
  ml = new SpreeMultiLingual
  ml.create_localized_fields()

  $("#spree_multi_lingual_dropdown").change (e) ->
    ml.change_language(@.value)

# declare the class in global scope so we can extend it from within our app
class window.SpreeMultiLingual
  constructor: ->
    @translated_fields = window.spree_multi_lingual.translated_fields
    @default_locale = window.spree_multi_lingual.backend_locale
    @current_locale = @default_locale
    @other_locale = $('#spree_multi_lingual_dropdown option').not(':selected').attr('value')

  create_localized_fields: =>
    for field in @translated_fields
      field_name = @localized_field_name(field)
      if !$("#" + field_name).length
        @duplicate_field(field)

    setTimeout =>
      @show_fields()
    , 1000

  change_language: (locale) =>
    @current_locale = locale
    @make_sure_field_exists_for_language()
    @show_fields()

  duplicate_field: (field) =>
    field_name = @localized_field_name(field)
    if $("#" + field)[0]
      new_field_name_value = $("#" + field).attr("name").substring(0,$("#" + field).attr("name").length - 1) + "_" + @other_locale + "]"
      new_field = $("#" + field).clone().attr("id", field_name).attr("name", new_field_name_value).removeClass("sml-localized-field-"+@default_locale)
      value = eval("window.spree_multi_lingual.translated_fields_values['#{field_name}']")
      new_field.val(value) if value
      $("#" + field).after(new_field)
      @add_localized_class(field_name)
      @add_localized_class(field, @default_locale)

  make_sure_field_exists_for_language: =>
    for field in @translated_fields
      field_name = @localized_field_name(field)
      if !$("#" + field_name).length
        @duplicate_field(field)

  show_fields: =>
    for field in $(".sml-localized-field")
      $(field).hide()
      $(field).next('.mceEditor').hide()

      if $(field).hasClass("sml-localized-field-#{@current_locale}")
        if $(field).is('textarea')
          $(field).next('.mceEditor').show()
        else
          $(field).show()

  localized_field_name: (field) =>
    (field + "_" + @other_locale)

  add_localized_class: (id, locale = @other_locale) =>
    @add_class(id, "sml-localized-field")
    @add_class(id, "sml-localized-field-" + locale)

  add_class: (id, klass) ->
    $("#" + id).addClass(klass) unless $("#" + id).hasClass(klass)

Could you help me to improve this class ?

install error in running migrations

rails 3.1.2 / ruby 1.9.3 / Spree 1.3.2

data from Spree demo test data ... ( will check them)

Would you like to run the migrations now? [Y/n]
run bundle exec rake db:migrate from "."
......
== MigrateDataForProducts: migrating =========================================
rake aborted!
An error has occurred, this and all later migrations canceled:

Validation failed: Price can't be blank
/Users/yves/.rvm/gems/ruby-1.9.3-p374@rails32/gems/activerecord-3.2.12/lib/active_record/validations.rb:56:in `save!'

I re-installed Spree data from scratch into a new MySQL db ... then run the migratiion
passed OK ...

cannot load such file -- easy_globalize3_accessors (LoadError)

Hi,
I trying to deploy your extension on a spree store v1.1 but when I'm running the rails g spree_multi_lingual:install command I obtain this error :

/Users/olivierbuffon/.rvm/gems/ruby-1.9.3-p125/gems/polyglot-0.3.3/lib/polyglot.rb:63:in `require': cannot load such file -- easy_globalize3_accessors (LoadError)

Do you have any idea to solve that problem ?

Thanks.

Handle search within translations fields

Currently, search is only searching in Spree::Product and not in the the Spree::Product::Translation (spree_product_translations). I did something in my project about that, but maybe something less custom could be done within this extension.

@sbounmy have you faced that problem too?

undefined method `I18n'

When I put config.I18n.fallbacks = true in config/application.rb I get the error:

/Users/martijnlafeber/.rvm/gems/ruby-1.9.3-p0@ladress-spree/gems/railties-3.1.3/lib/rails/railtie/configuration.rb:78:in `method_missing': undefined method `I18n' for #<Rails::Application::Configuration:0x007fb11ea417b8> (NoMethodError)

When I leave it out and try to load a product for which there aren't any translations, I get a Product for which all the fields that could be translated are nil.

incorrect info in README

config/application.rb

config.I18n.fallbacks = true

should be read :

config/application.rb

config.i18n.fallbacks = true

Heroku Issue

fatal: The remote end hung up unexpectedly
Git error: command git clone '[email protected]:jipiboily/spree_multi_lingual.git' "/tmp/build_3syaahufqs1y8/vendor/bundle/ruby/1.9.1/cache/bundler/git/spree_multi_lingual-f89b8dade805d6961a231a32f085ca3c907e0ce1" --bare --no-hardlinks in directory /tmp/build_3syaahufqs1y8 has failed.
!
! Failed to install gems via Bundler.
!
! Heroku push rejected, failed to compile Ruby/rails app

To [email protected]:frozen-cliffs-7645.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:frozen-cliffs-7645.git'

email translations ?

hi @jipiboily,

do you think we should handle email translation like having email template in spree_multi_lingual gem ?

Stephane.

price in edit product rendered with separator but saved stripped

Spree 1.1.1, spree_multi_lingual 1-1-stable branch.
I set :it as default on spree configuration and ['it', 'en'] in spree_multi_lingual initalizer.
In edit product field price is localized in :en, as 1,111.11 with separator and when I save it became 1.11
Same result with 1.111,11 (localization in italian).
Only work without separator, 1111.11 is saved correctly, as 1111,11 .
I try add delocalize gem without results.

Globalize3 0.3.0

Current globalize3 version is 0.3.0 (also on master git), can we update the gemspec?

Use Italian as default language.

Hy, is possible to use only :it language. I need to disable all non italian routes and I need to make :it the default language. I need some special configuration?

how to change admin locale when using

I saw this line in previous post :

filter :locale, :exclude => /^/admin/ if SpreeMultiLingual.use_locale_filter

I tried to add a locale selector in the admin header , but it doesn't change the locale
is it due to this filter exclude ? if yes , why it's not possible to change the admin locale ?

don't know if it's a bug or misuse ...

I installed and used your gem wo any trouble until then ... ( w spree-example demo)
Now I started translating (setting up) the products descriptions into :en and :fr
Got correctly in spree_product_translations 2 records for the same spree_product_id one for each locale... ( 16 rows in spree_products , 32 rows in spree_product_translations..)

When displaying the products on the home page ( previously 6 items per page., 3 pages )..
now the pagination changed , I have the double of pages 6 pages ! and added 3 are empty ... so it's a matter of pagination ... any clue ?

thanks

description in ShippingMethod decorator

I think you should add description to shipping_method_decorator according to migration add_description_to_shipping_method.spree_multi_lingual

module Spree
ShippingMethod.class_eval do
translates :name, :description
end
end

for 1-3 branch migrations failling

rails g spree_multi_lingual:install
append app/assets/javascripts/store/all.js
append app/assets/javascripts/admin/all.js
insert app/assets/stylesheets/store/all.css
insert app/assets/stylesheets/admin/all.css
run bundle exec rake railties:install:migrations FROM=spree_multi_lingual from "."
Would you like to run the migrations now? [Y/n] Y
run bundle exec rake db:migrate from "."
== MigrateDataForProducts: migrating =========================================
rake aborted!

An error has occurred, this and all later migrations canceled:

cannot set on_demand of product with variants

anybody with solution or same issue here..........

problem with the installation

hi i get a sytax error while installation :
/Library/Ruby/Gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:in polyglot_original_require': /Users/umuthanuyan/railsprojects/----/vendor/cache/spree_multi_lingual-86981bd6d407/lib/spree_multi_lingual/translates_with_accessors.rb:50: syntax error, unexpected ':', expecting kEND (SyntaxError) ... globalize_accessors locales: SpreeMultiLingual.languages, ... ^ /Users/umuthanuyan/railsprojects/----/vendor/cache/spree_multi_lingual-86981bd6d407/lib/spree_multi_lingual/translates_with_accessors.rb:50: syntax error, unexpected ':', expecting '=' ...Lingual.languages, attributes: params.to_a if accessors ^ from /Library/Ruby/Gems/1.8/gems/polyglot-0.3.3/lib/polyglot.rb:63:inrequire'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in require' from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:236:inload_dependency'
from /Library/Ruby/Gems/1.8/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:in require' from /Users/umuthanuyan/railsprojects/----/vendor/cache/spree_multi_lingual-86981bd6d407/lib/spree_multi_lingual.rb:6 from /Library/Ruby/Gems/1.8/gems/bundler-1.2.0.rc/lib/bundler/runtime.rb:68:inrequire'
from /Library/Ruby/Gems/1.8/gems/bundler-1.2.0.rc/lib/bundler/runtime.rb:68:in require' from /Library/Ruby/Gems/1.8/gems/bundler-1.2.0.rc/lib/bundler/runtime.rb:66:ineach'
from /Library/Ruby/Gems/1.8/gems/bundler-1.2.0.rc/lib/bundler/runtime.rb:66:in require' from /Library/Ruby/Gems/1.8/gems/bundler-1.2.0.rc/lib/bundler/runtime.rb:55:ineach'
from /Library/Ruby/Gems/1.8/gems/bundler-1.2.0.rc/lib/bundler/runtime.rb:55:in require' from /Library/Ruby/Gems/1.8/gems/bundler-1.2.0.rc/lib/bundler.rb:128:inrequire'
from /Users/umuthanuyan/railsprojects/----/config/application.rb:7
from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24:in require' from /Library/Ruby/Gems/1.8/gems/railties-3.2.6/lib/rails/commands.rb:24 from script/rails:6:inrequire'
from script/rails:6

Issue with branch 1-3-stable.

When I add :
gem 'spree_multi_lingual', :git => "[email protected]:jipiboily/spree_multi_lingual.git"
gem 'globalize3', :git => 'git://github.com/svenfuchs/globalize3.git'
and bundle install it is giving the following error::
Could not find gem 'globalize3 (= 0.2.0) ruby', which is required by gem 'spree_multi_lingual (>= 0) ruby', in any of the sources.

Also if I remove :git => 'git://github.com/svenfuchs/globalize3.git' and do rails g spree_multi_lingual:install its giving error like ::
/home/ntf/.rvm/gems/ruby-1.8.7-p371/gems/polyglot-0.3.3/lib/polyglot.rb:63:in polyglot_original_require': /home/ntf/.rvm/gems/ruby-1.8.7-p371/bundler/gems/spree_multi_lingual-6d332ef67094/lib/spree_multi_lingual/translates_with_accessors.rb:50: syntax error, unexpected ':', expecting kEND (SyntaxError) ... globalize_accessors locales: SpreeMultiLingual.languages, ... ^ /home/ntf/.rvm/gems/ruby-1.8.7-p371/bundler/gems/spree_multi_lingual-6d332ef67094/lib/spree_multi_lingual/translates_with_accessors.rb:50: syntax error, unexpected ':', expecting '=' ...Lingual.languages, attributes: params.to_a if accessors ^ from /home/ntf/.rvm/gems/ruby-1.8.7-p371/gems/polyglot-0.3.3/lib/polyglot.rb:63:inrequire'
from /home/ntf/.rvm/gems/ruby-1.8.7-p371/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in require' from /home/ntf/.rvm/gems/ruby-1.8.7-p371/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:236:inload_dependency'
from /home/ntf/.rvm/gems/ruby-1.8.7-p371/gems/activesupport-3.2.11/lib/active_support/dependencies.rb:251:in require' from /home/ntf/.rvm/gems/ruby-1.8.7-p371/bundler/gems/spree_multi_lingual-6d332ef67094/lib/spree_multi_lingual.rb:6 from /home/ntf/.rvm/gems/ruby-1.8.7-p371@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:inrequire'
from /home/ntf/.rvm/gems/ruby-1.8.7-p371@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in require' from /home/ntf/.rvm/gems/ruby-1.8.7-p371@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:ineach'
from /home/ntf/.rvm/gems/ruby-1.8.7-p371@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in require' from /home/ntf/.rvm/gems/ruby-1.8.7-p371@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:ineach'
from /home/ntf/.rvm/gems/ruby-1.8.7-p371@global/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in require' from /home/ntf/.rvm/gems/ruby-1.8.7-p371@global/gems/bundler-1.2.3/lib/bundler.rb:128:inrequire'
from /home/ntf/SPREE_WITH_RAILS/blackpearl1.2/config/application.rb:7
from /home/ntf/.rvm/gems/ruby-1.8.7-p371/gems/railties-3.2.11/lib/rails/commands.rb:24:in require' from /home/ntf/.rvm/gems/ruby-1.8.7-p371/gems/railties-3.2.11/lib/rails/commands.rb:24 from script/rails:6:inrequire'
from script/rails:6

Migration error on 1-1-stable

I have an error running migrations on 1-1-stable branch:

** Execute db:migrate
==  MigrateDataForProducts: migrating =========================================
rake aborted!
An error has occurred, all later migrations canceled:

Can't mass-assign protected attributes: id, created_at, updated_at, count_on_hand

Then I temporary add this line

attr_accessible :id, :created_at, :updated_at, :count_on_hand

to Spree::Product model and they run smooth.

I don't know how o solve this issue without override the model.

Compatible version with Spree 2.1.X

Hi,
i really like your gem and i have used it on some shops. I would like to know if you are planning to upgrade it soon to be compatible with the new version of spree.
Thanks in advance

Unable to change the locale in products

I am not able to change the locale to update as the SWF video in Readme.md, I am using Chrome, and when I am selecting the locale in product edit page, nothing happen, is it under construction right now?

error in migrations

I thought it was solved but running again the migrations on a brand new sample db leads to other errors when migrating products ... I also mentioned this issue to Spree gem (radar) as it could be a Spree issue ... 'on_demand' option being modified recently ..

as there is no uninstall process , it's quite a little bit messay to go back to initial Spree samples state ..

need to remove multilingual models decorators...
need to comment multilingual initializer
need to comment gem multilingual globalize3 in Gemfile
run bundle install
run bundle exec rake db:bootstrap to get a brand new sample data db
THEN
need to uncomment gem multilingual globalize3 in Gemfile
run bundle install
need to uncomment multilingual initializer
need to add multilingual models decorators back
run rails g spree_multi_lingual:install

then again ...
here is the error

== MigrateDataForProducts: migrating =========================================
rake aborted!
An error has occurred, all later migrations canceled:
cannot set on_demand of product with variants

I 've done some debugging ( I'm not aware of Spree internals at all..)
by running in the console w debugger

Spree::Product.find_each { |product| debugger; product.update_attributes!(product.untranslated_attributes, :without_protection => true) }
this error happen on Spree::Product # 528469905
which seems to be the first product ( among the 16 in samples) to be a master with 3 variants

( no issues w previous products in the list: 107377505, 176895127, 187438981, 248786582, 302032070, 398400663, 459084718, 500501192, they are all master variants only... )

the error comes from trying to update: "on_demand"=>false on this product w variants...

product = Spree::Product.find(528469905)
product.untranslated_attributes
=> {
"name"=>"Spree Baseball Jersey",
"description"=>"Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nulla nonummy aliquet mi. Proin lacus. Ut placerat. Proin consequat, justo sit amet tempus consequat, elit est adipiscing odio, ut egestas pede eros in diam. Proin varius, lacus vitae suscipit varius, ipsum eros convallis nisi, sit amet sodales lectus pede non est. Duis augue. Suspendisse hendrerit pharetra metus. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Curabitur nec pede. Quisque volutpat, neque ac porttitor sodales, sem lacus rutrum nulla, ullamcorper placerat ante tortor ac odio. Suspendisse vel libero. Nullam volutpat magna vel ligula. Suspendisse sit amet metus. Nunc quis massa. Nulla facilisi. In enim. In venenatis nisi id eros. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Nunc sit amet felis sed lectus tincidunt egestas. Mauris nibh.",
"meta_description"=>nil,
"meta_keywords"=>nil,
"permalink"=>"spree-baseball-jersey",
"id"=>528469905,
"available_on"=>Sun, 17 Feb 2013 19:25:06 CET +01:00,
"deleted_at"=>nil,
"tax_category_id"=>25484906,
"shipping_category_id"=>nil,
"count_on_hand"=>30,
"created_at"=>Sun, 17 Feb 2013 19:25:06 CET +01:00,
"updated_at"=>Sun, 17 Feb 2013 19:25:06 CET +01:00,
"on_demand"=>false
}

hope this helps ..Tested with Spree config
config.track_inventory_levels=false
and NO ERROR ....
When using the Spree sample data , there are some products with variants, but by default track_inventory_levels is 'true'...
as I raised this issue with Spree ge, I don't know if it has any impact on your gem, or if it's only related to Spree sample data....

======= debugging in console ==========
(rdb:1) product.id
528469905
(rdb:1) product
Spree::Product::Translation Load (0.9ms) SELECT spree_product_translations.* FROM spree_product_translations WHERE spree_product_translations.spree_product_id = 528469905
Spree::Product::Translation Load (0.8ms) SELECT spree_product_translations.* FROM spree_product_translations WHERE spree_product_translations.spree_product_id = 528469905 AND spree_product_translations.locale = 'en' LIMIT 1

<Spree::Product id: 528469905, name: nil, description: nil, available_on: "2013-02-17 17:26:03", deleted_at: nil, permalink: nil, meta_description: nil, meta_keywords: nil, tax_category_id: 25484906, shipping_category_id: nil, count_on_hand: 30, created_at: "2013-02-17 17:26:03", updated_at: "2013-02-17 17:26:03", on_demand: false>

(rdb:1) c
(0.4ms) BEGIN
(0.9ms) SELECT COUNT(*) FROM spree_variants WHERE spree_variants.product_id = 528469905 AND spree_variants.is_master = 0 AND spree_variants.deleted_at IS NULL
(0.3ms) ROLLBACK
RuntimeError: cannot set on_demand of product with variants

syntax error from deface during installation

I followed the readme instructions (with gem 'globalize3', '0.2.0' in gemfile to get around dependency)
until...

rails g spree_multi_lingual:install
[...]/deface-0.9.1/lib/deface/dsl/loader.rb:28:in instance_eval': (eval):1: syntax error, unexpected tIDENTIFIER, expecting $end (SyntaxError) ...ink_part do')" closing_selector 'code[erb-silent]:contains("... ... ^ from [...]/deface-0.9.1/lib/deface/dsl/loader.rb:28:inblock in load'
from [...]/deface-0.9.1/lib/deface/dsl/loader.rb:17:in open' from [...]/deface-0.9.1/lib/deface/dsl/loader.rb:17:inload'
from [...]/deface-0.9.1/lib/deface/environment.rb:66:in block (2 levels) in enumerate_and_load' from [...]/deface-0.9.1/lib/deface/environment.rb:65:inglob'
from [...]/deface-0.9.1/lib/deface/environment.rb:65:in block in enumerate_and_load' from [...]/deface-0.9.1/lib/deface/environment.rb:55:ineach'
from [...]/deface-0.9.1/lib/deface/environment.rb:55:in enumerate_and_load' from [...]/deface-0.9.1/lib/deface/environment.rb:49:inload_overrides'
from [...]/deface-0.9.1/lib/deface/environment.rb:31:in block in load_all' from [...]/deface-0.9.1/lib/deface/environment.rb:29:ineach'
from [...]/deface-0.9.1/lib/deface/environment.rb:29:in load_all' from [...]/deface-0.9.1/lib/deface/railtie.rb:12:inactivate'
from [...]/activesupport-3.2.12/lib/active_support/callbacks.rb:429:in _run__3500165977034887579__prepare__3119406908442186579__callbacks' from [...]/activesupport-3.2.12/lib/active_support/callbacks.rb:405:in__run_callback'
from [...]/activesupport-3.2.12/lib/active_support/callbacks.rb:385:in _run_prepare_callbacks' from [...]/activesupport-3.2.12/lib/active_support/callbacks.rb:81:inrun_callbacks'
from [...]/actionpack-3.2.12/lib/action_dispatch/middleware/reloader.rb:74:in prepare!' from [...]/actionpack-3.2.12/lib/action_dispatch/middleware/reloader.rb:48:inprepare!'
from [...]/railties-3.2.12/lib/rails/application/finisher.rb:47:in block in <module:Finisher>' from [...]/railties-3.2.12/lib/rails/initializable.rb:30:ininstance_exec'
from [...]/railties-3.2.12/lib/rails/initializable.rb:30:in run' from [...]/railties-3.2.12/lib/rails/initializable.rb:55:inblock in run_initializers'
from [...]/railties-3.2.12/lib/rails/initializable.rb:54:in each' from [...]/railties-3.2.12/lib/rails/initializable.rb:54:inrun_initializers'
from [...]/railties-3.2.12/lib/rails/application.rb:136:in initialize!' from [...]/railties-3.2.12/lib/rails/railtie/configurable.rb:30:inmethod_missing'
from /Users/daniellebakhazi/Sites/rudy/config/environment.rb:5:in <top (required)>' from [...]/polyglot-0.3.3/lib/polyglot.rb:63:inrequire'
from [...]/polyglot-0.3.3/lib/polyglot.rb:63:in require' from [...]/activesupport-3.2.12/lib/active_support/dependencies.rb:251:inblock in require'
from [...]/activesupport-3.2.12/lib/active_support/dependencies.rb:236:in load_dependency' from [...]/activesupport-3.2.12/lib/active_support/dependencies.rb:251:inrequire'
from [...]/railties-3.2.12/lib/rails/application.rb:103:in require_environment!' from [...]/railties-3.2.12/lib/rails/commands.rb:25:in<top (required)>'
from script/rails:6:in require' from script/rails:6:in

'

I'm running ruby-1.9.3-p286 (via RVM) and Rails 3.2.12.

Any ideas? I saw that @sbounmy posted a similar issue about this, but there is no fix as far as I can see.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.