Collection of concerns for your Rails application
Copy to your app/models/concerns directory
| class DeviseMailer < ApplicationMailer | |
| include Devise::Mailers::Helpers | |
| def confirmation_instructions(record) | |
| devise_mail(record, :confirmation_instructions) | |
| end | |
| def reset_password_instructions(record) | |
| devise_mail(record, :reset_password_instructions) | |
| end |
| # Use only in devise overriden controllers to ensure template inheritance. | |
| # Appending resolver will try to find template in app/views/users/passwords/new | |
| # and it doesn't then it will fallback to app/views/devise/passwords/new | |
| # | |
| # ==== Usage | |
| # | |
| # class Users::PasswordsController < ::Devise::PasswordsController | |
| # append_view_path DeviseResolver.new | |
| # end | |
| # |
There are many different provisioning tools out there, the most popular of which are Chef and Puppet. Chef uses Ruby, Puppet uses a DSL (Domain Specific Language), there are others that use simple bash too, but today we're going to focus on Chef Solo.
To get Chef working properly on your local machine you need a few things.
Make sure you use Ruby 1.9.x and not Ruby 2.x as you will get errors with the json 1.6.1 gem on 2.x. Use rbenv or RVM to manage several different Rubies on the one machine.
| Senior (enterprise) | |
| Analyse and profile an application for performance and memory issues | |
| Analyses and profile an application for security issues | |
| Understand database modeling and query analysis | |
| Tune a production deployment (Passenger, Thin, Apache etc) | |
| Understand and use Ruby metaprogramming | |
| Mentoring skills | |
| Communication skills | |
| Planning and Estimation |
| # db/migrate/20131118172653_create_transactional_items_view.rb | |
| class CreateTransactionalItemsView < ActiveRecord::Migration | |
| def up | |
| select_sql = File.open("#{Rails.root}/db/migrate/20131118172653_create_transactional_items_view.sql", 'r') { |f| f.read } | |
| # for materialized view: | |
| view_sql = "CREATE MATERIALIZED VIEW transactional_items AS (#{select_sql})" | |
| # for normal view: | |
| view_sql = "CREATE VIEW transactional_items AS (#{select_sql})" | |
| CREATE EXTENSION tablefunc; | |
| CREATE TABLE sales(year int, month int, qty int); | |
| INSERT INTO sales VALUES(2007, 1, 1000); | |
| INSERT INTO sales VALUES(2007, 2, 1500); | |
| INSERT INTO sales VALUES(2007, 7, 500); | |
| INSERT INTO sales VALUES(2007, 11, 1500); | |
| INSERT INTO sales VALUES(2007, 12, 2000); | |
| INSERT INTO sales VALUES(2008, 1, 1000); | |
| INSERT INTO sales VALUES(2009, 5, 2500); |
| class Player | |
| def play_turn(warrior) | |
| warrior.walk! | |
| end | |
| end |
| rails _3.2.15_ new rails_update --database=postgresql --skip-bundle | |
| rails _4.1.0_ new rails_update --database=postgresql --skip-bundle |