Thursday, November 21, 2013

Re: [Rails] add class variable to all models using concern to extend AR?

On Nov 20, 2013, at 9:34 AM, Matt Yoder <lists@ruby-forum.com> wrote:

> Hi All,
>
> I've previously used concerns to extend my models without problems. I'm
> now trying to extend all my models in one swell-foop by extending AR
> with a concern. In brief, I want to add a class variable to each
> individual model using a concern that extends AR. Specifically - I
> need to find the where (and how) to define a class variable scoped to a
> specific model in my AR extending concern. Is this sane? Possible?
>
> Thanks,
>
> Matt
>
> —

Maybe? This seems like requiring the children to know a specific implementation detail of a parent class via the concern mixin. Instead, I'd provide accessor methods.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/54E853DE-5F8D-492F-9D9A-9041393128D4%40gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate