This file contains hidden or 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
- translating_form_for resource, :url => user_recommendations_url(user) do |form| | |
= form.error_message_on :base | |
= form.radio :canine, [ true, false ] | |
= form.radio :therapeutic_diet, [ true, false ] | |
= form.collection_select :condition_id, conditions, :id, :name, :prompt => true | |
= form.collection_select :sub_condition_id, sub_conditions, :id, :name, :prompt => true | |
= form.collection_select :family_id, families, :id, :name, :prompt => true | |
= form.submit |
This file contains hidden or 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 SessionsController < Devise::SessionsController | |
layout 'login' | |
def devise_mapping | |
@devise_mapping ||= Devise.mappings[:user] | |
@devise_mapping.allowed_controllers << 'sessions' unless @devise_mapping.allowed_controllers.include?('sessions') | |
@devise_mapping.controllers[:sessions] = 'sessions' | |
@devise_mapping | |
end |
This file contains hidden or 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
BigleaguestudiosCom::Application.routes.draw do |map| | |
devise_for :users, :skip => [ :passwords, :sessions ] | |
get 'login' => 'sessions#new' | |
post 'login' => 'sessions#create' | |
get 'logout' => 'sessions#destroy' | |
map.new_user_session 'login', :controller => 'sessions', :action => 'new' |
This file contains hidden or 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
normalize_attribute :fax do |value| | |
value.is_a?(String) ? value.gsub(/[^0-9]+/, '') : value | |
end |
This file contains hidden or 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
AttributeNormalizer.configure do |config| | |
config.normalizers[:phone] = lambda do |value, options| | |
value.is_a?(String) ? value.gsub(/[^0-9]+/, '') : value | |
end | |
end |
This file contains hidden or 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 SchoolManagerHooks < Spree::ThemeSupport::HookListener | |
# Hook is getting called as expected in the user form. | |
# http://github.com/railsdog/spree/blob/0-11-stable/vendor/extensions/theme_default/app/views/shared/_user_form.html.erb | |
# But both give 'undefined local variable or method `f' | |
# Partial Rendering Hook. | |
insert_after :signup_below_password_fields, 'form_fields' | |
# Also tried a block rendering hook. |
This file contains hidden or 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
########################## Shell Prompt #################################### | |
LIGHT_BLUE="\[\033[1;34m\]" | |
RED="\[\033[0;31m\]" | |
YELLOW="\[\033[0;33m\]" | |
GREEN="\[\033[0;32m\]" | |
parse_git_branch (){ | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} |
This file contains hidden or 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
9d2385b7-0498-4a31-b9d0-b6b1a694:sv | |
a5660cb1-02bd-49c2-9dbe-9041b183:sv | |
f1481a06-7fe3-4c3b-a6bb-08b212d4:sv | |
bbbcbafc-8996-45a9-81a2-02121b1d:sv | |
ffab079e-5a9c-4b60-a0a8-46845e56:sv | |
8728cf49-1f3b-4763-a16c-7aa24d6d:sv | |
76121bc6-da43-433c-99c8-7e24a98f:sv | |
805070ea-d25a-46ac-acbc-01963967:sv | |
b8c5b4b1-5be3-48ae-9d99-6bece9c0:sv | |
37881621-46b5-42c5-a65d-a362073e:sv |
This file contains hidden or 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
desc "Apply Google translate to auto translate all texts in locale ENV['FROM'] to locale ENV['TO']" | |
task :google => :environment do | |
raise "Please specify FROM and TO locales as environment variables" if ENV['FROM'].blank? || ENV['TO'].blank? | |
# Depends on httparty gem | |
# http://www.robbyonrails.com/articles/2009/03/16/httparty-goes-foreign | |
class GoogleApi | |
include HTTParty | |
base_uri 'ajax.googleapis.com' | |
def self.translate(string, to, from) |
This file contains hidden or 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 Delayed::Worker | |
alias_method :original_handle_failed_job, :handle_failed_job | |
protected | |
def handle_failed_job(job, error) | |
HoptoadNotifier.notify(error) | |
original_handle_failed_job(job,error) | |
end | |
end |