<commit_before># acts_as_shopping_cart

A simple shopping cart implementation.

[![Build Status](https://secure.travis-ci.org/crowdint/acts_as_shopping_cart.png?branch=master)](http://travis-ci.org/crowdint/acts_as_shopping_cart)

You can find an example application [here](https://github.com/crowdint/acts_as_shopping_cart_app).

## Install

### Rails 3

Include it in your Gemfile

    gem 'acts_as_shopping_cart', '~> 0.1.6'

And run bundler

    bundle install

## Usage

You need two models, one to hold the Shopping Carts and another to hold the Items

You can use any name for the models, you just have to let each model know about each other.

### Examples

For the Shopping Cart:

    class Cart < ActiveRecord::Base
      acts_as_shopping_cart_using :cart_item
    end


For the items:

    class CartItem < ActiveRecord::Base
      acts_as_shopping_cart_item_for :cart
    end

or, if you want to use convention over configuration, make sure your models are called *ShoppingCart* and *ShoppingCartItems*,
then just use the shortcuts:

    class ShoppingCart < ActiveRecord::Base
      acts_as_shopping_cart<commit_msg>Update README with dropped support for Rails 3<commit_after># acts_as_shopping_cart

A simple shopping cart implementation.

[![Build Status](https://secure.travis-ci.org/crowdint/acts_as_shopping_cart.png?branch=master)](http://travis-ci.org/crowdint/acts_as_shopping_cart)

You can find an example application [here](https://github.com/crowdint/acts_as_shopping_cart_app).

## Install

### Rails 3

**As of Version 0.2.0 Rails 3 is no longer supported. Please use the 0-1-x branch
if you still need to implement this gem in a Rails 3 app**

Include it in your Gemfile

    gem 'acts_as_shopping_cart', :github => 'crowdint/acts_as_shopping_cart', :branch => '0-1-x'

And run bundler

    bundle install

### Rails 4

Just include it in your Gemfile as:

    gem 'acts_as_shopping_cart', '~> 0.2.0'

And run bundle install

    bundle install

## Usage

You need two models, one to hold the Shopping Carts and another to hold the Items

You can use any name for the models, you just have to let each model know about each other.

### Examples

For the Shopping Cart:

    class Cart < ActiveRecord::Base
      acts_as_shopping_cart_using :cart_item
    end


For the items:

    class CartItem < ActiveRecord::Base
      acts_as_shopping_cart_item_for :cart
    end

or, if you want to use convention over configuration, make sure your models are called *ShoppingCart* and *ShoppingCartItems*,
then just use the shortcuts:

    class ShoppingCart < ActiveRecord::Base
      acts_as_shopping_cart
{'fraction_non_alphanumeric': 0.07695238095238095, 'fraction_numerical': 0.007238095238095238, 'mean_word_length': 4.189723320158103, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 7, 'https://': 4, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '568821', 'n_tokens_mistral': 858, 'n_tokens_neox': 834, 'n_words': 285}