Skip to content

Instantly share code, notes, and snippets.

@americos
Last active August 29, 2015 13:57
Show Gist options
  • Save americos/9915200 to your computer and use it in GitHub Desktop.
Save americos/9915200 to your computer and use it in GitHub Desktop.
Stack level too deep?
# 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
@americos
Copy link
Author

americos commented Apr 1, 2014

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 to weekday_type and then I can call something like: LocationCalendarDayHours.from_java_json(location.calendarHours).first.weekday_type

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment