Find which alias method is called in rails model
- by Kashif Umair Liaqat
I am new to rails development. I have created some aliases to a method and I want to know that which alias is called.
I have this code.
alias_method :net_stock_quantity_equals :net_stock_quantity
alias_method :net_stock_quantity_gte :net_stock_quantity
alias_method :net_stock_quantity_lte :net_stock_quantity
alias_method :net_stock_quantity_gt :net_stock_quantity
alias_method :net_stock_quantity_lt :net_stock_quantity
def net_stock_quantity
#some code here
end
I want to know that user has called which alias. Like if user calls net_stock_quantity_equals then I should know that the user has called net_stock_quantity_equals not net_stock_quantity.
Any help would be appreciated.