0

I have two controllers, One lets me use byebug and pry, the other just skips it, not sure why. Wondering if anyone has ran into a similar issue. I have installed pry and byebug correctly for it to work on one of the controllers, i try to import and call pry correctly.

require 'pry'

class UsersController < ApplicationController
  skip_before_action :authenticate_user!, only: [:index]

  before_action :set_current_user_for_view

  def index
    @users = User.order(created_at: :desc)
  end

  def show
    binding.pry
    @user = User.find_by!(username: params[:id])
  end
end

I know the information i'm providing is not great, i'm new to Rails so let me know if you need any further info

4
  • Looking at the require line and calling binding.pry in show action, I am guessing pry is working for you in UsersController. If it is the working controller, can you also provide code for another controller for which it is not working? Commented Dec 26, 2020 at 6:23
  • I have a posts controller in which it works in, users doesn't work. Users and posts are very similar in the shown actions Commented Dec 28, 2020 at 21:58
  • Above code looks good. If still not working for you, Can you please explain what do you see in the browser, when you call the user's show action? and what's in the server console? Commented Dec 29, 2020 at 0:00
  • Show is where i have a "no method" error and i'm trying to see what causing that error. undefined method `set_current_user_for_view' for #<UsersController:0x00007fd209633d90> is the error and i got it after trying to build a follow, unfollow button using devise and act_as_follower gem. I tried commenting out the changes but the issue persists, i'm not sure if it has made a nuclear change in the sql db or not and that's causing the problem. interesting part is other actions that don't have an error also don't bring up pry on terminal and just follow through with the action and load the page Commented Dec 29, 2020 at 1:46

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.