Bean Validation Framework

This framework implemented get rid of validate bean object using if-else condition and easy to integrate custom validators. - This is developed using Java 1.5 and no other library is required. - Used Generics,Reflection and Annotation in implementation. - Light weight Annotation base bean validation with runtime plugable custom validators.No need to register custom validator … Continue reading Bean Validation Framework

Extend enumerable to add method collect_with_index

module Enumerable def collect_with_index(i=0) collect{|elm| yield(elm, i+=1)} end alias map_with_index collect_with_indexend #Example use : ree-1.8.7-2010.01 > ['ruby', 'rails', 'sandip'].map_with_index{ |w,i| [w, i] } #=> [["ruby", 1], ["rails", 2], ["sandip", 3]] ree-1.8.7-2010.01 > ['ruby', 'rails', 'sandip'].collect_with_index{ |w,i| [w, i] } #=> [["ruby", 1], ["rails", 2], ["sandip", 3]] #By default index starts from zero to specify custom … Continue reading Extend enumerable to add method collect_with_index

Fix/Solution for NoMethodError? (undefined method `controller_name’ for nil:NilClass)

This error appears when same action gets called twice. There might be chances to have controller with same name twice inside app as well as pluginsIn my case the error appeared while migrating from rails 2.1 to 2.3.Application was having application.rb and application_controller.rbFiles deleted:trunk/app/controllers/application.rbAnd that solved problem !