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
resources :students do | |
resources :reports, only: :index, controller: 'students/reports' | |
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
def foo(key: 'something') | |
bar(key: key) | |
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
require 'rubygems' | |
require 'active_merchant' | |
require 'pry' | |
ActiveMerchant::Billing::Base.mode = :test | |
gateway = ActiveMerchant::Billing::WebpayGateway.new(:login => 'xxx') # login cleared for security purpose | |
amount = 5000 |
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 JsonRender | |
extend ActiveSupport::Concern | |
included do | |
def json_render(object_or_collection) | |
end | |
def meta_hash | |
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
home/georgi/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/formatters/deprecation_formatter.rb:186:in `puts': The `:example_group` key in an example group's metadata hash is deprecated. Use the example group's hash directly for the computed keys and `:parent_example_group` to access the parent example group metadata instead. Called from /home/georgi/ruby/xxx/spec/models/emr_spec.rb:3:in `<top (required)>'. (RSpec::Core::DeprecationError) | |
from /home/georgi/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/formatters/deprecation_formatter.rb:125:in `print_deprecation_message' | |
from /home/georgi/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/formatters/deprecation_formatter.rb:36:in `deprecation' | |
from /home/georgi/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec/core/reporter.rb:137:in `block in notify' | |
from /home/georgi/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/rspec-core-3.0.1/lib/rspec |
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
ActionView::MissingTemplate - Missing template gaku/enrollments/index, gaku/gaku/index, gaku/core/index with {:locale=>[:en], :formats=>[:js, "application/ecmascript", "application/x-ecmascript", :html, :text, :js, :css, :ics, :csv, :png, :jpeg, :gif, :bmp, :tiff, :mpeg, :xml, :rss, :atom, :yaml, :multipart_form, :url_encoded_form, :json, :pdf, :zip], :handlers=>[:erb, :builder, :raw, :ruby, :coffee, :slim, :rb]}. Searched in: | |
* "/home/georgi/ruby/gaku/frontend/app/views/gaku/class_groups" | |
* "/home/georgi/ruby/gaku_dev_app/app/views" | |
* "/home/georgi/ruby/gaku_imex/app/views" | |
* "/home/georgi/ruby/gaku/admin/app/views" | |
* "/home/georgi/ruby/gaku/frontend/app/views" | |
* "/home/georgi/ruby/gaku/core/app/views" | |
* "/home/georgi/.rbenv/versions/2.1.1/lib/ruby/gems/2.1.0/gems/kaminari-0.15.1/app/views" |
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
i have following array | |
['a', 'b', 'c'] | |
How to convert it to hash like this bellow: | |
{'a' => { position: index of array element } } |
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
require 'stringio' | |
require 'timeout' | |
class Object | |
def methods_returning(expected, *args, &blk) | |
old_stdout = $> | |
$> = StringIO.new | |
methods.select do |meth| | |
Timeout::timeout(1) { dup.public_send(meth, *args, &blk) == expected rescue false } rescue 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
def locked_for?(action_user) | |
!time_expired? and user != action_user | |
end | |
def timeout? | |
time_expired? && !user.premium_account? | |
end | |
def time_until_expire | |
expiration_time if !time_expired? |
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
Depot::Application.routes.draw do | |
# match 'admin', :to => 'admin#index' | |
get 'admin' => 'admin#index' | |
controller :sessions do | |
get 'login' => :new | |
post 'login' => :create | |
delete 'logout' => :destroy | |
end |
NewerOlder