This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def repair_empty_param_associations | |
params.keys.each do |key| | |
repair_nested_params(params, key, params[key]) | |
end | |
end | |
private | |
def repair_nested_params(current_params, key, value) | |
if key =~ /^(.*)_attributes$/ && value.nil? |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
_.extend Backbone.Validation.callbacks, | |
valid: (view, attr, selector) -> | |
control = view.$('[' + selector + '=' + attr + ']') | |
group = control.parents(".control-group") | |
# If the input field is still in an invalid state, don't remove error | |
if view.model.preValidate(attr, control.val()) | |
return | |
group.removeClass("error") |