Skip to main content

Subscribe to GoRails to get access to this episode and all other pro episodes, and new awesome content every month.

Subscribe Now
Only $19/month

Unlimited access. Cancel anytime.

4 Upgrading simple_calendar for Rails 5

Episode 112 · April 4, 2016

We fix a bug in simple_calendar now that ActionController::Parameters are enforced with strong_params in Rails 5

Gems


Transcripts

Subscribe or login to view the transcript for this episode.

Discussion


Gravatar

like the new intro


Gravatar

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.


Gravatar

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|
%h6.cal
= link_to dance.style.name, 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!

Gravatar

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.

Gravatar

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


Login or create an account to join the conversation.