2

I am having an issue where class_name seems to work on something like

User.first.class.class_name locally but it seems to fail in production.

I am trying to figure out where class_name is defined (I am using it on something like Admin::User.first.name.class_name to return "User" since I want the demodulized class name.) Why would it not work on production?

Where can I see what module class_name is a part of?

3
  • What error message are you getting? Commented Aug 4, 2016 at 19:50
  • stackoverflow.com/a/24832287/908842 - demodularized class name Commented Aug 4, 2016 at 19:51
  • undefined method class_name for #<Class::4539q5834905834> (some class object) Commented Aug 4, 2016 at 20:29

1 Answer 1

18

class_name method is defined by yard gem. it works only development env.

or

Check which module define class_name

User.method(:class_name).source_location 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.