abhsss96
abhsss96

Reputation: 353

How alias_method work in ruby. How can I use it to achieve DRY?

I saw this line of code in an application but was unable to find the method get_accounts in whole application.

  alias_method :get_accounts, :get_list_of_records

Upvotes: 0

Views: 48

Answers (1)

Nikita Misharin
Nikita Misharin

Reputation: 2030

get_accounts is an alias method for get_list_of_records. Nothing wrong with the fact that it had never been used (except for the fact that it redundant and confusing). Probably, everywhere in code was used and original name of the method get_list_of_records. As it's not used anywhere, you can safely delete this line to avoid any further confusion.

Upvotes: 2

Related Questions