Code Monkey home page Code Monkey logo

pry-rails's Introduction

This project is not actively maintained and looking for a maintainer!

Description

Avoid repeating yourself, use pry-rails instead of copying the initializer to every rails project. This is a small gem which causes rails console to open pry. It therefore depends on pry.

Prerequisites

  • A Rails >= 3.0 Application
  • Ruby >= 1.9

Installation

Add this line to your gemfile:

gem 'pry-rails', :group => :development

bundle install and enjoy pry.

Usage

$ rails console
[1] pry(main)> show-routes
     pokemon POST   /pokemon(.:format)      pokemons#create
 new_pokemon GET    /pokemon/new(.:format)  pokemons#new
edit_pokemon GET    /pokemon/edit(.:format) pokemons#edit
             GET    /pokemon(.:format)      pokemons#show
             PUT    /pokemon(.:format)      pokemons#update
             DELETE /pokemon(.:format)      pokemons#destroy
        beer POST   /beer(.:format)         beers#create
    new_beer GET    /beer/new(.:format)     beers#new
   edit_beer GET    /beer/edit(.:format)    beers#edit
             GET    /beer(.:format)         beers#show
             PUT    /beer(.:format)         beers#update
             DELETE /beer(.:format)         beers#destroy
[2] pry(main)> show-routes --grep beer
        beer POST   /beer(.:format)         beers#create
    new_beer GET    /beer/new(.:format)     beers#new
   edit_beer GET    /beer/edit(.:format)    beers#edit
             GET    /beer(.:format)         beers#show
             PUT    /beer(.:format)         beers#update
             DELETE /beer(.:format)         beers#destroy
[3] pry(main)> show-routes --grep new
 new_pokemon GET    /pokemon/new(.:format)  pokemons#new
    new_beer GET    /beer/new(.:format)     beers#new
[4] pry(main)> show-models
Beer
  id: integer
  name: string
  type: string
  rating: integer
  ibu: integer
  abv: integer
  created_at: datetime
  updated_at: datetime
  belongs_to hacker
Hacker
  id: integer
  social_ability: integer
  created_at: datetime
  updated_at: datetime
  has_many pokemons
  has_many beers
Pokemon
  id: integer
  name: string
  caught: binary
  species: string
  abilities: string
  created_at: datetime
  updated_at: datetime
  belongs_to hacker
  has_many beers through hacker

Custom Rails prompt

If you want to permanently include the current Rails environment and project name in the Pry prompt, put the following lines in your project's .pryrc:

Pry.config.prompt = Pry::Prompt[:rails]

If .pryrc could be loaded without pry-rails being available or installed, guard against setting Pry.config.prompt to nil:

if Pry::Prompt[:rails]
  Pry.config.prompt = Pry::Prompt[:rails]
end

Check out change-prompt --help for information about temporarily changing the prompt for the current Pry session.

Disabling pry-rails

If pry-rails is included in your application but you would prefer not to use it, you may run the following command to set the appropriate environment variable to disable initialization and fall back to the default IRB console:

DISABLE_PRY_RAILS=1 rails console

Note that you may need to run spring stop first.

Developing and Testing

This repo uses Roadshow to generate a Docker Compose file for each supported version of Rails (with a compatible version of Ruby for each one).

To run specs across all versions, you can either get the Roadshow tool and run roadshow run, or use Docker Compose directly:

$ for fn in scenarios/*.docker-compose.yml; do docker-compose -f $fn run --rm scenario; done

You can also manually run the Rails console and server on each version with roadshow run rake console and roadshow run rake server, or run them on a specific version with, e.g., roadshow run -s rails40 rake console.

To update the set of scenarios, edit scenarios.yml and run roadshow generate, although the Gemfiles in the scenarios directory need to be maintained manually.

Alternative

If you want to enable pry everywhere, make sure to check out pry everywhere.

pry-rails's People

Contributors

2called-chaos avatar amatsuda avatar banister avatar chtjonas avatar cjlarose avatar crackedmind avatar crazymykl avatar djpowers avatar duggiefresh avatar edgibbs avatar gabetax avatar greysteil avatar hbd225 avatar kyrylo avatar matthiaswinkelmann avatar melopilosyan avatar mkempe avatar mobilutz avatar mykecameron avatar petergoldstein avatar phansch avatar ream88 avatar rf- avatar rking avatar rweng avatar sarenji avatar scottwater avatar siong1987 avatar toqoz avatar treylawrence avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pry-rails's Issues

pry-rails doesn't pretty print devise models

After using these two gems together successfully for the last year, suddenly the console won't pretty print either of my devise models. All other models print in the console as expected, but User and Admin print in the traditional rails/irb fashion.

Curiously this manifests in a dev branch but not in my master branch, so I suppose that gives me hope for tracking down the problem. Gemfiles are identical - both contain pry-rails 0.3.4 and pry 0.10.4. Precisely nothing was changed in user.rb or admin.rb prior to this problem appearing.

Any tips for debugging?

Pry-doc dependency

On Ruby 1.9.3, pry-doc causes segfaults in yard. Having pry-rails depend on pry-doc is not so convenient on 1.9.3 for this reason. Perhaps the dependency should be removed?

Class object differs after executing `reload!`

My Environment:

  • Rails 3.2.12
  • pry 0.9.12.2
  • pry-rails 0.3.2

Given some class in app/models/some_class.rb :

class SomeClass
end

Then in the console,

$ bundle exec rails c
> a = SomeClass.new
=> #<SomeClass:0x000000043e2200>
> a.is_a? SomeClass
=> true
> reload!
Reloading...
=> true
> a.is_a? SomeClass
=> false

The result of a.is_a? SomeClass differs after reloading!
It seems that the a.class and SomeClass object after reloading are NOT identical.

> a.class.object_id
=> 37056620
> SomeClass.object_id
=> 37282940

I'd like you to fix this.

undefined method `source_index' for Gem:Module

$  rbenv which ruby
/users/dlweber/.rbenv/versions/2.4.1/bin/ruby
$  rbenv which gem
/users/dlweber/.rbenv/versions/2.4.1/bin/gem
$  gem --version
2.6.11
$  rbenv which bundle
/users/dlweber/.rbenv/versions/2.4.1/bin/bundle
$  bundle --version
Bundler version 1.14.6

$  rbenv which rails
/data/src/dlss/hydra/hyrax/.internal_test_app/.bundle/bin/rails
$  rails --version
Rails 5.0.3

$  bundle exec rails c
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'pry-rails'. (Bundler::GemRequireError)
Gem Load Error is: undefined method `source_index' for Gem:Module
Backtrace for gem load error is:
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.8.3/lib/pry/command_base_helpers.rb:9:in `gem_installed?'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.8.3/lib/pry/command_base_helpers.rb:15:in `block in command_dependencies_met?'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.8.3/lib/pry/command_base_helpers.rb:14:in `each'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.8.3/lib/pry/command_base_helpers.rb:14:in `all?'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.8.3/lib/pry/command_base_helpers.rb:14:in `command_dependencies_met?'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.8.3/lib/pry/command_base.rb:53:in `command'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.8.3/lib/pry/commands.rb:195:in `<class:Commands>'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.8.3/lib/pry/commands.rb:12:in `<class:Pry>'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.8.3/lib/pry/commands.rb:9:in `<top (required)>'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `require'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `block in require'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:259:in `load_dependency'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `require'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-0.8.3/lib/pry.rb:23:in `<top (required)>'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `require'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `block in require'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:259:in `load_dependency'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/activesupport-5.0.3/lib/active_support/dependencies.rb:293:in `require'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/pry-rails-0.2.0/lib/pry-rails.rb:3:in `<top (required)>'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `require'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:91:in `block (2 levels) in require'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `each'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:86:in `block in require'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `each'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler/runtime.rb:75:in `require'
/users/dlweber/.rbenv/versions/2.4.1/lib/ruby/gems/2.4.0/gems/bundler-1.14.6/lib/bundler.rb:107:in `require'

getting unexpected shell command behaviour after installing pry-rails.

I installed pry-rails gem (0.3.4) in rails 4.1.0 and ruby 2.1.3 app. when i switch to rails console the pry works fine in rails console but when i exit rails console with pry, then the console commands behave like below:-

  1. when hit 'cd' it enters pry console.
  2. when hit 'cd ..' no-command found error.
  3. when hit 'clear' lists the directory in current folder.
    I don't know why this sort of behaviour. Is this issue with gem or some kind of malware in my Ubuntu pc.
    This behaviour is only seen in rails app directory(in which pry-rails is installed), if i move to other directory with command cd ../another-dir (which works) the terminal command works.

History File Error

I am using pry-rails with Ruby on Rails, and whenever I enter the pry console through rails c or binding.pry I get the error "History file not loaded: invalid byte sequence in UTF-8" and no key strokes history is given me.

Ex. If I type Company.new, hit enter, and hit the up arrow I expect Company.new to be re-entered according to the history. But nothing happens and the above error on startup of the console is all I get.

System configuration

Rails version: 4.2.1

Ruby version: 2.2.3

Pry-Rails version: 0.3.4

Console hooks are broken

Hi,

I'm trying to add default methods to the console like this:

# config/application.rb
# Source http://opensoul.org/2012/11/08/add-helper-methods-to-your-rails-console/
console do
  require 'console_foo'
  Rails::ConsoleMethods.include(ConsoleFoo)
end

Rails includes Rails::ConsoleMethods into the console::ExtendCommandBundle module, in this case that'd be Pry::ExtendCommandBundle which is an empty module so nothing is happening.

I could get this working by doing TOPLEVEL_BINDING.eval('self').extend ConsoleFoo but that seems a lot like a hack, is there a way we could have ExtendCommandBundle work?

The console block gets called before console.start (Pry.start) so maybe there's something to be done there?

Thanks

dependency conflict (slop) with pry-remote

Bundler could not find compatible versions for gem "slop":
  In Gemfile:
    pry-remote (~> 0.1.6) ruby depends on
      slop (~> 3.0) ruby

    pry-rails (~> 0.1.6) ruby depends on
      slop (2.4.4)

Thanks!

Add an option to the `rails c` command, to launch the console without pry

When using the pry-rails gem, the rails console is always launch with pry.

I think it would be great to have an option to the rails c command, or an command with an other name, that launch the default rails console (ie: without pry).

It is useful sometimes, because pry is sometimes not the best option in the console. For example, when you work with long arrays/hashes. It also hide the ruby backtrace.

What do you think of this ?

Using Pry inside a Rails engine.

It looks like pry-rails does not work within a Rails engine. The following commands were run in a "gemified" Rails 3.2.6 engine, with RSpec 2.11.0, and where the spec/dummy directory contains the dummy application to run tests against:

$ grep ^gemspec Gemfile
gemspec

$ grep pry ${engine_name}.gemspec 
  s.add_development_dependency 'pry-rails', '~> 0.1.6'

$ (cd spec/dummy; rails console)
Loading development environment (Rails 3.2.6)
irb(main):001:0>

link directly to pry in the readme

Nice little plugin - thanks! I tweeted a link and thought it would be nice to have a link to pry in the README. I'm not sure where it would go; perhaps the README should have a short description of what the plugin does at the top, that could naturally mention and link to pry.

rails console throws "uninitialized constant Pry::Prompt (NameError)"

Hi,
I'm getting this error when launching the Rails console in a Rails 4.2.6 project that's using:
pry 0.9.12.6
pry-byebug 1.3.2
pry-rails 0.3.5
pry-rescue 1.4.5

Bundle complete! 78 Gemfile dependencies, 162 gems now installed.
Use bundle show [gemname] to see where a bundled gem is installed.

~/Sites/crs  (rails_4_2 *) % bundle exec rails c
/me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/pry-rails-0.3.5/lib/pry-rails/prompt.rb:36:in <module:PryRails>: uninitialized constant Pry::Prompt (NameError)
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/pry-rails-0.3.5/lib/pry-rails/prompt.rb:1:in <top (required)>
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/pry-rails-0.3.5/lib/pry-rails.rb:10:in <top (required)>
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:76:in require
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:76:in block (2 levels) in require
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:72:in each
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:72:in block in require
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:61:in each
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/bundler-1.10.3/lib/bundler/runtime.rb:61:in require
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/bundler-1.10.3/lib/bundler.rb:134:in require
  from /me/Sites/crs/config/application.rb:21:in <top (required)>
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:141:in require
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:141:in require_application_and_environment!
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:67:in console
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in run_command!
  from /me/.rbenv/versions/2.1.4/lib/ruby/gems/2.1.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in <top (required)>
  from bin/rails:4:in require
  from bin/rails:4:in <main>

If I remove pry-rails, I have no trouble launching the console:

Bundle complete! 77 Gemfile dependencies, 161 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
~/Sites/crs  (rails_4_2 *) % bundle exec rails c
Loading development environment (Rails 4.2.6)
[1] pry(main)> 

Any ideas?

Gemfile:

gem 'pry'
gem 'pry-byebug'
gem 'pry-rails'

undefined method `create_command' in pry-rails 0.2.0

Hello!

pry-rails 0.1.6 works like a charm, but 0.2.0 won't load the console:

[master][~/dev/journalclub/engine] ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-darwin11.3.0]

[master][~/dev/journalclub/engine] bundle show rails
/Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/rails-3.2.7

[master][~/dev/journalclub/engine] bundle show pry  
/Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.7.4

[master][~/dev/journalclub/engine] bundle show pry-rails
/Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/pry-rails-0.2.0
# Gemfile
source 'https://rubygems.org'

gem 'rails', '3.2.7'
gem 'pg'
gem 'nokogiri', '~> 1.5.5'
gem 'curb', '~> 0.8.1'
gem 'feedzirra', '0.2.0.rc2'
# gem 'debugger'

group 'development' do
  gem 'pry'
  gem 'pry-rails'
end

group 'test' do
  gem 'vcr', '~> 2.2.4'
  gem 'webmock', '~> 1.8.8'
  gem 'm', '~> 1.1'
  gem 'factory_girl_rails'
end
[master][~/dev/journalclub/engine] rails c
/Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/pry-rails-0.2.0/lib/pry-rails/commands.rb:3:in `block in <module:PryRails>': undefined method `create_command' for #<Pry::CommandSet:0x007fc9cbfc2230> (NoMethodError)
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.7.4/lib/pry/command_set.rb:62:in `instance_eval'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/pry-0.9.7.4/lib/pry/command_set.rb:62:in `initialize'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/pry-rails-0.2.0/lib/pry-rails/commands.rb:2:in `new'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/pry-rails-0.2.0/lib/pry-rails/commands.rb:2:in `<module:PryRails>'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/pry-rails-0.2.0/lib/pry-rails/commands.rb:1:in `<top (required)>'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/pry-rails-0.2.0/lib/pry-rails.rb:8:in `require'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/pry-rails-0.2.0/lib/pry-rails.rb:8:in `<top (required)>'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `require'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `each'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `each'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:55:in `require'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler.rb:119:in `require'
    from /Users/jason/dev/journalclub/engine/config/application.rb:13:in `<top (required)>'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.7/lib/rails/commands.rb:39:in `require'
    from /Users/jason/.rvm/gems/ruby-1.9.3-p194/gems/railties-3.2.7/lib/rails/commands.rb:39:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

plugin should do checks for rails environment

Hi,

thanks for the Pry plugin. However as you will see from that plugin guide plugins are automatically loaded by pry when pry is started. So i'm just concerned that outside of rails contexts your plugin might generate errors as some of the classes/methods you rely on will not exist.

Could you adjust your plugin to only do it's thing if rails is loaded? maybe with const_defined? or so on :P

thanks!

uninitialized constant Pry::ExtendCommandBundle (NameError)

When starting the console of a freshly created rails 3.2.0.rc1 app, what I've got is a NameError

/Users/delba/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.0.rc1/lib/rails/commands/console.rb:46:in `start': uninitialized constant Pry::ExtendCommandBundle (NameError)
    from /Users/delba/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.0.rc1/lib/rails/commands/console.rb:8:in `start'
    from /Users/delba/.rbenv/versions/1.9.3-p0/lib/ruby/gems/1.9.1/gems/railties-3.2.0.rc1/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Rails 4 and pry-rails

Hi guys,

I've got a problem with the combination of Rails, Ruby, Pry and Pry-Rails where when starting the console with rails console there still is only the irb prompt instead of the pry prompt.
All the tests with pry-rails did run without an error.

Ruby 2.0.0p247
Rails 4.0.0
Pry 0.9.12.2
Pry-Rails 0.3.1

Is there anybody who has the same problem?

Cheers,

Govinda

no ability to show the sql that is being executed for a process

I am adding a known dead scope to my queries in order to see what sql is being executed.

Mostly due to the fact that I am getting back something that I did not expected and wanted to verify the sql / scope

[8] pry(main)> Schedule.active.with_room.for_course(71).sql
Schedule Load (1.1ms) SELECT schedules.* FROM schedules WHERE schedules.state = 'live' AND schedules.course_id = 71 AND (room_id IS NOT NULL)
NoMethodError: undefined method sql' for #<#<Class:0x00000006751ba0>:0x00000006f41ba8> from /home/thief/.rvm/gems/ruby-1.9.2-p318@relaunch/gems/activerecord-3.2.6/lib/active_record/relation/delegation.rb:45:inmethod_missing'
[9] pry(main)>

Possibly something like this?

http://hi.baidu.com/rainchen/item/fa5c0414acdcd7721109b533

does not work with osx10.10/macports ruby2.1

I have installed:

  • osx10.10 (yosemite)
  • macports ruby2.1
  • rails 4.1.6

when I gem install pry-rails
Successfully installed pry-rails-0.3.2

pry startup takes very long

require 'pry-rails' # Failed, saying: Permission denied @ rb_sysopen - /opt/local/lib/ruby2.1/gems/2.1.0/extensions/x86_64-darwin-14/2.1.0/debugger-1.6.5/gem_make.out

gem install debugger

(hangs)

OK, may debugger is the culprit
But you should not try to install gems under the hood.
Better just fail on missing dependencies.

Collision with rails_admin

When adding rails_admin on top of a project which has pry-rails , I get an error trying to access the localhost:3000/admin where RailsAdmin is mounted:

TypeError in RailsAdmin::MainController#dashboard

wrong argument type ApplicationController (expected Proc)
Rails.root: /Users/alon/git/blog-app

Application Trace | Framework Trace | Full Trace
(eval):8:in `dashboard'
/Users/alon/.rvm/gems/ruby-1.9.3-p0/bundler/gems/rails_admin-6a888ed3a5ba/app/controllers/rails_admin/application_controller.rb:71:in `block in '
activesupport (3.2.1) lib/active_support/rescuable.rb:80:in `call'
activesupport (3.2.1) lib/active_support/rescuable.rb:80:in `rescue_with_handler'
actionpack (3.2.1) lib/action_controller/metal/rescue.rb:15:in `rescue_with_handler'
actionpack (3.2.1) lib/action_controller/metal/rescue.rb:32:in `rescue in process_action'
actionpack (3.2.1) lib/action_controller/metal/rescue.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `block in instrument'
activesupport (3.2.1) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
activesupport (3.2.1) lib/active_support/notifications.rb:123:in `instrument'
actionpack (3.2.1) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
actionpack (3.2.1) lib/action_controller/metal/params_wrapper.rb:205:in `process_action'
mongo-rails-instrumentation (0.2.4) lib/mongo/rails/instrumentation/controller_runtime.rb:13:in `process_action'
actionpack (3.2.1) lib/abstract_controller/base.rb:121:in `process'
actionpack (3.2.1) lib/abstract_controller/rendering.rb:45:in `process'
actionpack (3.2.1) lib/action_controller/metal.rb:203:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.2.1) lib/action_controller/metal.rb:246:in `block in action'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:66:in `dispatch'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:30:in `call'
journey (1.0.1) lib/journey/router.rb:68:in `block in call'
journey (1.0.1) lib/journey/router.rb:56:in `each'
journey (1.0.1) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/railtie/configurable.rb:30:in `method_missing'
journey (1.0.1) lib/journey/router.rb:68:in `block in call'
journey (1.0.1) lib/journey/router.rb:56:in `each'
journey (1.0.1) lib/journey/router.rb:56:in `call'
actionpack (3.2.1) lib/action_dispatch/routing/route_set.rb:589:in `call'
rack-pjax (0.5.9) lib/rack/pjax.rb:12:in `call'
omniauth (1.0.3) lib/omniauth/strategy.rb:168:in `call!'
omniauth (1.0.3) lib/omniauth/strategy.rb:148:in `call'
/Users/alon/.rvm/gems/ruby-1.9.3-p0/bundler/gems/mongoid-b4cce4179ace/lib/rack/mongoid/middleware/identity_map.rb:33:in `block in call'
/Users/alon/.rvm/gems/ruby-1.9.3-p0/bundler/gems/mongoid-b4cce4179ace/lib/mongoid/unit_of_work.rb:39:in `unit_of_work'
/Users/alon/.rvm/gems/ruby-1.9.3-p0/bundler/gems/mongoid-b4cce4179ace/lib/rack/mongoid/middleware/identity_map.rb:33:in `call'
warden (1.1.1) lib/warden/manager.rb:35:in `block in call'
warden (1.1.1) lib/warden/manager.rb:34:in `catch'
warden (1.1.1) lib/warden/manager.rb:34:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
rack (1.4.1) lib/rack/etag.rb:23:in `call'
rack (1.4.1) lib/rack/conditionalget.rb:25:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/head.rb:14:in `call'
remotipart (1.0.2) lib/remotipart/middleware.rb:30:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/flash.rb:242:in `call'
rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/cookies.rb:338:in `call'
dragonfly (0.9.11) lib/dragonfly/cookie_monster.rb:9:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `_run__1175696337329485518__call__2101614619010324596__callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:405:in `__run_callback'
activesupport (3.2.1) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
activesupport (3.2.1) lib/active_support/callbacks.rb:81:in `run_callbacks'
actionpack (3.2.1) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/reloader.rb:65:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
railties (3.2.1) lib/rails/rack/logger.rb:26:in `call_app'
railties (3.2.1) lib/rails/rack/logger.rb:16:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/request_id.rb:22:in `call'
rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
rack (1.4.1) lib/rack/runtime.rb:17:in `call'
activesupport (3.2.1) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.4.1) lib/rack/lock.rb:15:in `call'
actionpack (3.2.1) lib/action_dispatch/middleware/static.rb:53:in `call'
dragonfly (0.9.11) lib/dragonfly/middleware.rb:13:in `call'
rack-cache (1.1) lib/rack/cache/context.rb:132:in `forward'
rack-cache (1.1) lib/rack/cache/context.rb:241:in `fetch'
rack-cache (1.1) lib/rack/cache/context.rb:181:in `lookup'
rack-cache (1.1) lib/rack/cache/context.rb:65:in `call!'
rack-cache (1.1) lib/rack/cache/context.rb:50:in `call'
railties (3.2.1) lib/rails/engine.rb:479:in `call'
railties (3.2.1) lib/rails/application.rb:220:in `call'
railties (3.2.1) lib/rails/railtie/configurable.rb:30:in `method_missing'
raindrops (0.8.0) lib/raindrops/middleware.rb:118:in `call'
rack (1.4.1) lib/rack/content_length.rb:14:in `call'
railties (3.2.1) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
/Users/alon/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
/Users/alon/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
/Users/alon/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/webrick/server.rb:191:in `block in start_thread'
Request

Parameters:

{"model_name"=>"admin",
 "id"=>"v_file"}
Show session dump

Show env dump

Response

Headers:

None

Reload!

Hi,

I'm using ruby 1.9.3 and rails 3.2.3, I just can't reload when using the console, and I can't figure out a workaround, could you please help?

Using pry-rails for non "development" environment

Hi, I am using environments like "flavor1_development", "flavor2_development", "flavor1_production","flavor2_production".
Is there any way to make pry-rails load also in /development/ environments? Not just "development" environment.

Load error when ruby-debug is enabled

When ruby-debug19 is enabled in my Gemfile I experience the following problem:

rails c

/Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/ruby-debug19-0.11.6/cli/ruby-debug/commands/irb.rb:3:in `<top (required)>': IRB is not a module (TypeError)
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `block in require'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `block in load_dependency'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:640:in `new_constants_in'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:223:in `load_dependency'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/dependencies.rb:240:in `require'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:51:in `block in load_commands'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:50:in `each'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:50:in `load_commands'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:210:in `<module:Debugger>'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/ruby-debug19-0.11.6/cli/ruby-debug/command.rb:5:in `<top (required)>'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:2:in `require_relative'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/ruby-debug19-0.11.6/cli/ruby-debug/processor.rb:2:in `<top (required)>'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:6:in `require_relative'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/ruby-debug19-0.11.6/cli/ruby-debug.rb:6:in `<top (required)>'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
    from /Users/bozhidar/work/empower-united/config/application.rb:7:in `<top (required)>'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:38:in `require'
    from /Users/bozhidar/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.0/lib/rails/commands.rb:38:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'

Rails.cache when running pry console

After adding pry-rails to my project, Rails.cache no longer works in the console. Is this intentional?

This is what I get when using pry as my console:

(pry) main: 0> Rails.cache.write('foo', 'bar')
true
(pry) main: 0> Rails.cache.read('foo')
nil

using bundler :console group

I use the method described here in the "Console Extensions" section to only load pry and pry rails when i'm firing up the console (so I can have it on production without loading it into memory for my app).

http://iain.nl/getting-the-most-out-of-bundler-groups#toc_5

This worked with 0.1.6, but now with 0.2.1 pry no longer loads in any environment. If i take it out of the :console group it does load as expected.

I poked around in the pry-rails railtie and other code and couldn't really see what might be happening, figured I'd raise it here before spending an hour learning pry-rails :-)

Thanks for a great project!

No Rails-specific commands

I am using Rials 3.1.6, rake 0.9.2.2, and pry-rails 0.1.6. I get the following erorrs:

> rake init_test_app

rake aborted!
Don't know how to build task 'init_test_app'
/home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/lib/rake/task_manager.rb:49:in []' /home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/lib/rake/application.rb:115:ininvoke_task'
/home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block (2 levels) in top_level' /home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:ineach'
/home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/lib/rake/application.rb:94:in block in top_level' /home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:instandard_exception_handling'
/home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/lib/rake/application.rb:88:in top_level' /home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/lib/rake/application.rb:66:inblock in run'
/home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/lib/rake/application.rb:133:in standard_exception_handling' /home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/lib/rake/application.rb:63:inrun'
/home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/gems/rake-0.9.2.2/bin/rake:33:in <top (required)>' /home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/bin/rake:19:inload'
/home/sam/.rvm/gems/ruby-1.9.3-p194-fast@global/bin/rake:19:in <main>' /home/sam/.rvm/gems/ruby-1.9.3-p194-fast/bin/ruby_noexec_wrapper:14:ineval'
/home/sam/.rvm/gems/ruby-1.9.3-p194-fast/bin/ruby_noexec_wrapper:14:in `

'

> rails c

[DEVISE] We have detected that you are using devise_for inside engine routes. In this case, you probably want to set Devise.router_name = MOUNT_POINT, where MOUNT_POINT is a symbol representing where this engine will be mounted at. For now Devise will default the mount point to :main_app. You can explicitly set it to :main_app as well in case you want to keep the current behavior.
Loading development environment (Rails 3.1.6)
[1] pry(main)> show-routes
NameError: undefined local variable or method show' for main:Object from (pry):1:inpry'
[2] pry(main)> show-
show-command show-doc show-input show-method show-source

I do not believe there are any of this gem's documented features being exposed to the pry console.

Some dazzling graph thing

Imagine this:

You have a completely-trusted part of the site that was is a web page with:

  • a pry-backed Rails console like better_errors
  • A graph above, like using gnuplot on the server-side or D3 on the client-side.
  • A generic output console (for showing errors, intermediate queries, and JSON)

Domain experts could hammer at it, with a .png/.svg rendering as the main output. When they like it, they click a thing that says, "Put this on my dashboard of things I like."

Boom, power for the business folk.

This could open up Rails to a whole set of use cases, for almost no expense to the dev.

Also it would make for a shiny demo at RailsConf

show-model and ActiveSupport::Concern don't play well together...

There's an issue when you try to run show-model on models that have Concerns which use the included helper.

Example model:

module Concerned
  extend ActiveSupport::Concern

  included do
    scope :omg, -> { where scary: true }
  end
end

class User < ActiveRecord::Base
  include Concerned
end

Pry result:

> show-model User
Exception: ActiveSupport::Concern::MultipleIncludedBlocks: Cannot define multiple 'included' blocks for a Concern

The source of the error is: pry-rails-0.3.4/lib/pry-rails/commands/show_model.rb:17, where it calls Rails.application.eager_load!

It seems like eager_load! is doing something that's including the Concern twice. Here's some more info:

http://stackoverflow.com/questions/24244519/cannot-define-multiple-included-blocks-for-a-concern-activesupportconcern

reload! - undefined method

Using pry-rails (0.1.2) causes reload! to no longer work in Rails 3.2. with Ruby 1.9.3.

If I remove the pry-rails gem and use irb, it works as expected.

Exact Message:

Loading development environment (Rails 3.2.0)
[1] pry(main)> reload!
NoMethodError: undefined method `reload!' for main:Object

Thanks,
Scott

P.S. I also noticed the app variable is no longer available.

pry-rails Doesn't seem to work with Rails 4

I also found a question about it on stackoverflow:
http://stackoverflow.com/questions/19151801/pry-rails-not-rails-console-working-with-rails-4-0

This is the error I get using Rails 4 on Ruby 2:

/homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/pry-rails-0.2.0/lib/pry-rails/commands.rb:3:in `block in <module:PryRails>': undefined method `create_command' for #<Pry::CommandSet:0x007f8d73fdd4e8> (NoMethodError)
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/pry-0.9.6/lib/pry/command_set.rb:60:in `instance_eval'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/pry-0.9.6/lib/pry/command_set.rb:60:in `initialize'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/pry-rails-0.2.0/lib/pry-rails/commands.rb:2:in `new'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/pry-rails-0.2.0/lib/pry-rails/commands.rb:2:in `<module:PryRails>'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/pry-rails-0.2.0/lib/pry-rails/commands.rb:1:in `<top (required)>'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `block in require'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:213:in `load_dependency'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/pry-rails-0.2.0/lib/pry-rails.rb:8:in `<top (required)>'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `require'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/bundler-1.3.5/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `each'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/bundler-1.3.5/lib/bundler/runtime.rb:70:in `block in require'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `each'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/bundler-1.3.5/lib/bundler/runtime.rb:59:in `require'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/bundler-1.3.5/lib/bundler.rb:132:in `require'
    from /homedir/project/path/config/application.rb:12:in `<top (required)>'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/railties-4.0.0/lib/rails/commands.rb:62:in `require'
    from /homedir/.rvm/gems/ruby-2.0.0-p247@project/gems/railties-4.0.0/lib/rails/commands.rb:62:in `<top (required)>'
    from bin/rails:4:in `require'
    from bin/rails:4:in `<main>'

Missing git tags

There are no git tags seen at https://github.com/rweng/pry-rails/tags

I checked git log and find commits which should associate with tags.

v0.3.0 6bdc27d5b8bc1da051cb01760c8e749f33f6c6e6
v0.2.2 46e10bd921739ceb2ea76047a2defd873629e430
v0.2.1 b410f123a5fe81accd46a1dd9c11fd6ff89c8d75
v0.2.0 0e234c06b733b3618abe5ccb30c01e32296b2a62
v0.1.6 3700581c24264e1141ebfe0814ad28116f61ac05
v0.1.5 11d41eaaa76055279bafb570c252a90ccaac6b53
v0.1.4 86beea6fdbf4fe05b26a20a38fc3048d2378d753
v0.1.3 27abb479de46fae319dfe1c4d034a1dd65c238a2
v0.1.2 c028ebdafdc054c74da04a4f006c63d2a925fd2b
v0.1.1 64aaf0bec385ae589752ade0fd2a3a9ea6814691
v0.0.5 fc50ff4089f468c87191ee7adacef46ae6532ca4
v0.0.4 1fd88d3cf76d237a006a51db7e96ac17c52769c5
v0.0.3 a9b6d198c2f184669f69b7cd2fc3ef91d4a0d387
v0.0.2 3700654cc3e8bcca0288b0cc3b8bba8d1a8f0305
v0.0.1 61fd6842f1ed5069d418d045bdc49c02a463f867

Could you create and push these tags?

P.S. rake release task will automatically do these boring things, so I strongly recommend to use this task for releasing new version to rubygems.org.

pry-rails needs a license

Can you please add a LICENSE file (or edit the README) indicating under what terms pry-rails is available?

Pry supports readline, Pry-rails does not (OS X)

Hi. I've gotten my build of ruby working with GNU readline as opposed to OS X's editline lib. My .inputrc looks like this:

"\e[A": history-search-backward
"\e[B": history-search-forward
set show-all-if-ambiguous on

When I use pry outside of my rails project, I can type a partial match for the history line I want, and use up and down arrows to find matches. This isn't working when I use the rails console (using pry-rails). I've tried to debug this, but have only found that Pry.config.input is Readline.

Any suggestions on how I can debug why this isn't working / fix the issue?

Thanks.

Autoload classes on start to have TAB autocompletion

When I launch rails console (which defaults to pry) at start there is no class tab autocompletion, for example (assuming that I have a model named User):

rails c
=> pry(main)> U[TAB] //nothing, but when I launch show-model
=> pry(main)> show-model //this loads all classes including models
=> pry(main)> U[TAB] 
=> pry(main)> User

Is there a way to autoload classes the way show-model does?

Encoding::UndefinedConversionError

When I paste "ñ" (with quotes) in to the console with pry-rails (0.3.3) enabled I will get an Encoding::UndefinedConversionError error.

$ bundle exec rails console
main:0>"��"
/Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/history.rb:106:in `write': "\xC3" from ASCII-8BIT to UTF-8 (Encoding::UndefinedConversionError)
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/history.rb:106:in `puts'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/history.rb:106:in `save_to_file'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/history.rb:50:in `call'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/history.rb:50:in `push'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:267:in `handle_line'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:243:in `block (2 levels) in eval'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:242:in `catch'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:242:in `block in eval'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:241:in `catch'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_instance.rb:241:in `eval'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/repl.rb:77:in `block in repl'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/repl.rb:67:in `loop'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/repl.rb:67:in `repl'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/repl.rb:38:in `block in start'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/input_lock.rb:61:in `call'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/input_lock.rb:61:in `__with_ownership'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/input_lock.rb:79:in `with_ownership'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/repl.rb:38:in `start'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/repl.rb:15:in `start'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/pry-0.10.1/lib/pry/pry_class.rb:169:in `start'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.21/lib/rails/commands/console.rb:47:in `start'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.21/lib/rails/commands/console.rb:8:in `start'
    from /Users/lukec/.rbenv/versions/2.1.5/lib/ruby/gems/2.1.0/gems/railties-3.2.21/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'

If I disable pry-rails in my Gemfile I get the expected output.

$ bundle exec rails console
Loading development environment (Rails 3.2.21)
irb(main):001:0> "ñ"
=> "ñ"

I'd love to get to the bottom of this, so please let me know if there's any additional information I can provide.

Uninitialized constant

Using pry-rails v0.1.5, I get the following error when trying to start the server:

uninitialized constant Rails::Console (NameError)
/Users/mdi/.rvm/gems/ruby-1.9.3-p0-punch/gems/rake-0.9.2.2/lib/rake/ext/module.rb:36:in `const_missing'
/Users/mdi/.rvm/gems/ruby-1.9.3-p0-punch/gems/pry-rails-0.1.5/lib/pry-rails.rb:9:in `block in <class:Railtie>'

Gem inclusion is working differently. (Not an issue)

I am using pry-rails (including some other gems) in my local development only by creating local (non-project) Gemfile.

Steps to reproduce this,

  1. Create a new local Gemfile under project root, Gemfile.local with below snippets.
eval File.read('Gemfile') # Project's Gemfile
gem 'pry-rails'
  1. Do bundle install --gemfile=Gemfile.local on project root.

  2. rails console - Expected; console should be as pry. But it's not.

  3. But, when you do bundle exec rails console it's working as expected.

  4. After moving the pry-rails to Project's Gemfile, it's working as expected without bundle exec.

Can anyone explain this, why bundle exec required even though all the gems are downloaded in the same place (RVM Gemset)?

illegal hardware instruction

Just today, I am seeing tons of illegal hardware instruction rails console errors while using pry-rails

Everything was working yesterday. I am unable to use the console at all. If I remove pry-rails from my gemset, the issue goes away.

OS X, 10.8.2 (12C60), 13" Macbook Air, 1.8ghz i7, 4GB ram.

Even more details here.

I don't even know where to begin troubleshooting this problem!

I've reinstalled homebrew, rvm, and all rubies, and recreated my gemsets. I am seeing this issue with both ruby 1.9.3-p194 and 1.9.3-p286.

Next step will probably be to wipe & reinstall OS.

rails c with turn gem ⇒ odd, empty test runs.

If you start with Rails 3.2.9 and do a rails new foo && cd foo

Then edit the Gemfile to have:

group :development do
  gem 'turn'
  gem 'pry-rails'
end

Then run: bundle exec rails c

Then hit ^D to exit the console, you'll get funky output like this:

Loaded Suite test,test/functional,test/unit,test/unit/helpers,test/performance
Started at 2012-12-03 05:56:45 +0000 w/ seed 23441.
Finished in 0.839736 seconds.
0 tests, 0 passed, 0 failures, 0 errors, 0 skips, 0 assertions

This doesn't happen:

  • without the turn gem
  • without the pry-rails gem (not even if you Pry.start from ~/.irbrc)

We haven't had time to look into it beyond seeing that:

  • It comes from the test autorun stuff
  • railties-3.2.9/lib/rails/console/app.rb has a funky hack:
# work around the at_exit hook in test/unit, which kills IRB
Test::Unit.run = true if Test::Unit.respond_to?(:run=)

Any clues about this one?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.