Ask A Question

Notifications

You’re not receiving notifications from this thread.

Recurring Events

sid d asked in Rails
# Model 
def Event
  WEEKDAYS = ['sunday', 'monday', 'wednesday', 'thursday', 'friday', 'saturday']

end

# Migration 
create_table :events do |t|
 t.column recurring, default: false 
 t.column start_date:datetime
end

# Console
Event.create(:name => 'Avengers', :recurring => true, :week_days => ['Sunday', 'Wednesday'])
Event.create(:name => 'Dummy movie', :recurring => false)
Event.today  #Today events ( Dummy movie, Avengers)
Event.between(tomorrow, end_of_the_month) # ( Avengers, Avengers, Avengers, ...... )  
  • Can anyone suggest best way to implement recurring Events and Fetching of Events according to Weekdays ?
Reply

I've found out Recurring Select which best suits my needs. It would be nice if we had a screencast on this

Reply

Neat, I didn't know about Recurring Select. What kind of params does the recurring_select field send over? Their Readme doesn't really explain that.

Reply
Join the discussion
Create an account Log in

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

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

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