Sabo
11/23/2022, 11:31 AMlayouts/spree_application.html.erb
how and from where is calculed the value of <%= title %>
?Sabo
11/24/2022, 8:53 AMmount Spree::Core::Engine, at: '/', constraints : { subdomain: 'shop' }
or
Spree::Core::Engine.routes.draw do
constraints subdomain: 'shop' do
...
end
end
?BFX462heo
11/24/2022, 9:32 AMBFX462heo
11/24/2022, 9:33 AMBFX462heo
11/24/2022, 9:35 AMBFX462heo
11/25/2022, 9:55 AMAntón
11/25/2022, 12:18 PM# config/initializers/spree.rb
config.roles.assign_permissions :warehouse_admin, [
'Spree::PermissionSets::RestrictedStockManagement'
]
but the user sees all warehouse. The problem is because of the query that is launched
this is the query
Where does the OR ("spree_stock_locations"."active" = TRUE)
?
Spree::StockLocation Load (0.3ms) SELECT "spree_stock_locations".* FROM "spree_stock_locations" WHERE (("spree_stock_locations"."id" = 3) OR ("spree_stock_locations"."active" = TRUE)) /* loading for inspect */ LIMIT $1 [["LIMIT", 11]]
I have tried having a custom permissions class but the result is the same.
#app/models/spree/permissions_sets/warehouse_admin.rb(
require 'cancan'
module Spree
module PermissionSets
class WarehouseAdmin < Spree::PermissionSets::Base
def activate!
can :read, Spree::StockLocation, id: location_ids
end
def location_ids
@location_ids ||= user.stock_locations.pluck(:id)
end
end
end
end
# config/initializers/spree.rb
config.roles.assign_permissions :warehouse_admin, [
'Spree::PermissionSets::WarehouseAdmin'
]
thanks!!Sabo
11/25/2022, 12:56 PMRails.application.routes.draw do
get '/', to: 'home#index', constraints: { subdomain: '' }
mount Spree::Core::Engine, at: '/', constraints: { subdomain: 'shop' }
end
but I have an error to find the HomeController raise MissingController.new(error.message, error.name)
PS. I just understood that it is certainly because it is in the Spree moduleSabo
11/26/2022, 1:09 AMmount Spree::Core::Engine, at: '/', constraints: { subdomain: 'shop' }
) I'm getting some problems to upload product images from the backend
after upload an image, in the home view:
(before)
<img itemprop="image" src="<https://bucket.s3.eu-west-2.amazonaws.com/inaiwpq6x48d2i81z2m2e6au7hi0>">
(now)
<img alt="" itemprop="image" src="/assets/noimage/small-e0e64753ab233ecd636325b86739eace7af7759hu1t673578df9781f7f34dbaf.png">
PS. I'm on Rails 7, so with ActiveStorageCody Baldwin
11/27/2022, 1:43 AMraise_conflict_error': *You tried to define an enum named "refrigeration" on the model "Spree::Product", but this will generate a instance method "room?", which is already defined by another enum. (ArgumentError)*
Regardless of what I set the enum text values to it throws the same error. Is it being prepended twice?Kevin I
11/28/2022, 6:41 PMAlexander V
11/28/2022, 8:57 PMuninitialized constant SolidusPaypalBraintree::Gateway (NameError)
when trying to start the server after configuring SolidusPaypalBraintree gem exactly how README says.
What it can be?
Will appreciate any hints.
ruby 3.1.2
rails 7.0.4Cody Baldwin
11/29/2022, 3:25 AM<span class="js-address-fields" style="display: none;">
<%=
form.collection_select(
:state_id, address.country.states, :id, Proc.new { |val| t(val.name) },
{include_blank: true},
{
class: have_states ? 'required border-slate-400 grow text-slate-900 focus:border-sky-200 focus:ring-1 focus:ring-sky-100 text-xs lg:text-sm xl:text-base rounded' : '',
style: have_states ? '' : 'display: none;',
disabled: !have_states,
autocomplete: address_type + ' address-level1',
})
%>
<%=
form.text_field(
:state_name,
class: !have_states ? 'required border-slate-400 grow text-slate-900 focus:border-sky-200 focus:ring-1 focus:ring-sky-100 text-xs lg:text-sm xl:text-base rounded' : '',
style: have_states ? 'display: none;' : '',
disabled: have_states,
autocomplete: address_type + ' address-level1',
)
%>
</span>
If I turn off the JS then I've got to write some new js for countries that don't have states, or the form element won't show. This Proc added to the collection_select won't work, it show sup for a few ms then disappears.Alexander V
11/29/2022, 7:53 AMAlexander V
11/30/2022, 8:14 AMIf your site uses an unmodified solidus_frontend, it should now be ready to take payments.
this doesn't work now out of the box, right?
because I have multiple files missing errors, like partials, scriptsBFX462heo
12/01/2022, 7:20 AMOleksandr Pozniak
12/01/2022, 11:39 AMCody Baldwin
12/01/2022, 10:15 PMjakemumu
12/02/2022, 6:28 PMSteve Simitzis
12/03/2022, 4:12 AMsolidus_social
. I’m getting stuck at this step:
bundle exec rails g solidus_social:install
With this error message:
/Users/steve/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/solidus_social-1.5.0/app/decorators/controllers/solidus_social/spree/user_registrations_controller_decorator.rb:24:in `<module:UserRegistrationsControllerDecorator>': uninitialized constant Spree::UserRegistrationsController (NameError)
::Spree::UserRegistrationsController.prepend self
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Did you mean? UserSessionsController
UserConfirmationsController
from /Users/steve/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/solidus_social-1.5.0/app/decorators/controllers/solidus_social/spree/user_registrations_controller_decorator.rb:5:in `<module:Spree>'
Any ideas how I can fix this? Gemfile attached in the threadWilfred
12/06/2022, 10:14 AM[...]
created_product = Spree::Product.find_or_create_by(
name: name,
price: price,
description: description,
available_on: Time.current,
shipping_category: shipping_category,
tax_category: tax_category,
taxon_ids: [taxon_ids]
)
puts created_product.name
options = $browser.at_css("#productOverview_feature_div table")
values = []
options.css("tr").each_with_index do |row, index|
type = row.at_css("td:nth-of-type(1) span").text.strip
value = row.at_css("td:nth-of-type(2) span").text.strip
created_type = Spree::OptionType.find_or_create_by(
name: type,
presentation: type
)
# created_product.option_types << created_type.name
# created_product.save
# => ActiveRecord::AssociationTypeMismatch: Spree::OptionType(#74440) expected, got "Brand" which is an instance of String(#5020)
created_value = Spree::OptionValue.find_or_create_by(
name: value,
presentation: value,
option_type: created_type.name
)
puts "#{ created_type.name }: #{ created_value.name }"
values << created_value.name
end
created_product.variants.create(
option_values: [values],
sku: rand(100000)
)
created_product.save!
# => ActiveRecord::RecordInvalid: Validation failed: Option types is invalid, Variants is invalid, Variants including master is invalid
Wilfred
12/06/2022, 12:42 PMGiven Reed
12/06/2022, 3:56 PMAlexander V
12/06/2022, 7:21 PMGiven Reed
12/07/2022, 3:43 PMPG::UniqueViolation: ERROR: duplicate key value violates unique constraint "spree_shipping_rates_join_index"
DETAIL: Key (shipment_id, shipping_method_id)=(9, 2) already exists.
when I click "save and continue" after entering the shipping address.
Looking at the logs and I see
[1m[36mSpree::ShippingRate Create (0.7ms)[0m [1m[32mINSERT INTO "spree_shipping_rates" ("shipment_id", "shipping_method_id", "selected", "cost", "created_at", "updated_at", "tax_rate_id", "name", "easy_post_shipment_id", "easy_post_rate_id") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id"[0m [["shipment_id", 9], ["shipping_method_id", 2], ["selected", true], ["cost", "23.75"], ["created_at", "2022-12-07 15:25:17.919924"], ["updated_at", "2022-12-07 15:25:17.919924"], ["tax_rate_id", nil], ["name", "USPS Express"], ["easy_post_shipment_id", "shp_683cdccae3f34e65b8e77f997c6d84e1"], ["easy_post_rate_id", "rate_2d90fba67a874e62ae4dd45ac51ce490"]]
↳ app/controllers/checkouts_controller.rb:53:in `transition_forward'
[1m[36mSpree::ShippingRate Create (1.4ms)[0m [1m[32mINSERT INTO "spree_shipping_rates" ("shipment_id", "shipping_method_id", "selected", "cost", "created_at", "updated_at", "tax_rate_id", "name", "easy_post_shipment_id", "easy_post_rate_id") VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING "id"[0m [["shipment_id", 9], ["shipping_method_id", 2], ["selected", false], ["cost", "23.75"], ["created_at", "2022-12-07 15:25:17.924424"], ["updated_at", "2022-12-07 15:25:17.924424"], ["tax_rate_id", nil], ["name", "USPS Express"], ["easy_post_shipment_id", "shp_683cdccae3f34e65b8e77f997c6d84e1"], ["easy_post_rate_id", "rate_127e8d2ca0504d1ea584d5b911678396"]]
↳ app/controllers/checkouts_controller.rb:53:in `transition_forward'
It appears to be trying to insert twice. I haven't done any shipping customizations, the store is still mostly vanilla. I'm running on solidus 3 (gem "solidus_core", "~> 3.2"
). I can dig into the gem's code to try to figure it out, but was wondering if anybody had any ideas that would save me needing to dig around.Alexander V
12/07/2022, 7:20 PMBFX462heo
12/08/2022, 8:31 AMWilfred
12/08/2022, 9:06 AMamazon.rake:336: syntax error, unexpected end-of-input, expecting 'end'
Thanks!BFX462heo
12/09/2022, 8:09 AMAlexander V
12/09/2022, 8:49 PM