Replace IRB with Pry (in your Gemfile) and Byebug with pry-byebug
.
gem 'pry-rails', group: [:development, :test]
gem 'pry-byebug', group: [:development, :test]
begin | |
require 'bundler/inline' | |
rescue LoadError => e | |
$stderr.puts 'Bundler version 1.10 or later is required. Please update your Bundler' | |
raise e | |
end | |
gemfile(true) do | |
source 'https://rubygems.org' | |
gem 'arel', github: 'rails/arel' |
# Auhtorize any record to any policy | |
def authorize_with(klass, record, query = nil) | |
query ||= "#{action_name}?".to_sym | |
@_pundit_policy_authorized = @_policy_authorized = true # two vars for forward compatibility | |
policy = klass.new(pundit_user, record) | |
unless policy.public_send(query) | |
error = Pundit::NotAuthorizedError.new("not allowed to #{query} this #{record}") | |
error.query = query | |
error.record = record | |
error.policy = policy |
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'rubocop', github: 'bbatsov/rubocop' | |
GEMFILE | |
system 'bundle' | |
end | |
require 'bundler' |
= nested_form_for answer, remote: true, ... do |f| | |
... | |
= f.fields_for :attachments do |attachment_form| | |
- if attachment_form.object.file.present? | |
p = attachment_form.object.file.identifier | |
- else | |
= attachment_form.label :file | |
= attachment_form.file_field :file | |
= attachment_form.link_to_remove "Remove this file" | |
= f.link_to_add "Add file", :attachments |
.pi@session_cont | |
.pi-select.pi data-on-changed="@host.date.text(@this.selected_record().dates)" | |
... | |
ul.list | |
li.item data-id="#{@id}" data-dates="#{@period}" | |
... | |
.pi.date@date |
# add the current directories /lib and /spec directories to the path if they exist | |
Pry.config.hooks.add_hook(:before_session, :load_path) do | |
dir = `pwd`.chomp | |
%w(lib spec test).map{ |d| "#{dir}/#{d}" }.each { |p| $: << p unless !File.exist?(p) || $:.include?(p) } | |
end |
# Suppose we updated our hash_data for Paperclip | |
OLD_HASH = ":class/:attachment/:id/:style" | |
NEW_HASH = ":class/:attachment/:id/:style/:updated_at" | |
ACL = :public_read | |
def restore(r) | |
return unless r.file.exists? | |
new_key = r.file.path[1..-1] | |
r.file.options[:hash_data] = OLD_HASH; |
# Activate the gem you are reporting the issue against. | |
unless File.exist?('Gemfile') | |
File.write('Gemfile', <<-GEMFILE) | |
source 'https://rubygems.org' | |
gem 'activerecord', '4.2.0' | |
gem 'pg', '0.18' | |
gem 'pry-byebug' | |
GEMFILE | |
system 'bundle' |
require 'benchmark' | |
_methods = ("a".."z").to_a | |
module A | |
module B | |
module C | |
module D | |
module E | |
class X |