Last active
August 29, 2015 13:57
-
-
Save americos/9915200 to your computer and use it in GitHub Desktop.
Stack level too deep?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Why I get stack level too deep in IRB, when calling: | |
# location = VendorLocation.find 53575 | |
# LocationCalendarDayHours.from_java_json(location.calendarHours).first.weekday_type_code | |
# | |
# Note: I created weekday_type.rb as a WwConstant | |
class LocationCalendarDayHours | |
include ActiveModel::Model | |
include WWLegacyJavaJsonSupport | |
attr_accessor :weekday_type_code, :enabled_flag, :start_time, :end_time | |
def self.java_enums | |
%w( weekdayType ) | |
end | |
def weekday_type_code | |
WwConstants::WeekDayType.find_by_code( weekday_type_code.to_s ) | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Ok My problem was that weekday_type_code it's calling itself, so what I needed to do is rename the
weekday_type_code
method toweekday_type
and then I can call something like:LocationCalendarDayHours.from_java_json(location.calendarHours).first.weekday_type