Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ruby-on-rails/54.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails “spree_gateway”,github:“spree/spree_gateway”,分支:“3-0-stable” 宝石“设计” #使用ActiveModel具有\u安全\u密码 #gem'bcrypt',“~>3.1.7” #使用Unicorn作为应用程序服务器 #宝石“独角兽” #使用Capistrano进行部署 #gem“capistrano rails”,集团::开发 小组:开发,:测试 #在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台 宝石“比伯” #使用sqlite3作为活动记录的数据库 gem'sqlite3' #Spring通过让应用程序在后台运行来加速开发。阅读更多:https://github.com/rails/spring 宝石“春天” #在异常页面上或通过在视图中使用访问IRB控制台 gem“web控制台”,“~>2.0” 结束 小组:生产部 #使用PostgreSQL作为活动记录的数据库 gem‘pg’、‘0.18.2’ #使用rails_12 factor启用在生产中服务资产,并将记录器设置为标准输出。 gem“轨道系数”,“0.0.3” 结束_Ruby On Rails_Spree - Fatal编程技术网

Ruby on rails “spree_gateway”,github:“spree/spree_gateway”,分支:“3-0-stable” 宝石“设计” #使用ActiveModel具有\u安全\u密码 #gem'bcrypt',“~>3.1.7” #使用Unicorn作为应用程序服务器 #宝石“独角兽” #使用Capistrano进行部署 #gem“capistrano rails”,集团::开发 小组:开发,:测试 #在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台 宝石“比伯” #使用sqlite3作为活动记录的数据库 gem'sqlite3' #Spring通过让应用程序在后台运行来加速开发。阅读更多:https://github.com/rails/spring 宝石“春天” #在异常页面上或通过在视图中使用访问IRB控制台 gem“web控制台”,“~>2.0” 结束 小组:生产部 #使用PostgreSQL作为活动记录的数据库 gem‘pg’、‘0.18.2’ #使用rails_12 factor启用在生产中服务资产,并将记录器设置为标准输出。 gem“轨道系数”,“0.0.3” 结束

Ruby on rails “spree_gateway”,github:“spree/spree_gateway”,分支:“3-0-stable” 宝石“设计” #使用ActiveModel具有\u安全\u密码 #gem'bcrypt',“~>3.1.7” #使用Unicorn作为应用程序服务器 #宝石“独角兽” #使用Capistrano进行部署 #gem“capistrano rails”,集团::开发 小组:开发,:测试 #在代码中的任意位置调用“byebug”以停止执行并获得调试器控制台 宝石“比伯” #使用sqlite3作为活动记录的数据库 gem'sqlite3' #Spring通过让应用程序在后台运行来加速开发。阅读更多:https://github.com/rails/spring 宝石“春天” #在异常页面上或通过在视图中使用访问IRB控制台 gem“web控制台”,“~>2.0” 结束 小组:生产部 #使用PostgreSQL作为活动记录的数据库 gem‘pg’、‘0.18.2’ #使用rails_12 factor启用在生产中服务资产,并将记录器设置为标准输出。 gem“轨道系数”,“0.0.3” 结束,ruby-on-rails,spree,Ruby On Rails,Spree,我已删除 delegate_belongs_to :product, :delivery_on 从我的product_decorator.rb文件中,这解决了问题 老实说,我并不真正了解代表的职责,但我添加了它,因为官员指示我们这样做: 我们还需要将销售价格委托给主变型,以便 使更新的产品编辑表单正常工作 我们可以通过创建一个新文件来实现这一点 app/models/spree/product_decorator.rb并添加以下内容 对它: 模块Spree Product.class_eval

我已删除

delegate_belongs_to :product, :delivery_on
从我的product_decorator.rb文件中,这解决了问题

老实说,我并不真正了解代表的职责,但我添加了它,因为官员指示我们这样做:

我们还需要将销售价格委托给主变型,以便 使更新的产品编辑表单正常工作

我们可以通过创建一个新文件来实现这一点 app/models/spree/product_decorator.rb并添加以下内容 对它:

模块Spree Product.class_eval do 委托人所属:主控,:销售\价格结束

注意,我也尝试过使用委托(您属于)(u to:master),(delivery)(打开),但也不起作用。

我删除了

delegate_belongs_to :product, :delivery_on
从我的product_decorator.rb文件中,这解决了问题

老实说,我并不真正了解代表的职责,但我添加了它,因为官员指示我们这样做:

我们还需要将销售价格委托给主变型,以便 使更新的产品编辑表单正常工作

我们可以通过创建一个新文件来实现这一点 app/models/spree/product_decorator.rb并添加以下内容 对它:

