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
<?xml version="1.0" encoding="UTF-8"?> | |
<!-- | |
Licensed to the Apache Software Foundation (ASF) under one or more | |
contributor license agreements. See the NOTICE file distributed with | |
this work for additional information regarding copyright ownership. | |
The ASF licenses this file to You under the Apache License, Version 2.0 | |
(the "License"); you may not use this file except in compliance with | |
the License. You may obtain a copy of the License at | |
http://www.apache.org/licenses/LICENSE-2.0 |
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
BASIC OI (CUCUMBER) KIMCHI | |
-------------------------------------------------------------------------- | |
Oi (cucumber) kimchi is a delicious, refreshing variation on the | |
traditional Korean kimchi recipe. | |
This particular recipe is a modified version of the recipe posted by Dr. | |
Ben Kim, at http://www.drbenkim.com/how-to-make-cucumber-kim-chi.htm. | |
-------------------------------------------------------------------------- |
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
$ gem install bin | |
Successfully installed bson-1.4.0 | |
Successfully installed mongo-1.3.1 | |
Successfully installed multi_json-1.0.3 | |
Successfully installed activesupport-3.1.0 | |
Successfully installed bin-0.7.0 | |
5 gems installed | |
$ gem dependency bin | |
Gem bin-0.7.0 | |
activesupport (~> 3.1.0, runtime) |
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
module AllIfAny | |
def validates_all_if_any(fields, options={}) | |
fields = [fields].flatten | |
all_fields = fields.dup | |
validates_each(fields, options) do |record, attr_name, value| | |
if !(all_fields.find_all{|f| !record.send(f).to_s.empty?}.empty?) | |
record.errors.add(attr_name, (options[:message] || 'is invalid')) if value.to_s.empty? | |
end | |
end |
NewerOlder