Projects & Talks
- Let's Git This Party Started!, an introduction for new team members to Git and GitHub. Grab your keys and start your engines, you'll be racing ahead with Git by the end!
- A Game of Darts, a brief introduction hitting the high points of Dart.
- Polfyill the future with Angular.js, an Angularjs lightning talk from RubyConf.
- JAWS On A Plane, an HTML5 game made on a 3 hour plane flight.
Adding Spree With Custom User
Adding Spree E-commerce to an existing Rails application that uses Devise and a custom User model
These steps document this process for my own records, but anyone is welcome to use them. I’ve taken these steps from a few places:
cd <YOUR_AWESOME_RAILS_APP> cat "gem 'spree', '~> 3.3.0'" > Gemfile bundle install bin/rails generate spree:install --user-class=User --no-sample --no-migrate --no-seed bin/rails g spree:custom_user User bin/rails db:migrate
At this point it’s time to customize our routes so Spree knows how to login and out. Open
config/routes.rb and add:
devise_scope :person do get '/login', to: "devise/sessions#new" get '/signup', to: "devise/registrations#new" delete '/logout', to: "devise/sessions#destroy" end
As well, for your custom
User class to work you need to include some of the expected methods and relations by including some modules from Spree in your class definition. If you don’t do this you’ll find your missing many of the methods required for Spree to work properly (
last_incomplete_spree_order, etc.). For example,
class User < ApplicationRecord include Spree::UserAddress include Spree::UserMethods include Spree::UserPaymentSource include Spree::UserReporting <YOUR CLASS WOULD CONTINUE HERE> end
Finally I went back to finish the gateway install:
cat "gem 'spree_gateway', '~> 3.3'" > Gemfile bundle install bundle exec rails g spree_gateway:install