Skip to content

Instantly share code, notes, and snippets.

View foliea's full-sized avatar

Adrien Folie foliea

  • Paris, France
View GitHub Profile
class OmniauthProviderDecorator
@@decorations =
{
linkedin: { icon: 'linkedin-square', class: 'primary' },
twitter: { icon: 'twitter-square', class: 'info' },
github: { icon: 'github', class: 'default' },
google_oauth2: { icon: 'google-plus-square', class: 'danger' }
}
def initialize(provider)
@foliea
foliea / page.rb
Last active August 29, 2015 13:59
class Page < ActiveRecord::Base
before_save :parameterize_name
validates :name, uniqueness: { scope: :locale }
validates :name, :locale, presence: true
scope :by_name, lambda { |name| where(name: name) }
def self.get_by_name! name
page ||= self.find_by(name: name, locale: I18n.locale)