1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

[Rails] simple_calendarでデフォルトの属性名”start_time” 以外の属性を使用する場合。

Posted at

simple_calendar を導入し、view、controllerを作成している前提です。
simple_calendar導入方法

デフォルトでは start_time のみが属性名として使用されます。
それ以外の属性名を使用したい場合は、 attribute: :開始時間の属性名, end_attribute: :終了時間の属性名events: の後に続けて追記します。

以下は、 start_at end_at に属性名を設定した例です。

views/blogs/index
<%= month_calendar events: @blogs, attribute: :start_at, end_attribute: :end_at do |date, blog| %>
  <%= date.day %>
   ...

<% end %>
1
1
4

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?