Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ApplicationController < ActionController::Base
- def method_missing(meth, *args, &block)
- if var_name = meth.to_s.match(/^get_(\S*)/)
- if params["#{var_name[1]}_id".to_sym]
- instance_variable_set("@#{var_name[1]}", Object.const_get(var_name[1].camelize).find(params["#{var_name[1]}_id".to_sym]))
- end
- else
- super
- end
- end
- end
Add Comment
Please, Sign In to add comment