Skip to content

Commit

Permalink
#243 some changes were made in the params of 'notifications' and 'que…
Browse files Browse the repository at this point in the history
…ries' screens, because of rails 5 incompatibilities
  • Loading branch information
Carlos-Eduardo-Cabral-da-Cunha committed Feb 8, 2018
1 parent a64dd34 commit 5fe03f3
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
7 changes: 7 additions & 0 deletions app/controllers/notifications_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ class NotificationsController < ApplicationController
authorize_resource
skip_authorization_check :only => [:notify]
skip_before_action :authenticate_user!, :only => :notify
before_action :permit_notification_params

def permit_notification_params
params[:notification_params].permit! unless params[:notification_params].nil?
end

active_scaffold :"notification" do |config|

Expand Down Expand Up @@ -62,6 +67,7 @@ def execute_now
process_action_link_action do |notification|

notification_params = params[:notification_params]
notification_params = notification_params.to_unsafe_h if notification_params.is_a?(ActionController::Parameters)
query_date = Date.strptime(params[:data_consulta], "%Y-%m-%d") unless params[:data_consulta].nil?
query_date ||= notification.query_date.to_date
Notifier.send_emails(notification.execute(override_params: notification_params))
Expand All @@ -76,6 +82,7 @@ def simulate


notification_params = params[:notification_params]
notification_params = notification_params.to_unsafe_h if notification_params.is_a?(ActionController::Parameters)
if notification_params

result = @notification.execute(skip_update: true, override_params: notification_params)
Expand Down
1 change: 1 addition & 0 deletions app/controllers/queries_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ def execute

private
def get_simulation_params
return params[:query_params].to_unsafe_h if params[:query_params].is_a?(ActionController::Parameters)
params[:query_params] || {}
end

Expand Down
1 change: 0 additions & 1 deletion app/models/query.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class Query < ApplicationRecord
validates_associated :params

def map_params(simulation_params = {})
simulation_params = simulation_params.to_unsafe_h unless simulation_params.is_a?(Hash)
simulation_params = simulation_params.symbolize_keys
current_params = {}
self.params.each do |param|
Expand Down

0 comments on commit 5fe03f3

Please sign in to comment.