excid3 / simple_calendar

A wonderfully simple calendar gem for Rails
http://excid3.github.io/simple_calendar
MIT License
1.58k stars 268 forks source link

Custom user settings #207

Closed fabdurso closed 6 years ago

fabdurso commented 6 years ago

I'm using rails-settings to manage user settings like:

Now, let's say that the user calendar_type is week_calendar and I want to set the number_of_weeks

will work, but

won't work, nor

Which would be the right formatting?

excid3 commented 6 years ago

You don't need to use send for the options, you only use that to call the correct method. The rest aren't methods.

<%= send "#{user.settings(:calendar).type}", number_of_weeks: user.settings(:calendar).weeks, events: calendar_events do |date, events| %>
fabdurso commented 6 years ago

Couldn't be easier... Thanks @excid3 !