All threads / Multiday with calendar gem

Ask A Question

Notifications

You’re not receiving notifications from this thread.

Multiday with calendar gem

John Munyi asked in General

Is possible you shed some more light on this ....

which is the best approach in my event.rb i so fat have this

  class Event < ActiveRecord::Base
    belongs_to :user

 def duration
   end_time - start_time
 end

 def event_length(start_time)
   start_time + (duration*24*60*60)  
  end
  end

wondering how to pass on the value returned by event_length to the calendar and have the event displayed across multiple days

So right now there's no way to do that with simple_calendar. It's a somewhat complicated thing to do to reproduce Google Calendar style multi-day events.

One option you have is to add some code to the view to look for events that started before the current and end on or after it to find multi-day events. You can create a helper to do that or add some code to your controller.

At some point I'll be patching that in simple_calendar to help make it easier.

hey Chris , thanks for the update ... anyother gems you would recommend that would handle that in a simpler mannner ?

Maybe Javascript libraries like http://fullcalendar.io/ but no gems that I'm aware of.

cool... wil check it out .. thanks

Join the discussion

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

Join 34,674+ 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.

    Ruby on Rails tutorials, guides, and screencasts for web developers learning Ruby, Rails, Javascript, Turbolinks, Stimulus.js, Vue.js, and more. Icons by Icons8

    © 2020 GoRails, LLC. All rights reserved.