Rails put validation in a module mixin?

module Validations extend ActiveSupport::Concern included do validates :name, :length => { :minimum => 2 }, :presence => true, :uniqueness => true validates :name_seo, :length => { :minimum => 2 }, :presence => true, :uniqueness => true end end The validates macro must be evaluated in the context of the includer, not of the module (like … Read more

remove red rectangle around combobox

Use this to modify the Validation.ErrorTemplate <ControlTemplate x:Key=”ComboBoxValidationErrorTemplate”> <DockPanel> <Border BorderBrush=”Blue” BorderThickness=”4″> <AdornedElementPlaceholder /> </Border> </DockPanel> </ControlTemplate> And then use it in your ComboBox like <ComboBox Validation.ErrorTemplate=”{StaticResource ComboBoxValidationErrorTemplate}” …> To have no indication of a Validation Error, remove the DockPanel, set Visibility to Collapsed or any other way you like. Almost forgot, probably the easiest … Read more

jQuery UI Dialog validation without using tags

In case someone else comes across this, the jQuery-UI dialog does not append to the form, it appends just before </body>, so the elements to validate are outside the <form></form> section: To resolve this, just direct the dialog to move itself inside the form when you create it, like this: $(“#mydiv”).dialog(“open”).parent().appendTo(jQuery(“form:first”));

Joi object validation: How to validate values with unknown key names?

Try this. It’ll basically accept any key within an object campaign and the value must validate against Joi.date().iso() campaign: Joi.object().pattern(/^/, Joi.date().iso()) This however will match any key. You can restrict this by padding out the regex a little. e.g. only word characters between 2 and 25 chars campaign: Joi.object().pattern(/\w{2,25}/, Joi.date().iso()) UPDATE Regarding the example in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)