This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def revoke(user) | |
proxy_association.owner.tap do |project| | |
# You can't remove the last user with access (someone has to have access to the project!) | |
if project.users.many? | |
if user.pending? && user.projects.one? | |
user.destroy | |
else | |
project.users.delete(user) | |
user.touch | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bcx david$ rake stats | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Name | Lines | LOC | Classes | Methods | M/C | LOC/M | | |
+----------------------+-------+-------+---------+---------+-----+-------+ | |
| Controllers | 3704 | 2942 | 72 | 479 | 6 | 4 | | |
| Helpers | 1901 | 1529 | 13 | 261 | 20 | 3 | | |
| Models | 5310 | 4116 | 50 | 653 | 13 | 4 | | |
| Libraries | 2167 | 1593 | 51 | 200 | 3 | 5 | | |
| Integration tests | 297 | 217 | 6 | 1 | 0 | 215 | | |
| Functional tests | 3897 | 3065 | 61 | 11 | 0 | 276 | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# MODEL | |
class Case < ActiveRecord::Base | |
include Eventable | |
has_many :tasks | |
concerning :Assignment do | |
def assign_to(new_owner:, details:) | |
transaction do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# config/routes.rb | |
resources :documents do | |
scope module: 'documents' do | |
resources :versions do | |
post :restore, on: :member | |
end | |
resource :lock | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Customers::GridCountsController < ApplicationController | |
def index | |
render json: GridCountsQuery.run(params[:grid_counts]) | |
end | |
end | |
class GridCountsQuery | |
class << self | |
def run | |
query.each_with_object(Hash.new) do |row, grid| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module YourApp | |
class Application < Rails::Application | |
# Convenience for loading config/foo.yml for the current Rails env. | |
# | |
# Example: | |
# | |
# config/cleversafe.yml: | |
# | |
# production: | |
# url: http://127.0.0.1:8080 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class X.Example extends X.Object | |
@proxyMethod "attachmentManager.manageAttachment" | |
# Equivalent to: | |
# manageAttachment: -> | |
# @attachmentManager.manageAttachment.apply(@attachmentManager, arguments) | |
@proxyMethod "delegate?.compositionDidChangeDocument" | |
# Equivalent to: | |
# compositionDidChangeDocument: -> | |
# @delegate?.compositionDidChangeDocument?.apply(@delegate, arguments) |