mirror of
https://github.com/internetee/registry.git
synced 2025-07-24 03:30:33 +02:00
Add support for PG interval field
This commit is contained in:
parent
f22fc2659f
commit
838522b81a
8 changed files with 47 additions and 43 deletions
|
@ -40,7 +40,6 @@ module Admin
|
|||
|
||||
def create
|
||||
@price = ::Billing::Price.new(price_params)
|
||||
|
||||
if @price.save
|
||||
flash[:notice] = t('.created')
|
||||
redirect_to_index
|
||||
|
@ -50,7 +49,7 @@ module Admin
|
|||
end
|
||||
|
||||
def update
|
||||
if @price.update_attributes(price_params)
|
||||
if @price.update(price_params.compact_blank)
|
||||
flash[:notice] = t('.updated')
|
||||
redirect_to_index
|
||||
else
|
||||
|
@ -81,7 +80,9 @@ module Admin
|
|||
valid_to
|
||||
]
|
||||
|
||||
params.require(:price).permit(*allowed_params)
|
||||
allowed = params.require(:price).permit(*allowed_params)
|
||||
allowed[:duration] = ActiveSupport::Duration.build(allowed[:duration].to_i) if allowed[:duration]
|
||||
allowed
|
||||
end
|
||||
|
||||
def search_params
|
||||
|
@ -104,8 +105,7 @@ module Admin
|
|||
end
|
||||
|
||||
def durations
|
||||
durations = ::Billing::Price::durations
|
||||
durations.collect { |duration| [duration.sub('mon', 'month'), duration] }
|
||||
::Billing::Price::durations
|
||||
end
|
||||
|
||||
def statuses
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue