TL;DR
Create a backup:
pg_dumpall > mybackup.sql
Perform the upgrade:
sudo pg_dropcluster 9.4 main --stop
# A custom initializer that enables sorting via custom scopes in Ransack (like the same feature in MetaSearch) | |
module Ransack | |
module Adapters | |
module ActiveRecord | |
class Context < ::Ransack::Context | |
# Allows for sorting by custom scopes | |
# | |
# |
Notes on how to use AWS SNS: | |
1. Subscribe an HTTP endpoint (i.e. http://myhost/sns_endpoint) on AWS Console | |
2. AWS will send subscription confirmation right away | |
3. SNS_controller responds to subscription confirmation by sending confirmation using Fog. | |
4. Once AWS is happy, you can start sending notifications to your end point via SNS. |
TL;DR
Create a backup:
pg_dumpall > mybackup.sql
Perform the upgrade:
sudo pg_dropcluster 9.4 main --stop
# Sidekiq interaction and startup script | |
commands: | |
create_post_dir: | |
command: "mkdir -p /opt/elasticbeanstalk/hooks/appdeploy/post" | |
ignoreErrors: true | |
files: | |
"/opt/elasticbeanstalk/hooks/appdeploy/post/50_restart_sidekiq.sh": | |
mode: "000755" | |
owner: root | |
group: root |
#SOLID Principles with ruby examples
##SRP - Single responsibility principle A class should have only a single responsibility.
Every class should have a single responsibility, and that responsibility should be entirely encapsulated. All its services should be narrowly aligned with that responsibility, this embrace the high cohesion.
##OCP - Open/closed principle Software entities should be open for extension, but closed for modification.
=Navigating= | |
visit('/projects') | |
visit(post_comments_path(post)) | |
=Clicking links and buttons= | |
click_link('id-of-link') | |
click_link('Link Text') | |
click_button('Save') | |
click('Link Text') # Click either a link or a button | |
click('Button Value') |
require "active_record" | |
namespace :db do | |
db_config = YAML::load(File.open('config/database.yml')) | |
db_config_admin = db_config.merge({'database' => 'postgres', 'schema_search_path' => 'public'}) | |
desc "Create the database" | |
task :create do | |
ActiveRecord::Base.establish_connection(db_config_admin) |
#Model | |
@user.should have(1).error_on(:username) # Checks whether there is an error in username | |
@user.errors[:username].should include("can't be blank") # check for the error message | |
#Rendering | |
response.should render_template(:index) | |
#Redirecting | |
response.should redirect_to(movies_path) |