Skip to content

Instantly share code, notes, and snippets.

View dinatih's full-sized avatar

dinatih dinatih

View GitHub Profile
@dinatih
dinatih / rails.rb
Last active June 29, 2018 13:53
Add Rails.heroku_env (like Rails.env) to know in which heroku environment you are (Based on HEROKU_APP_NAME, that you can get from runtime-dyno-metadata labs plugin )
# config/initializers/rails.rb
# Based on Rails.env http://api.rubyonrails.org/classes/Rails.html#method-c-env
module Rails
# Use runtime-dyno-metadata labs plugin. See https://devcenter.heroku.com/articles/dyno-metadata
class << self
def heroku_env
if @_heroku_env
@_heroku_env
elsif ENV['HEROKU_APP_NAME']
# config/initializers/activestorage.rb
Rails.application.config.to_prepare do
# Provides the class-level DSL for declaring that an Active Record model has attached blobs.
ActiveStorage::Attached::Macros.module_eval do
def has_one_attached(name, dependent: :purge_later, acl: :private)
class_eval <<-CODE, __FILE__, __LINE__ + 1
def #{name}
@active_storage_attached_#{name} ||= ActiveStorage::Attached::One.new("#{name}", self, dependent: #{dependent == :purge_later ? ":purge_later" : "false"}, acl: "#{acl}")
end
@dinatih
dinatih / gist:2713804
Created May 16, 2012 20:45
C.V. David Herelle Ruby on Rails Web

David Herelle

A passionate Ruby on Rails Web Developer

Served as the first and only web developer on JobTeaser.com during 2 years. Helped rebuild and grow the site to be one of the most popular key account recruitment information web plateform in France.

26 years old Paris (or London) , France ( 75018 )

@dinatih
dinatih / app
Created May 2, 2012 14:16
Dinatih Rails App Template
run "rm public/index.html"
gem 'haml'
gem 'haml-rails'
gem 'coffee-filter'
gem 'coffee-rails', '~> 3.2.1'
gem 'bootstrap-sass', :git => "git://github.com/thomas-mcdonald/bootstrap-sass.git"
gem 'carrierwave'
gem 'therubyracer', :platform => :ruby