Skip to content

Instantly share code, notes, and snippets.

module Toolbox
module_function
def log(message, priority = :warn)
Logger.send(:priority, message)
end
def format_cc(number)
number.scan(/\d{4}/).join('-')
end
# /apps/Procfile
app1: cd app1 && foreman start
app2: cd app2 && foreman start
redis: redis-server
# /apps/app1/Procfile
web: rails s -p 3001
poller: ./script/server/poller start -a -q 'high medium low'
# /apps/app2/Procfile
stack: bamboo-mri-1.9.2
addons:
- newrelic:bronze
- logging:expanded
- pgbackups:basic
- releases:basic
class MigrationManifest
@@manifest = []
def self.table(name, options = {}, &block)
@@manifest << [:table, name, options, block]
end
def self.column(table, name, data_type, options = {})
@@manifest << [:column, table, name, data_type, options]
end
Options:
[--singleton] # Supply to create a singleton controller
-c, --resource-controller=NAME # Resource controller to be invoked
# Default: controller
-o, --orm=NAME # Orm to be invoked
# Default: active_record
-a, [--actions=ACTION ACTION] # Actions for the resource controller
[--force-plural] # Forces the use of a plural ModelName
# ...
Options:
[--helper] # Indicates when to generate helper
# Default: true
-t, [--test-framework=NAME] # Test framework to be invoked
# Default: test_unit
-e, [--template-engine=NAME] # Template engine to be invoked
# Default: erb
TestUnit options:
-r, [--fixture-replacement=NAME] # Fixture replacement to be invoked
[--fixture] # Indicates when to generate fixture
# Default: true
ActiveRecord options:
[--parent=PARENT] # The parent class for the generated model
-t, [--test-framework=NAME] # Test framework to be invoked
# Default: test_unit
[--migration] # Indicates when to generate migration
Installed Generators
Plugins (vendor/plugins): ...
Rubygems: ...
Builtin: controller, helper, integration_test, mailer, metal, migration, model, observer, performance_test, plugin, resource, scaffold, session_migration
Rails:
controller
generator
helper
integration_test
mailer
metal
migration
model
[rails2] > ./script/generate mailer Notifications
exists app/models/
create app/views/notifications
exists test/unit/
create test/fixtures/notifications
create app/models/notifications.rb
create test/unit/notifications_test.rb
create app/views/notifications/reset.erb
create test/fixtures/notifications/reset