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 Plugin1 | |
def some_method | |
puts "ha!" | |
end | |
end | |
module Plugin2 | |
def some_method_again | |
puts "hrn..." | |
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
select student_id | |
from ( | |
select gs.student_id, g.id as group_id | |
from groups_students gs | |
inner join groups g on g.id = gs.group_id | |
inner join group_types gt on gt.id = g.group_type_id | |
where gt.permission_group = 1 | |
) s | |
left outer join ( | |
select g.id as group_id |
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
-- SELECT distinct `students`.`id` -- takes ~8ms | |
SELECT count(distinct `students`.`id`) -- takes 6.4seconds! | |
FROM `students` | |
INNER JOIN `categories_students` ON `categories_students`.`student_id` = `students`.`id` | |
INNER JOIN `categories` ON `categories`.`id` = `categories_students`.`category_id` | |
LEFT OUTER JOIN `groups_students` ON `groups_students`.`student_id` = `students`.`id` | |
LEFT OUTER JOIN `groups` ON `groups`.`id` = `groups_students`.`group_id` AND `groups`.`group_type_id` = 1 | |
left outer join ( | |
select student_id | |
from ( |
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 home | |
render 'signed_out_home' and return unless signed_in? | |
current_user.active_subscription? ? load_signed_in_page : redirect_to plans_path | |
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
def show | |
@purchase = Purchase.find(params[:id]) | |
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 AgenciesController | |
def new | |
@client = Client.find(params[:client_id]) | |
@agency = @client.agencies.new | |
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
def update_inventory | |
if self.item_id_changed? | |
old_item = Item.find(self.item_id_was) | |
old_item.quantityInStock -= self.quantity_was | |
old_item.save! | |
elsif self.quantity_changed? | |
quantity_diff = self.quantity - self.quantity_was | |
self.item.quantityInStock += quantity_diff | |
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
require "bundler/capistrano" | |
load 'deploy/assets' | |
require "rvm/capistrano" | |
# SCM Settings | |
set :use_sudo, false | |
# Server addresses | |
role :web, "manage.theapp.net" # Your HTTP server, Apache/etc | |
role :app, "manage.theapp.net" # This may be the same as your `Web` server |
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
mbp4:manage mike.campbell$ cap shell | |
triggering load callbacks | |
* executing `shell' | |
==================================================================== | |
Welco§ to the interactive Capistrano shell! This is an experimental | |
feature, and is liable to change in future releases. Type 'help' for | |
a summary of how to use the shell. | |
-------------------------------------------------------------------- | |
cap> whoami | |
[establishing connection(s) to manage.theapp.net] |
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
@log_rows = WillPaginate::Collection.create(log_data.parsed_response["current_page"]["_dc_obj"], log_data.parsed_response["per_page"], log_data.parsed_response["total_entries"]) do |pager| | |
pager.replace(@log_rows) | |
end |
OlderNewer