Sha256: a898e80807ffc9ad115217bdc9d040e88af2c4110bbd392d232c3b33b0b7d89d

Contents?: true

Size: 404 Bytes

Versions: 15

Compression:

Stored size: 404 Bytes

Contents

module EmphaticInvalids::Renderer
	
	def emphasize_invalids(resource, format)
		# flash[:error] = error_message(resource) #TODO may want to make this an option
		format.js { render json: resource.errors, status: :unprocessable_entity }
  end

  private

  def error_message(resource)
    "Unable to #{action_name} #{resource.class.to_s.humanize}: #{ resource.errors.full_messages.join(', ') }"
  end

end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
emphatic_invalids-2.1.0 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-2.0.2 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-2.0.1 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-1.0.7 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-1.0.6 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-1.0.5 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-1.0.4 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-1.0.3 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-1.0.2 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-1.0.1 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-1.0.0 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-0.1.2 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-0.0.1 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-0.1.1 app/controllers/concerns/emphatic_invalids/renderer.rb
emphatic_invalids-0.1.0 app/controllers/concerns/emphatic_invalids/renderer.rb