Skip to content
/ shibaraku Public

Manage model with a period on ActiveRecord.

License

Notifications You must be signed in to change notification settings

onk/shibaraku

Folders and files

NameName
Last commit message
Last commit date

Latest commit

1a3eb0d · Nov 28, 2019

History

78 Commits
Nov 28, 2019
Oct 17, 2015
Nov 28, 2019
Nov 28, 2019
Nov 28, 2019
Oct 17, 2015
Oct 17, 2015
Nov 28, 2019
Oct 17, 2015
Oct 17, 2015
Oct 17, 2015
Oct 17, 2015
Nov 28, 2019

Repository files navigation

ActiveRecord で start_at/end_at がある model を扱う gem です

Usage

# create_table :campaigns do |t|
#   t.datetime :start_at
#   t.datetime :end_at
# end
class Campaign < ActiveRecord::Base
  shibaraku
end
Campaign.in_time
# => SELECT start_at <= now < end_at records

Campaign.in_time(super_user)
# => SELECT test_start_at <= now < test_end_at records
campaign = Campaign.create(start_at: 1.hour.ago, end_at: 1.hour.since)
campaign.in_time? # => true

License

The gem is available as open source under the terms of the MIT License.