Jump to content

The ultimate community for Ruby on Rails developers.


Undefined local variable or method “#name of method” for#


  • Please log in to reply
1 reply to this topic

#1 dailammoc



  • Members
  • 38 posts
  • Location/

Posted 28 April 2014 - 10:38 AM

I know this is a common error, but my problem is quite difference. I had this code:

 <% accessible_prefectures.each do |prefecture| -%>

when I put it in a file located in products directory it run correctly(on PC interface). However, when I copy this code to other file in mobile directory(to display on mobile interface) it throw the error:

Undefined local variable or method 'accessible_prefectures' for#...

I didn't understand why while in this directory it ran correctly, but in other one error occur. So can someone explain it for me?

#2 katafrakt



  • Members
  • 17 posts
  • LocationKraków, PL

Posted 29 April 2014 - 09:51 AM

Probably the helper method accessible_prefectures (if it is a helper method - we can only guess) is not loaded or accessible in the scope of second use. You'd need to tell us more about the structure and where and how this method is defined.

Also tagged with one or more of these keywords: ruby-on-rails-4

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users