Ruby on rails Spree and S3


slippysoup
7/5/2016 5:43 am
HOME » Web Development

I am having a difficult time connecting Amazon S3 buckets to a e-commerce spree application. I have added the necessary code to the initializer/spree.rb and set the necessary environment variables. This is the code inside my spree.rb

# Configure Solidus Preferences
# See http://docs.solidus.io/Spree/AppConfiguration.html for details

Spree.config do |config|
  # Without this preferences are loaded and persisted to the database.
This
  # changes them to be stored in memory.
  # This will be the default in a future version.
  config.use_static_preferences!

  # Core:

  # Default currency for new sites
  config.currency = "USD"

  # from address for transactional emails
  config.mails_from = "expressmobiletechs@gmail.com"

  # Uncomment to stop tracking inventory levels in the application
  # config.track_inventory_levels = false

  # When set, product caches are only invalidated when they fall below
or rise
  # above the inventory_cache_threshold that is set. Default is to
invalidate cache on
  # any inventory changes.
  # config.inventory_cache_threshold = 3


  # Frontend:


  config.logo = "logo.jpg"
  config.admin_interface_logo = "logo.jpg"

  # Template to use when rendering layout
  # config.layout = "spree/layouts/spree_application"


  # Admin:

  # Custom logo for the admin
  # config.admin_interface_logo = "logo/solidus_logo.png"

  # Gateway credentials can be configured statically here and
referenced from
  # the admin. They can also be fully configured from the admin.
  #
  # config.static_model_preferences.add(
  #   Spree::Gateway::StripeGateway,
  #   'stripe_env_credentials',
  #   secret_key: ENV['STRIPE_SECRET_KEY'],
  #   publishable_key: ENV['STRIPE_PUBLISHABLE_KEY'],
  #   server: Rails.env.production? ? 'production' : 'test',
  #   test_mode: !Rails.env.production?
  # )
end

Spree::Frontend::Config.configure do |config|
  config.use_static_preferences!

  config.locale = 'en'
end

Spree::Backend::Config.configure do |config|
  config.use_static_preferences!

  config.locale = 'en'
end

Spree::Api::Config.configure do |config|
  config.use_static_preferences!

  config.requires_authentication = true
end


Spree.user_class = "Spree::LegacyUser"

attachment_config = {

  s3_credentials: {
    access_key_id:     ENV['AWS_ACCESS_KEY_ID'],
    secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
    bucket:            ENV['S3_BUCKET_NAME']
  },

  storage:        :s3,
  s3_headers:     { "Cache-Control" => "max-age=31557600" },
  s3_protocol:    "https",
  bucket:         ENV['S3_BUCKET_NAME'],
  url:            ":s3_domain_url",

  styles: {
      mini:     "48x48>",
      small:    "100x100>",
      product:  "240x240>",
      large:    "600x600>"
  },

  path:           "/spree/:class/:id/:style/:basename.:extension",
  default_url:    "/spree/:class/:id/:style/:basename.:extension",
  default_style:  "product"
}

attachment_config.each do |key, value|
  Spree::Image.attachment_definitions[:attachment][key.to_sym] = value
end

enter image description
here

I am trying to get my spree stores image uploading for products to work with s3. No other discussion on stack has been able to help me.

Tags : Ruby rails Spree and

Related to : Ruby on rails Spree and S3
Ruby on rails Spree and S3
7/5/2016 5:43 am by slippysoup in Web Development

I am having a difficult time connecting Amazon S3 buckets to a e-commerce spree application. I have added the necessary code to the initializer/spree.rb and set the necessary environment variables. This is the code inside my spree.rb

# Configure Solidus Preferences
# See http://do
TAGS: Ruby rails Spree

Bundler could not find compatible versions for gem spree_core (Spree Ruby on Rails)
by Anton Tupy in Web Development
I just configured Spree on Rails successfully but now I am trying to add "spree_marketplace" and "spree_drop_ship" to spree but getting this errorBundler could not find compatible versions for gem "spree_core": In Gemfile: spree_marketplace (>= 0) ruby depends on spree_core (~> 2.0.3
Rails(3.2.2) Direct sign_in to the Spree(1.1.1) from non-spree controller
by msg in Web Development

I have integrated Spree(1.1.1) into my existing Rails 3.2.2 Application. I have home_controller in my existing application. I want to direct login the user from action in the home controller to the spree using the sign_in method as


user = Spree::User.find(params[:user_id])
si
How do I access rails helpers and embedded ruby inside assets javascript files in ruby on rails?
by alphamars in Web Development

I have a show and hide div that shows and hides comments when clicked. By default before it's clicked it shows a message count plus some down arrows e.g.


"55 Comments [down arrows]"


and when clicked it changes to:


"Hide comments [up arrows]"


I use


Ruby on Rails Migrating Databases Inconsistencies (Ruby on Rails 3 Essential Training Chapter 6)
by björnen in Web Development

I'm doing the Lynda course and am up to migrating databases. So first it seems like there are some syntax differences between what is default in my newer version of Rails (3.2.6) than are in the video, but I took a look at the Ruby website and figured out that it likely doesn't matter.


<
Any good Ruby on Rails Ajax scaffold generator for Ruby on Rails 3?
by ziqew in Web Development

Is there any good Ruby on Rails Ajax scaffold generator for Ruby on Rails 3?


Accessing plain old ruby object in Spree 1.1
by akr in Web Development

I have a Spree 1.1 project that's in my rails 3.2 app with a plain ruby object in app/models/MyObject.rb


class MyObject
def self.some_method
# do stuff
end
end

I'm trying to access the model in an override partial

TAGS: Accessing plain ruby object Spree
Rails 2 + spree (0.11.0): Where is the CheckoutsController?
by ElFenix in Web Development
I was given a legacy spree app and I am supposed to edit one of the deeper checkout pages, but I can't get to it on my local because it keeps redirecting me to the shopping cart page with the flash:Can't check out, no payment methods are configured for this environmentMy database should be identical
Add Spree to rails app with devise
by Barfo in Web Development

I'm new at RoR but I'm loving every bit of it :)


I have a small app that uses devise for authentication and it's working fine.


Now I want to add a ecommerce part nad I decided for spree. I installed spree and during installation it asked me if I wanted to use the default a


Rails Spree internals
by amosk in Web Development

I am trying to use Spree with my RoR application. Ok, I do follow all those guides and FAQs on official website when I want to customize something. That's ok and no problem with it. One question, to which I could not find a clue -- how is that possible, that there is nothing in apps/view, apps/mo


Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2014 © bighow.org All Rights Reserved .