In side a rails app, after setting a breakpoint inside an action method of controller using byebug
,
when I type some gibberesh, I find that a method from my application_controller.rb is automatically executed before printing out "undefined local variable or method"
How is this magic happening? How do I trace this... I don't want this method run when gibberish is typed...
(byebug) abcd1234abcd1234
WpPost Load (4.8ms) SELECT `wp_posts`.`post_title`, `wp_posts`.`post_date`, `wp_posts`.`post_name` FROM `wp_posts` WHERE `wp_posts`.`post_status` = 'publish' AND (post_date_gmt >= '2017-01-30 23:31:52.437270') ORDER BY post_date DESC LIMIT 3
*** NameError Exception: undefined local variable or method `abcd1234abcd1234' for #<FooController:0x007fa717745bd8>
nil
(byebug)
Some code
# foo_controller.rb
class FooController < ApplicationController
def show
byebug # I type abcd1234abcd1234 at this prompt
# ...
# application_controller.rb
class ApplicationController < ActionController::Base
before_filter :something
before_filter :something2
before_filter :load_blog_posts, :something3
def ....
end
def load_blog_posts
@wp_posts = WpPost.where(post_status: 'publishh')
.where("post_date_gmt >= ?", Time.now - 1.week )
.order("post_date DESC")
.limit(3)
.select(:post_title, :post_date, :post_name)
end