-
Nikita Vasilevsky authored
This commit changes bodies of methods generated by `alias_attribute` along with generating these methods lazily. Previously the body of the `alias_attribute :new_title, :title` was `def new_title; title; end`. This commit changes it to `def new_title; attribute("title"); end`. This allows for `alias_attribute` to be used to alias attributes named with a reserved names like `id`: ```ruby class Topic < ActiveRecord::Base self.primary_key = :title alias_attribute :id_value, :id end Topic.new.id_value # => 1 ```
Nikita Vasilevsky authoredThis commit changes bodies of methods generated by `alias_attribute` along with generating these methods lazily. Previously the body of the `alias_attribute :new_title, :title` was `def new_title; title; end`. This commit changes it to `def new_title; attribute("title"); end`. This allows for `alias_attribute` to be used to alias attributes named with a reserved names like `id`: ```ruby class Topic < ActiveRecord::Base self.primary_key = :title alias_attribute :id_value, :id end Topic.new.id_value # => 1 ```
Loading