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
module HectorFetch | |
module InstanceMethods | |
def service_with_fetch | |
res = service_without_fetch | |
current_user.update_from_hector | |
res | |
end | |
def single_sign_out | |
session_ticket = CasTicket.where('_id' => Nokogiri::XML(URI.decode params['logoutRequest']).search("SessionIndex").first.children.first.to_s).first |
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
module CallLog::Replay | |
# Class methods for CallLog | |
module ClassMethods | |
def replay_for(object, timestamp=Time.now.utc, kind='all') | |
case object.class | |
when Account | |
self.replay_account_from(object, timestamp, kind) | |
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
accounts = Account.where(:ss7 => true).map { |a| [a.customer, a.code] } | |
report = [] | |
accounts.each do |account| | |
account_report = [] | |
account_count = [] | |
Journal.where('account' => account[1], 'date' => /2011-07/).each do |journal| | |
account_report << journal.billing_entries.sum(:duration) | |
account_count << journal.billing_entries.where(:duration.gt => 0.0).count | |
end | |
report << [account[0], account[1], account_report.compact.sum, account_count.sum] |
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
describe 'for prepaid account' do | |
before(:each) do | |
history = { | |
'_3_days_ago' => {'debit' => 0.0, 'credit' => 0.0, 'balance' => 100.0}, | |
'_2_days_ago' => {'debit' => 0.5, 'credit' => 10.0, 'balance' => 109.5}, | |
'_1_days_ago' => {'debit' => 2.0, 'credit' => 0.0, 'balance' => 107.5}, | |
'_0_days_ago' => {'debit' => 0.0, 'credit' => 2.5, 'balance' => 110.0} | |
} | |
@in_account = Fabricate(:in_account, :current_amount => 100.0) |
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
module Openerp | |
def self.define_setter(attr) | |
class_eval("def self.#{attr}=(val) \n @@#{attr} = val \n end \n", __FILE__, __LINE__+1) | |
end | |
def self.define_getter(attr) | |
class_eval("def self.#{attr} \n @@#{attr} \n end \n", __FILE__, __LINE__+1) | |
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
cedric@Arch7 ~/Dev/Siclic/barakafrites (git)-[rails_4] % rails s | |
=> Booting WEBrick | |
=> Rails 4.0.0 application starting in development on http://0.0.0.0:3000 | |
=> Run `rails server -h` for more startup options | |
=> Ctrl-C to shutdown server | |
[2013-07-04 15:46:03] INFO WEBrick 1.3.1 | |
[2013-07-04 15:46:03] INFO ruby 2.0.0 (2013-06-27) [x86_64-linux] | |
[2013-07-04 15:46:03] INFO WEBrick::HTTPServer#start: pid=7937 port=3000 | |
DEPRECATION WARNING: You didn't set config.secret_key_base. Read the upgrade documentation to learn more about this new config option. (called from service at /home/cedric/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/2.0.0/webrick/httpserver.rb:138) |
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
[1] pry(#<Api::Openstc::DepartmentsController>)> request.session_options | |
=> {:path=>"/", | |
:domain=>nil, | |
:expire_after=>nil, | |
:secure=>false, | |
:httponly=>true, | |
:defer=>false, | |
:renew=>false, | |
:secret=>"b0509b8047175645ff907981d6772eaafec5306cedd24915236d39af143f", | |
:coder=>#<Rack::Session::Cookie::Base64::Marshal:0x0000000556b260>, |
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
1 cedric@Arch7 ~/Dev/humanIT/session_off (git)-[master] % bundle update :( | |
Fetching gem metadata from https://rubygems.org/......... | |
Fetching gem metadata from https://rubygems.org/.. | |
Resolving dependencies... | |
Using rake (10.1.0) | |
Using i18n (0.6.4) | |
Using minitest (4.7.5) | |
Using multi_json (1.7.7) | |
Using atomic (1.1.10) | |
Using thread_safe (0.1.0) |
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
module ApiController | |
def index | |
# ... | |
# How | |
if request.head? | |
@count = self.class.resource_model.count(user_context, format_filters(@filters)).content | |
head :ok, "Content-Range" => "#{self.class.resource_model.name} #{@offset}-#{@limit}/#{@count}" | |
else |
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 CreateRoles < ActiveRecord::Migration | |
def change | |
create_table :roles do |t| | |
t.string :activities, array: true, length: 30, using: 'gin', default: '{}' | |
t.timestamps | |
end | |
end | |
end | |
## |