Skip to content

Commit

Permalink
added fix for validation spec error
Browse files Browse the repository at this point in the history
  • Loading branch information
edwin-jebaraj committed Nov 21, 2024
1 parent 2fac6e4 commit be44e63
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/controllers/frameworks/frameworks_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,9 @@ def create

def update
@framework = Frameworks::Framework.find(params[:id])
@framework.assign_attributes(framework_params)

if @framework.update(framework_params)
if @framework.save(context: :updation_form)
redirect_to frameworks_framework_path(@framework)
else
render :edit
Expand Down
2 changes: 1 addition & 1 deletion app/models/frameworks/framework.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class Frameworks::Framework < ApplicationRecord
after_add: :log_framework_category_added,
after_remove: :log_framework_category_removed

validates :name, :url, :provider_id, :proc_ops_lead_id, :provider_end_date, presence: true, on: %i[creation_form update]
validates :name, :url, :provider_id, :proc_ops_lead_id, :provider_end_date, presence: true, on: %i[creation_form updation_form]
validate :unique_name_and_provider, if: -> { name.present? }, on: :creation_form

def unique_name_and_provider
Expand Down

0 comments on commit be44e63

Please sign in to comment.