Coder Social home page Coder Social logo

acts_as_shopping_cart's People

Contributors

abatko avatar chischaschos avatar choonkeat avatar dabit avatar dee-2015 avatar marcusvmsa avatar strukturedkaos avatar ulrichthomasgabor 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

acts_as_shopping_cart's Issues

Cannot set currency to :eur

Hi,
I'm using the GEM on a rails 5 project.
Everything is working perfectly but i cannot change the currency to eur.

i have in my MoneyRails initializer
config.default_currency = :eur

but still does not work.

Thanks !

Francis

Rails-Money Changes the shopping_cart.total return value

I added the Rails-money gem to the app to use it for currencies etc. When playing around with the app I noticed that if I call the total method on the cart it doesnt return the total value of the cart but instead a Money object. When I setup the DB I manually created the shopping_cart_items table. Not sure if that is the reason? This is mentioned in another issue as a way to deal with currency types that this gem doesnt solve. Any help would be great. Not sure if this is a bug or not but its doesnt seem like the desired result. Thanks

create_table :shopping_cart_items do |t| t.integer :owner_id t.string :owner_type t.integer :quantity t.integer :item_id t.string :item_type t.monetize :price t.timestamps end

`irb(main):002:0> shopping_cart = ShoppingCart.create
(0.2ms) BEGIN
ShoppingCart Create (42.5ms) INSERT INTO "shopping_carts" ("created_at", "updated_at") VALUES ($1, $2) RETURNING "id" [["created_at", "2020-04-08 13:11:54.235042"], ["updated_at", "2020-04-08 13:11:54.235042"]]
(1.0ms) COMMIT
=> #<ShoppingCart id: 2, created_at: "2020-04-08 13:11:54", updated_at: "2020-04-08 13:11:54">
irb(main):003:0> shopping_cart.add(template, template.standard_license_price)
ShoppingCartItem Load (0.4ms) SELECT "shopping_cart_items".* FROM "shopping_cart_items" WHERE "shopping_cart_items"."owner_id" = $1 AND "shopping_cart_items"."owner_type" = $2 AND "shopping_cart_items"."item_type" = $3 AND "shopping_cart_items"."item_id" = $4 ORDER BY "shopping_cart_items"."id" ASC LIMIT $5 [["owner_id", 2], ["owner_type", "ShoppingCart"], ["item_type", "TemplateProduct"], ["item_id", 5], ["LIMIT", 1]]

(0.2ms) BEGIN
ShoppingCartItem Create (41.5ms) INSERT INTO "shopping_cart_items" ("owner_id", "owner_type", "quantity", "item_id", "item_type", "price_cents", "created_at", "updated_at") VALUES ($1, $2, $3, $4, $5, $6, $7, $8) RETURNING "id" [["owner_id", 2], ["owner_type", "ShoppingCart"], ["quantity", 1], ["item_id", 5], ["item_type", "TemplateProduct"], ["price_cents", 9054], ["created_at", "2020-04-08 13:12:16.696867"], ["updated_at", "2020-04-08 13:12:16.696867"]]
(2.1ms) COMMIT
=> #<ShoppingCartItem id: 2, owner_id: 2, owner_type: "ShoppingCart", quantity: 1, item_id: 5, item_type: "TemplateProduct", price_cents: 9054, price_currency: "USD", created_at: "2020-04-08 13:12:16", updated_at: "2020-04-08 13:12:16">
irb(main):004:0> shopping_cart.total
ShoppingCartItem Load (0.6ms) SELECT "shopping_cart_items".* FROM "shopping_cart_items" WHERE "shopping_cart_items"."owner_id" = $1 AND "shopping_cart_items"."owner_type" = $2 [["owner_id", 2], ["owner_type", "ShoppingCart"]]

"#Money fractional:9801 currency:USD"
irb(main):005:0> `

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.