Quantcast
Channel: Active questions tagged redis+ruby-on-rails - Stack Overflow
Viewing all articles
Browse latest Browse all 873

validation not working for class wrapped in module in rails

$
0
0

I m trying to validate attr_accessor attributes but validation is not working. I have little experience but tried some way to do please help me out to resolve this problem.below is my code:controller:

def update_config    if permitted_params[:integrations_maddenco_config][:active] == "active"      Redis.current.set("maddenco:#{@tenant.id}",         {          tenant_id: @tenant.id,          tenant_name: @tenant.name,          store_number: permitted_params[:integrations_maddenco_config][:store_number],          dealer_number: permitted_params[:integrations_maddenco_config][:dealer_number],          cash_customer_number: permitted_params[:integrations_maddenco_config][:cash_customer_number],          version: permitted_params[:integrations_maddenco_config][:version],          auto_complete: permitted_params[:integrations_maddenco_config][:auto_complete],          wo_validation: permitted_params[:integrations_maddenco_config][:wo_validation],          inventory_check_enabled: permitted_params[:integrations_maddenco_config][:inventory_check_enabled],          fleets_allowed: permitted_params[:integrations_maddenco_config][:fleets_allowed]        }.to_json      )    else      Redis.current.del("maddenco:#{@tenant.id}")    end    render 'integrations/update_config'  end

model class:

module Integrations  class MaddencoConfig    include ActiveModel::Model    include ActiveModel::Validations    attr_accessor :store_number, :dealer_number, :cash_customer_number, :active, :version, :auto_complete, :wo_validation, :fleets_allowed    validates :store_number, presence: true    validates :dealer_number, presence: true    validates :cash_customer_number, presence: true    validates :active, presence: true    validates :version, presence: true  endend

Viewing all articles
Browse latest Browse all 873

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>