Tag: spree

在rails 3.2中使用nginx而不是rails来提供static_assets

我最近部署了一个基于SpreeCommerce平台的网站。 我正在使用nginx,并希望nginx能够提供我的静态资产。 我遇到的问题是,当用户在网站上为产品上传新照片时,图像看起来可以正确保存(文件位于服务器上),但它们不会被提供给浏览器。 我可以通过将production.rb更改为config.serve_static_assets = true而不是false并将图片重新上传到现有产品来暂时解决此问题。 但是这有资源而不是nginx服务 – 而不是我想要发生的事情。 这是我目前的nginx配置文件: user spree; worker_processes 4; pid /var/run/nginx.pid; events { worker_connections 1024; multi_accept on; } http { types_hash_bucket_size 512; types_hash_max_size 2048; sendfile on; tcp_nopush on; tcp_nodelay off; include /etc/nginx/mime.types; default_type application/octet-stream; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; gzip on; gzip_disable “msie6”; gzip_proxied any; gzip_min_length 500; gzip_types text/plain text/css application/json […]

向Spree前端添加自定义的客户端表单validation

我正在尝试在Spree的checkout/address页面的输入字段中添加自定义的客户端validation。 所以,这是我到目前为止所做的: 将输入添加到表单(这里使用Haml和SimpleForm): = form.input :vat_number, label: Spree.t(:vat_number) 在我的vendor/assets/javascripts/spree/frontend/checkout/address.js.coffee ,添加jQuery validate方法并将规则插入validate()调用: ($).validator.addMethod “vatNumber”, (value, element) -> return false , “Something wrong!” Spree.onAddress = () -> if ($ ‘#checkout_form_address’).is(‘*’) ($ ‘#checkout_form_address’).validate({ rules: { order_bill_address_attributes_vat_number: { vatNumber: true } } }) # … rest of the file … 尽管其余的表单validation有效,但validation器似乎不在vat_number字段上运行。 在javascript调试控制台中,如果我输入$.validator.methods vatNumber ,我确实看到添加了新的vatNumber方法,所以问题必须是我调用validate() ,或者与我的事实有关使用SimpleForm 。 我已经将validate()调用的代码更改为: ($ ‘#order_bill_address_attributes_vat_number’).rules(“add”, […]

Rails – 安装Spree的问题

我在Rails应用程序中安装Spree时遇到问题。 当我运行gem’spree’时(根据http://spreecommerce.com/documentation/getting_started.html上的说明) 我收到以下错误: 错误:执行gem时…(RuntimeError) 未知的命令狂欢 我安装了以下Spreegem: gem列表狂欢 ***当地gem*** 狂欢(0.30.1) spree_api(0.30.1) spree_auth(0.30.1) spree_core(0.30.1) spree_dash(0.30.1) spree_promo(0.30.1) spree_sample(0.30.1) 当我安装我使用的Spree gem时: sudo gem install spree 谢谢你的帮助。

狂欢:关闭SSL重定向/管理员回到站点

我已经设置了一个新的rails应用程序,安装了spree gem(1.1.2)并且能够成功地使Spree运行起来然后我没有SSL证书,我只是想在购买之前搞乱Spree我可以成功地显示将显示产品等的狂欢页面,但是当我转到/ admin时,它会重定向回网站的主页。 这是日志显示的内容: Started GET “/admin” for 76.122.36.219 at Wed Jul 18 15:25:42 -0500 2012 Processing by Spree::Admin::OverviewController#index as HTML Redirected to http://**************.com/ Completed 302 Found in 139ms (ActiveRecord: 5.1ms) 我已经更新了config / initializers / spree.rb来包含 config.allow_ssl_in_production = false 所以它不使用SSL。 这是我的耙子 About your applications environment Ruby version 1.8.7 (x86_64-linux) RubyGems version 1.6.2 Rack version 1.4 […]

Spree下拉框用于变体选项值

我正在学习Spree 3.0,我设置了一个卖短裤的测试店。 短裤有多种选择类型:尺寸,颜色,长度 我想改变它从前端复选框到下拉框显示前端变体选项的方式。 目前,Spree将选项类型显示为单选按钮: 我想更改此选项以使用每个选项类型的下拉菜单,如下所示: 我尝试过以下方法: 但它只显示每个标记中所有选项类型的值: 我想知道将选项值拆分为单独下拉菜单的最佳方法吗? 任何帮助都非常感谢,谢谢。

将名称添加到Spree Devise注册

我正在尝试添加姓名,姓氏和生日来设计Spree注册。 我已经安装了gem gem ‘spree_auth_devise’, github: ‘spree/spree_auth_devise’, branch: ‘3-0-stable’ 创建了迁移: class AddFieldsToSpreeUsers < ActiveRecord::Migration def change add_column :spree_users, :name, :string add_column :spree_users, :surname, :string add_column :spree_users, :birthdate, :time end end 创建了一个新表单来添加字段app / views / spree / shared / _user_form.html.erb 定义应用程序控制器中的方法以使用before操作运行 class ApplicationController < ActionController::Base # Prevent CSRF attacks by raising an exception. # For APIs, you […]

如何使用Imagemagick为图像添加水印?

我以为我会加上这个,因为我花了很多时间才开始工作,我看到很多人都遇到了问题。 我正在尝试在Spree(Rails)应用程序中为图像模型添加水印处理器。 我收到的错误如下: There was an error processing the watermark for stream composite: unable to open image No such file or directory @ error/blob.c/OpenBlob/2588 @ error/png.c/ReadPNGImage/3633 PaperclipCommandNotFoundError PaperclipCommandLineError

如何覆盖lib / spree / search / base.rb

我需要覆盖get_products_conditions_for中的get_products_conditions_for方法,这样做的最佳方法是什么? 我尝试将其添加到初始化程序中: Spree::Search::Base.class_eval do def get_products_conditions_for(base_scope, query) base_scope.like_any([:name, :description], query.split) | base_scope.joins(“JOIN taggings on taggings.taggable_id = spree_products.id JOIN tags on tags.id = taggings.tag_id”).where(“tags.name = ?”, query.split) end end 启动服务器时导致此错误: uninitialized constant Spree::Search (NameError) 我也尝试将其添加到“/lib/spree/search/base.rb”和“/lib/spree/search/tags_search.rb” module Spree::Search class TagsSearch < Spree::Search::Base def get_products_conditions_for(base_scope, query) base_scope.like_any([:name, :description], query.split) | base_scope.joins("JOIN taggings on taggings.taggable_id = spree_products.id JOIN tags […]