模块Spree Product.class_eval do 委托人所属:主控,:销售\价格结束


注意,我也尝试过使用delegate\u-atto\u-to:master,:delivery\u,但这也不起作用。

您的迁移添加了一个
活动的
列,而不是
delivery\u-on
列--您粘贴了正确的迁移吗?很好。最初我复制了错误的迁移。用正确的迁移更新了帖子。感谢@MikeManfrinI相信您需要将交付添加到控制器的强参数中;很可能它不被允许通过,因此应用程序试图在没有按时交付的情况下生产产品(这导致您的验证失败)。@MikeManfrin我认为强参数也存在问题。我在github上从spree贡献者那里找到了这个,并遵循他们的解决方案。在我的帖子中,请参阅app/controllers/application_controllers.rb中关于将传递添加到PermittedAttributes的部分。当我启动控制台并运行Spree::PermittedAttributes.product_attributes时,delivery_on会返回到允许的属性列表中,因此我认为它已被添加。还有其他想法吗?感谢您的帮助。您的迁移正在添加一个
活动的
列,而不是在
列上添加一个
delivery\u——您粘贴了正确的迁移吗?很好。最初我复制了错误的迁移。用正确的迁移更新了帖子。感谢@MikeManfrinI相信您需要将交付添加到控制器的强参数中;很可能它不被允许通过,因此应用程序试图在没有按时交付的情况下生产产品(这导致您的验证失败)。@MikeManfrin我认为强参数也存在问题。我在github上从spree贡献者那里找到了这个,并遵循他们的解决方案。在我的帖子中,请参阅app/controllers/application_controllers.rb中关于将传递添加到PermittedAttributes的部分。当我启动控制台并运行Spree::PermittedAttributes.product_attributes时,delivery_on会返回到允许的属性列表中,因此我认为它已被添加。还有其他想法吗?谢谢你的帮助。
Spree::Product.class_eval do
  validates :delivery_on, presence: true
  delegate_belongs_to :master, :delivery_on, :active
end
Spree::PermittedAttributes.product_attributes << :delivery_on
Spree::Api::ApiHelpers.product_attributes << :delivery_on
Deface::Override.new(:virtual_path => 'spree/admin/products/new',
  :name => 'add_delivery_on_to_product_new',
  :original => '931806c52c232e6a373cb06fa739f3913ad13c3d',
  :insert_after => "erb[loud]:contains('text_field :available_on')",
  :text => "
    <%= f.field_container :delivery_on, class: ['form-group'] do %>
      <%= f.label :delivery_on, raw(Spree.t(:delivery_on) + content_tag(:span, ' *')) %>
      <%= f.error_message_on :delivery_on %>
      <%= f.text_field :delivery_on, :class => 'datepicker form-control' %>
    <% end %>
  ")
Deface::Override.new(:virtual_path => 'spree/admin/products/_form',
  :name => 'add_delivery_on_to_product_edit',
  :original => '931806c52c232e6a373cb06fa739f3913ad13c3d',
  :insert_after => "erb[loud]:contains('text_field :available_on')",
  :text => "
    <%= f.field_container :delivery_on, class: ['form-group'] do %>
      <%= f.label :delivery_on, raw(Spree.t(:delivery_on) + content_tag(:span, ' *')) %>
      <%= f.error_message_on :delivery_on %>
      <%= f.text_field :delivery_on, :value =>
datepicker_field_value(@product.delivery_on), class: 'datepicker form-control' %>
    <% end %>
  ")
source 'https://rubygems.org'
ruby '2.2.1'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails',                  '4.2.3'
# Use SCSS for stylesheets
gem 'sass-rails',             '~> 5.0'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier',               '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails',           '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder',               '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc',                   '~> 0.4.0', group: :doc

gem 'spree_core',             branch: '3-0-stable'
gem 'spree_api',              branch: '3-0-stable'
gem 'spree_backend',          branch: '3-0-stable'
gem 'spree_gateway',          github: 'spree/spree_gateway', branch: '3-0-stable'
gem 'devise'

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use Unicorn as the app server
# gem 'unicorn'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug'
  # Use sqlite3 as the database for Active Record
  gem 'sqlite3'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  # Access an IRB console on exception pages or by using <%= console %> in views
  gem 'web-console',          '~> 2.0'
end

group :production do
  # Use PostgreSQL as the database for Active Record
  gem 'pg',                   '0.18.2'
  # Use rails_12 factor to enable serving assets in production and setting your logger to standard out.
  gem 'rails_12factor',       '0.0.3'
end
delegate_belongs_to :product, :delivery_on