SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    BreakPointer according to Ruby Book?

    I am not sure if this is an Instant Rails problem or something else.
    But I am working with Patrick Lenz's Building Your Own Ruby on Rails Web
    Applications book where in Chapter 11 he shows how to use the BreakPoint
    functionality within an RoR application. The book demonstrates this
    functionality by setting a breakpoint in one of the Controller methods
    as follows:

    def new
    @story = Story.new(params[:story])
    @story.user = @current_user
    if request.post? and @story.save
    breakpoint
    @story.tag_with params[:tags] if params[:tags]
    flash[:notice] = 'Story submission succeeded'
    redirect_to :action => 'index'
    end
    end

    Now, the new action corresponds with a new story being submitted. As
    the author instructs, I opened the web browser and try to submit a
    story. The browswer is supposed to hang and I should be able to invoke
    the breakpoint client by using the following command:

    ruby script/breakpointer

    But, the browswer displays the following information instead of hanging:

    RuntimeError in StoryController#new

    Breakpoints are not currently working with Ruby 1.8.5
    RAILS_ROOT: ./script/../config/..

    Application Trace | Framework Trace | Full Trace
    #{RAILS_ROOT}/vendor/rails/railties/lib/breakpoint.rb:21:in `of_caller'
    #{RAILS_ROOT}/vendor/rails/railties/lib/breakpoint.rb:543:in
    `breakpoint'
    #{RAILS_ROOT}/app/controllers/story_controller.rb:12:in `new'

    The breakpoint is indeed, on line 12 of the story_controller.rb file.

    This puzzles me! How are people using InstantRails (I am using
    InstantRails-1.5-win.zip). I also checked on the Ruby download website
    which shows that the current version of Ruby is 1.8.5. Does it mean
    that breakpoint functionality is not available in Ruby 1.8.5? Or this
    particular release that I am working with does not have it?

    Either way, please advise on how to go about solving this problem.

    Bharat

  2. #2
    SitePoint Enthusiast
    Join Date
    Sep 2005
    Posts
    28
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    The chapter about installing RoR recommends using 1.8.4 because the breakpoint functionality as implemented in the book does not work in version 1.8.5.

    I probably would have missed that, too, if i hadn't encountered so much difficulty when trying to get it installed.

  3. #3
    SitePoint Member
    Join Date
    Mar 2007
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I posted the same question in the RoR forum. Steve Ross pointed me to ruby-debug as an alternative. If you want to stay with the latest release of InstantRails which uses Ruby 1.8.5, ruby-debug can be an alternative to script/breakpointer. I am posting the link to this thread for anyone wanting to use this approach:
    http://www.ruby-forum.com/topic/102331#new
    Bharat


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •