sudo apt-get update && sudo apt-get upgrade && sudo apt-get dist-upgrade && sudo apt-get autoremove
sudo reboot
| #account_configurations_controller_spec.rb | |
| require 'spec_helper' | |
| describe AccountConfigurationsController do | |
| include Devise::TestHelpers | |
| before (:each) do | |
| @user = Factory(:user) | |
| @user.confirm! | |
| sign_in :user, @user |
| I'm building a billing plan into my rails app. I have 3 different plans (free, pro, enterprise) and want to be able to assign users to a plan and enable them to switch between plans. I'm trying to figure out what would be the best way of doing this. | |
| 1. Create a BillingPlan model with the 3 plans and the fields such as whether a feature is available in that plan or not. example {:free => {:analytics => false, :pdf_reports => false, :users => 1}, :pro => {:analytics => true, :pdf_reports => true, :users => 3}} So if say I want to see if the current user is able to download pdf reports, i just pull his plan_id and check if pdf_reports field is true or false. If I want to edit the plans I would update the plans in the database. | |
| 2. Another way I thought possible is to have a billing_plan field which holds the users plan. Then the plan variables store them on a YAML file and then load the yaml file in the config folder and load it up inside an initializer thereby making the data in the YAML file available as a |
| [global_config] | |
| enabled_plugins = CustomCommandsMenu, InactivityWatch, TestPlugin, ActivityWatch, TerminalShot, LaunchpadCodeURLHandler, APTURLHandler, MavenPluginURLHandler, LaunchpadBugURLHandler, LayoutManager | |
| title_transmit_bg_color = "#832527" | |
| [keybindings] | |
| [profiles] | |
| [[default]] | |
| scrollback_lines = 4000 | |
| [layouts] | |
| [[default]] | |
| [[[child1]]] |
| source 'http://rubygems.org' | |
| ############################## | |
| # Rails and DB | |
| ############################## | |
| # gem 'rack', '1.2.1' | |
| gem 'rails', '3.2.0' | |
| group :assets do | |
| gem 'sass-rails', " ~> 3.2.3" |
| # see http://stackoverflow.com/questions/5880962/how-to-destroy-jobs-enqueued-by-resque-workers - old version | |
| # see https://github.com/defunkt/resque/issues/49 | |
| # see http://redis.io/commands - new commands | |
| namespace :resque do | |
| desc "Clear pending tasks" | |
| task :clear => :environment do | |
| queues = Resque.queues | |
| queues.each do |queue_name| | |
| puts "Clearing #{queue_name}..." |
| #!/bin/bash | |
| # Requirements: sed, grep, curl, pkill | |
| # User configuration | |
| LOCAL_INSTALL="/usr/lib/sublime-text-2" # Must be user-writable | |
| REPO="dev" # "dev" for dev releases, or "2" for beta releases | |
| TARGET_BUILD="Linux 32 bit" # can be one of "Windows", "Windows 64 bit", "OS X", "Linux 32 bit", "Linux 64 bit" | |
| # Check if sublime text is running |
| Rails new app Cheat sheet | |
| 1. Install RVM | |
| $ \curl -L https://get.rvm.io | bash -s stable --ruby | |
| 2. Install Ruby | |
| $ rvm install ruby | |
| $ rvm --default use ruby-2.3.3 | |
| 3. Install Javascript runtime |