README.md in simple_calendar-2.0.3 vs README.md in simple_calendar-2.0.5
- old
+ new
@@ -90,10 +90,20 @@
```erb
<%= month_calendar(attribute: :starts_at) do |date| %>
<%= day %>
<% end %>
```
+**If you already have a model with a start time attribute called something other than `start_time` or accesses it through a relationship, you can alias the attribute by defining a `start_time` method in the my_model.rb file and not have to specify it separately as in the above example**
+```ruby
+class MyModel
+ ## Other code related to your model lives here
+
+ def start_time
+ self.my_related_model.start ##Where 'start' is a attribute of type 'Date' accessible through MyModel's relationship
+ end
+end
+```
In your controller, query for these meetings and store them in an instance
variable. Normally you'll want to search for the ones that only show up
inside the calendar view (for example, you may only want to grab the events for
the current month).
@@ -296,10 +306,10 @@
To render this in the view, you can do:
```erb
<%= SimpleCalendar::BusinessWeekCalendar.new(self).render do |date| %>
- <%= day %>
+ <%= date %>
<% end %>
```
And this will render the
`app/views/simple_calendar/_business_week_calendar.html.erb` partial.