All threads / Upgrading simple_calendar for Rails 5 Discussion
Ask A Question


You’re not receiving notifications from this thread.

Upgrading simple_calendar for Rails 5 Discussion

Re. the talking head. For me, it's an epic distraction from the main content. It's nice to put a human face to the voice, but overlaying the entire video seems wrong to me. Don't know if others feel the same, but I'd suggest just popping up at the start & at moments when body language/gestures actually add to the pedagogical value.

Hi Chris. I have a question.

If i use this:
= month_calendar events: @dances, previous_link: events_ajax_previous_link, next_link: events_ajax_next_link do |start_date, dances|
= start_date.strftime("%d") if start_date.present?
- dances.each do |dance|
= link_to, dance_path(dance)

to show an event (in this case a dance event), and it works fine for one event but

HOW do i SHOW a recurring dance event, lets say next 3 recurrences like below but that it shows on each recurrence date on the calendar?

= dance.converted_schedule.next_occurrences(3)
i can show the dates with this code but i want them to show in the calendar.

ALSO is there a way to show multiple type of events from different models all in the same calendar?

thank you!

For both recurring events and various types, you just have to make them into one array and pass them in. So rather than calling them @dances, you might use @events and create it like so:

@events = Dance.all + Meeting.all

I just recorded a basic episode on recurring events, but you'd just generate them in memory and add them into this @events array. The calendar doesn't need to know anything about recurring events, just needs the individual events to display.

Chris does that mean then the Dance and Meeting CLASSES should have the same attributes like start_date and title if i want to show title of event and also be able to do this
= month_calendar events: @events, previous_link: events_ajax_previous_link, next_link: events_ajax_next_link do |start_date, events| ? Yeah so really dont understand how to iterate each Meeting object and Dance object and more from other classes if they all have different attributes, when I can only do |start_date, events| in the code above?? i did what you said but cannot show a thing. so frustrated with this. i really cannot figure out a way! can you help please?
are you posting the episode today? thanks a lot

Join the discussion

Want to stay up-to-date with Ruby on Rails?

Join 70,078+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.

    logo Created with Sketch.

    Screencast tutorials to help you learn Ruby on Rails, Javascript, Hotwire, Turbo, Stimulus.js, PostgreSQL, MySQL, Ubuntu, and more. Icons by Icons8

    © 2023 GoRails, LLC. All rights reserved.