Guest User

Untitled

a guest
Oct 17th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. class TimeBlock < ActiveRecord::Base
  2. attr_accessible :recurring_weekdays
  3. attr_accessor :recurring_weekdays
  4.  
  5. before_validation :set_recurring
  6.  
  7. def recurring_weekdays
  8. return unless self.schedule
  9. self.schedule.to_hash[:rrules][0][:validations][:day]
  10. end
  11.  
  12. def set_recurring
  13. # at breakpoint...
  14. p recurring_weekdays # -> NoMethodError Exception: undefined method `[]' for nil:NilClass
  15. p @recurring_weekdays # -> "friday "
  16. end
  17. end
Add Comment
Please, Sign In to add comment