Hi,
I was reading source code of mattr_accessor and cattr_accessor in
ActiveSupport and found out that the method definitions are all most
identical. Except cattr_writer accepts a optional block.

I googled and read
http://stackoverflow.com/questions/2203800/difference-between-mattr-accessor-and-cattr-accessor-in-activesupport.
That guy had the same question as me, but no one answered the question
accurately.

Module is the superclass of Class, is there any possible that just
define mattr_accessor in Module and
alias_method cattr_accessor, mattr_accessor
in Class?
I think it's more DRY right?

Can anyone help me?
Thank you!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouprubyonrails-talk @
categoriesrubyonrails
postedSep 20, '11 at 1:17p
activeSep 20, '11 at 1:17p
posts1
users1
websiterubyonrails.org
irc#RubyOnRails

1 user in discussion

Linjian: 1 post

People

Translate

site design / logo © 2022 Grokbase