Find which alias method is called in rails model

Posted by Kashif Umair Liaqat on Stack Overflow See other posts from Stack Overflow or by Kashif Umair Liaqat
Published on 2012-09-05T15:17:46Z Indexed on 2012/09/07 9:38 UTC
Read the original article Hit count: 460

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.

© Stack Overflow or respective owner

Related posts about ruby-on-rails

Related posts about ruby