README.md in simple_calendar-2.2.5 vs README.md in simple_calendar-2.2.6
- old
+ new
@@ -43,10 +43,12 @@
<%= month_calendar do |date| %>
<%= date %>
<% end %>
```
+To show the day of the month instead of the date, use `<%= date.day %>`
+
### Week Calendar
You can generate a week calendar with the `week_calendar` method.
```erb
@@ -108,21 +110,30 @@
# multi-day events
$ rails g scaffold Meeting name start_time:datetime end_time:datetime
```
-By default it uses `start_time` as the attribute name. Optionally the `end_time`
-attribute can be used which enables multi-day event rendering.
+By default it uses `start_time` as the attribute name.
+**If you'd like to use another attribute other than start_time, just
+pass it in as the `attribute`**
-**If you'd like to use another attribute other than start_time or end_time, just
-pass it in as the `attribute` or `end_attribute` options respectively**
-
```erb
<%= month_calendar(attribute: :starts_at) do |date| %>
<%= date %>
<% end %>
```
+
+Optionally the `end_time` attribute can be used which enables multi-day event rendering.
+
+**Just pass in the `attribute` and `end_attribute` options respectively**
+
+```erb
+<%= month_calendar(attribute: :start_date, end_attribute: :end_date) do |date| %>
+ <%= date %>
+<% 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
@@ -317,11 +328,11 @@
The main method you'll need to implement is the `date_range` so that
your calendar can have a custom length.
```ruby
-class SimpleCalendar::BusinessWeekCalendar
+class SimpleCalendar::BusinessWeekCalendar < SimpleCalendar::Calendar
private
def date_range
beginning = start_date.beginning_of_week + 1.day
ending = start_date.end_of_week - 1.day
@@ -331,10 +342,10 @@
```
To render this in the view, you can do:
```erb
-<%= SimpleCalendar::BusinessWeekCalendar.new(self).render do |date| %>
+<%= SimpleCalendar::BusinessWeekCalendar.new(self, {}).render do |date| %>
<%= date %>
<% end %>
```
And this will render the