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
# student.rb | |
class Student | |
def age | |
unless read_attribute(:birthdate) == nil | |
dob = read_attribute(:birthdate) | |
now = Time.now.utc.to_date | |
now.year - dob.year - ((now.month > dob.month || (now.month == dob.month && now.day >= dob.day)) ? 0 : 1) | |
else | |
0 | |
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
<?xml version="1.0" encoding="utf-8"?> | |
<container xmlns="http://symfony.com/schema/dic/services" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symfony.com/schema/dic/services http://symfony.com/schema/dic/services/services-1.0.xsd"> | |
<parameters> | |
<parameter key="kernel.root_dir">C:\Users\auke\Sites\Greenblue 2\app</parameter> | |
<parameter key="kernel.environment">dev</parameter> | |
<parameter key="kernel.debug">true</parameter> | |
<parameter key="kernel.name">app</parameter> | |
<parameter key="kernel.cache_dir">C:\Users\auke\Sites\Greenblue 2\app/cache/dev</parameter> | |
<parameter key="kernel.logs_dir">C:\Users\auke\Sites\Greenblue 2\app/logs</parameter> | |
<parameter key="kernel.bundles" type="collection"> |
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
db = ActiveRecord::Base.connection.adapter_name | |
Rails.logger.debug db | |
case db | |
when "PostgreSQL" | |
result = self.joins("JOIN profiles on profiles.id = passions.profile_id").joins("JOIN taggings ON (passions.id = taggings.taggable_id AND taggings.taggable_type = 'Passion') JOIN tags ON (tags.id = taggings.tag_id) AND taggings.tagger_id IS NULL AND taggings.context = 'tags'").where(["passions.name ILIKE ? OR profiles.name ILIKE ? OR tags.name ILIKE ?", "%#{q[:search][:query]}%", "%#{q[:search][:query]}%", "%#{q[:search][:query]}%"]).all | |
else | |
result = self.joins("JOIN profiles on profiles.id = passions.profile_id").joins("JOIN taggings ON (passions.id = taggings.taggable_id AND taggings.taggable_type = 'Passion') JOIN tags ON (tags.id = taggings.tag_id) AND taggings.tagger_id IS NULL AND taggings.context = 'tags'").where(["passions.name LIKE ? OR profiles.name LIKE ? OR tags.name LIKE ?", "%#{q[:search][:query]}%", "%#{q[:search][:query]} |
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
[parameters] | |
database_driver="pdo_sqlite" | |
database_host="localhost" | |
database_port="" | |
database_name="development.db" | |
database_user="root" | |
database_password="" | |
mailer_transport="smtp" | |
mailer_host="localhost" | |
mailer_user="" |