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
array = [1,2,4,3] | |
// => [1, 2, 4, 3] | |
array[6] | |
// => undefined | |
array[6] !== undefined | |
// => false | |
array[1] !== undefined | |
// => true | |
array[1] = false | |
// => false |
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
irb(main):007:0> RestaurantModel.create name: 'Foo Bar' | |
=> #<Restaurant @values={:id=>7, :merchant_id=>nil, :name=>"Foo Bar", :created_at=>2012-03-22 10:57:53 -0400, :updated_at=>2012-03-22 10:57:53 -0400, :neighborhood_id=>nil, :metro_id=>nil, :price_rating=>nil, :reservation_max_party_size=>8, :reservation_days_in_advance=>nil, :time_zone=>nil, :accepts_reservations=>true, :uses_table_management=>nil, :reservation_no_show_after_minutes=>15, :server_balance_mode=>2, :server_balance_importance=>5, :customer_vip_after_visits=>5, :sms_default_pager_message=>nil, :email_from_address=>nil, :email_from_name=>nil, :phone_number=>nil, :reservation_pre_close_minutes=>60, :agreed_to_mail=>nil, :restaurant_guid=>nil, :non_customized_trial=>nil, :useful_notes_rtf=>nil, :subdomain=>nil, :uses_manual_slotting=>true, :replyto_email=>nil, :replyto_sender_name=>nil, :activation_date=>nil, :table_manager=>nil, :monthly_fee=>nil, :transaction_fee=>nil, :monthly_fee_cap=>nil, :reservation_email_template=>nil, :reservation_from_ |
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
namespace :resque do | |
task :setup => :environment do | |
require 'resque' | |
ENV['QUEUE'] = '*' | |
Resque.after_fork do |job| | |
ActiveRecord::Base.establish_connection | |
end | |
end | |
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
scope :terms, lambda { |terms| | |
return if terms.blank? | |
composed_scope = joins(:user) | |
terms.split.each do |term| | |
term = '%' << term << '%' # Wrap the search term in % to achieve 'fuzzy' searching | |
composed_scope = composed_scope.where 'messages.body ILIKE :term', term: term | |
composed_scope = composed_scope.where 'users.first_name ILIKE :term or users.last_name ILIKE :term', term: term | |
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
User.invite!(:email => email) { |new_user| new_user.school_id = current_user.school_id } |
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 StripeCallbacksController < ApplicationController | |
def create | |
@user = User.find_by_stripe_customer_token(params[:customer]) | |
if ["recurring_payment_failed", "recurring_payment_succeeded", "subscription_final_payment_attempt_failed"].include? params[:event] | |
send(params[:event]) | |
end | |
respond_to do |format| | |
format.json { render :json => {}, :status => :ok } | |
end | |
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
Pending: | |
Asset | |
# No reason given | |
# ./spec/models/asset_spec.rb:22 | |
Failures: | |
1) TemplatesController show should find the template and display it | |
Failure/Error: get :show, @params | |
NoMethodError: |
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
var ApplicationNamespace = function() {}; | |
ApplicationNamespace.FurtherNamespace = (function() { | |
// private stuff | |
return { | |
publicFunction: somePrivateFunction, | |
init: function(args) { | |
}, |
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 AdminUserMethods | |
def self.included(base) | |
base.extend(ClassMethods) | |
end | |
# instance methods go here | |
module ClassMethods | |
# class methods go here | |
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
# in lib/admin_user_methods.rb | |
module AdminUserMethods | |
# your methods go here | |
end | |
# in app/models/user.rb | |
class User < AR | |
include AdminUserMethods | |
end |
NewerOlder