-
Static:
User.includes(:posts => :comments)
-
Dynamic:
:posts => :comments
is a product of user's input
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 SocialPresenter | |
# ... | |
class Twitter < Struct.new(:object) | |
def message | |
case object | |
when String |
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 "mail" | |
Mail.defaults do | |
delivery_method :smtp, | |
address: "smtp.gmail.com", | |
port: 587, | |
user_name: ENV["GMAIL_EMAIL"], | |
password: ENV["GMAIL_PASSWORD"], | |
authentication: "plain", | |
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
############ | |
# GROUPING # | |
############ | |
def Given(*) end | |
Given(/There (is|are) some links?/) { } # ERROR | |
Given(/There (?:is|are) some links?/) { } |
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
# lib/carrierwave/orm/activerecord.rb from jnicklas/carrierwave | |
# before | |
class_eval <<-RUBY, __FILE__, __LINE__+1 | |
def #{column}=(new_file) | |
column = _mounter(:#{column}).serialization_column | |
send(:"\#{column}_will_change!") | |
super | |
end |
Hey Sean,
I just encountered your "The Bike Shed" podcast, concretely number #56 where you were talking about the "ActiveRecord is Reinventing Sequel" post I wrote. I'm sorry that this post struck you as negative, and that it made you feel like I was attacking you. I admit that I did feel some negative energy while I was writing it, but I still felt like I needed to say it.
Firstly, you said in the podcast that you would like to read an article which shows parts where Sequel is better than ActiveRecord. However, I did link my previous "Ode to Sequel" post in the first paragraph of my post, and soon after added two more. So I think it's a bit unfair that I was pr
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 Shrine | |
module Plugins | |
# The `concatenation` plugin allows you to assign to the attacher a | |
# cached file which is composed of multiple uploaded parts. The plugin | |
# will then call `#concat` on the storage, which is expected to | |
# concatenate the given parts into a single file. The assigned | |
# attachment will then be a complete cached file. | |
# | |
# plugin :concatenation | |
# |
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 ImageQuestion < TextQuestion | |
store :data, accessors: [:image] | |
mount_uploader :image, ImageUploader | |
validates :image, download: true, processing: true | |
end | |
class ImageUploader < CarrierWave::Uploader::Base | |
include CarrierWave::MiniMagick |