views:

17

answers:

1

I have a controller with a action similar to this

class EventsController < ApplicationController

    ....

    def test
      Events.first.test
    end

    ....

end

and a model similar to this

class Event < ActiveRecord::Base

....

    def test
        debugger
    end

....

end

What confuses me is that, when the action is triggered and calls the method of the model wich then brings me the debugger, I am not in the method of the model.

the debuggers list command brings me this

(rdb:73) list
[1327, 1336] in /Library/Ruby/Gems/1.8/gems/actionpack-2.3.4/lib/action_controller/base.rb
   1327        end
   1328  
   1329        def perform_action
   1330          if action_methods.include?(action_name)
   1331            send(action_name)
=> 1332            default_render unless performed?
   1333          elsif respond_to? :method_missing
   1334            method_missing action_name
   1335            default_render unless performed?
   1336          else

and self is not an instance of the Even class

(rdb:73) self
#<EventsController:0x1032786d0 @performed_render=false, @_headers={"Cache-Control"=>"
....

Am I missing the something? How do I get the debugger into the test method of the Event class?

+2  A: 

Yes it's with implicit return in last line.

Add some line after your debugger like


    def test
        debugger
        puts 'debug'
    end
shingara