#203 ✓invalid
Dmytrii Nagirniak

Can't use normal IRB within Rails Console

Reported by Dmytrii Nagirniak | December 7th, 2011 @ 02:32 AM

When starting a rails console, the usual features or IRB are not available (such as up-arrow to get the previous command, left-arrow to move one character left etc).

Instead, the corresponding symbols are inserted like ^[[D for left-arrow.

Comments and changes to this ticket

  • Andreas Ronge

    Andreas Ronge December 7th, 2011 @ 08:54 AM

    • Assigned user set to “Andreas Ronge”

    There are also other problem with the rails console. You only have access to a read only database.
    I've been thinking of adding an IRB like console accessible from a web page, and also support some visualization
    (a bit like the neo4j-server graph visualization). Have a look at this https://github.com/AmanziTel/neo-viz - it can be improved ...

  • Dmytrii Nagirniak

    Dmytrii Nagirniak December 7th, 2011 @ 09:46 AM

    The console can be used not only to access the DB, but the whole server.

    So I am not sure why neo4j replaces it altogether with something much less functional.

    Is there ANY way of having writable DB from the console?

    The neo-viz looks interesting, but I really need the SSH accessible console without exposing anything to the web.

    One of the things rails console is useful for is to fix some data on the spot.
    I don't know how I can achieve this with embedded DB at all.

    Also I am not sure how I can scale the app to multiple processes (not threads) without resorting to HA.

  • Andreas Ronge

    Andreas Ronge December 7th, 2011 @ 10:16 AM

    The only way we can have IRB accessing the database at the same time as the
    application is running is by doing something similar to NeoViz.
    Maybe we can make IRB talk to the embedded database via a socket.
    The embedded database can start up a little server and handle requests from IRB.
    It would also work in none rails application.

    Why not scale with threads instead of processes ?
    Threads in JRuby does use all available cores, unlike MRI ruby.

  • Dmytrii Nagirniak

    Dmytrii Nagirniak December 7th, 2011 @ 10:42 AM

    I guess the DRB could do the job for this, but it is going to be very, very tricky to replicate the full embedded API over the socket.

    But at this stage (and in this issue) I am only after the proper console. (sorry for going off-topic).

    Is there any way to get there? Also why do you replace it (maybe you can point me to a piece of code too)?

  • Andreas Ronge

    Andreas Ronge December 7th, 2011 @ 11:01 AM

    I've have not replaced anything or done anything to get the rails console work with neo4j. The only thing that is done is when the neo4j.db starts. It then check if there is another process accessing the database. In that case it will start the graph database in read only mode.

    I've no clue why the symbols does not work. Does it work at all for JRuby ?

    Open a new issue of write support from IRB.

  • Dmytrii Nagirniak

    Dmytrii Nagirniak December 7th, 2011 @ 10:26 PM

    Ok. I tried in a new Rails 3.1 app without neo4j and I the same issue appears. So it's not the neo4j issue.

    Must be something with JRuby. Not sure how to fix it though.

    Sorry for not double checking this. I guess you can close this issue.

  • Andreas Ronge

    Andreas Ronge December 7th, 2011 @ 10:29 PM

    • State changed from “new” to “invalid”
  • Andreas Ronge
  • Dmytrii Nagirniak

    Dmytrii Nagirniak December 7th, 2011 @ 10:36 PM

    yeah. Sure. I use it most of the time as debugger (just call binding.pry). It's pretty awesome. Especially things like show-method object.my_method.

    But I didn't replace IRB.
    There's also RailsCast on how to replace IRB with Pry (similar to the article you mentioned): http://railscasts.com/episodes/280-pry-with-rails

    I personally wouldn't mind it as a dependency. But it may be worth to use IRB as it is just built-in and only use Pry when it is available.

  • Dmytrii Nagirniak

    Dmytrii Nagirniak December 7th, 2011 @ 11:42 PM

    BTW, here is what I mean by "normal" console if you are interested:

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Neo4j.rb is a graph database framework for JRuby.

It provides:

* Mapping of ruby objects to nodes in networks rather than in tables.
* Storage of ruby object to a file system.
* Fast traversal of relationships between nodes in a hugh node space.
* Transaction with rollbacks support.
* Indexing and quering of ruby objects.
* Integration with Rails

People watching this ticket