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
#View | |
<label for="searchtext">Search for a specific fighter:</label> | |
<%= text_field_with_auto_complete :fighter, :contains, { :size => 15 }, :skip_style => true -%> | |
<p>Search Results:</p> | |
<div id="fighter_name_results"></div> | |
#Controller | |
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 ResourceController < ActionController::Base | |
def logger | |
@@logger ||= Logger.new("#{RAILS_ROOT}/log/my.log") | |
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
select au.auditstoryid, au.storyModifydate, a.authorFirstName, a.authorLastName, au.savemethod | |
from auditstory au | |
inner join authors a on au.modBy = a.authorId | |
where storyId = 1054 and storyModifyDate > SUBDATE(curdate(), 1) |
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 User | |
def self.highschooler | |
age_between(14, 18).in_school | |
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
map.resources :entries, :except => :new do |entry| | |
entry.resources :comments | |
entry.resources :votes | |
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
validate do |model_name| | |
model_name.errors.add_to_base("Type must not be blank") if model_name.template.blank? | |
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
if ENV['RAILS_ENV'] && !Object.const_defined?('RAILS_DEFAULT_LOGGER') | |
require 'logger' | |
RAILS_DEFAULT_LOGGER = Logger.new(STDOUT) | |
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
Bluepill.application("app_name") do |app| | |
app.process("app_name") do |process| | |
process.start_command = "cd /u/apps/app_name/current && /usr/local/bin/unicorn_rails -c /u/apps/app_name/current/config/unicorn.conf.rb -E production -D" | |
process.stop_command = "kill -QUIT `cat /u/apps/app_name/current/tmp/pids/unicorn.pid`" | |
process.restart = "kill -USR2 `cat /u/apps/app_name/current/tmp/pids/unicorn.pid`" | |
process.stdout = process.stderr = "/u/apps/app_name/current/log/unicorn.log" | |
process.pid_file = "/u/apps/app_name/current/tmp/pids/unicorn.pid" | |
process.checks :mem_usage, :every => 10.seconds, :below => 250.megabytes, :times => [3, 5] | |
process.uid = "app" | |
process.gid = "app" |
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 Project < ActiveRecord::Base | |
def name | |
read_attribute(:name) or 'none' | |
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 Project < ActiveRecord::Base | |
alias :old_read_attribute :read_attribute | |
def read_attribute(attr) | |
old_read_attribute(attr) or 'none' | |
end | |
end |
OlderNewer