# What do you use for modifying the class including a module?

**URL:** <https://metaruby.com/t/what-do-you-use-for-modifying-the-class-including-a-module/181>\
**Category:** Rails Forum\
**Tags:** rails\
**Created:** [June 24, 2015, 5:45am UTC](https://metaruby.com/t/what-do-you-use-for-modifying-the-class-including-a-module/181 "2015-06-24T05:45:09Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![PikachuEXE](https://metaruby.com/user_avatar/metaruby.com/pikachuexe/32/854_2.png) [@PikachuEXE](https://metaruby.com/u/PikachuEXE)\
**Post date:** [June 24, 2015, 5:45am UTC](https://metaruby.com/t/what-do-you-use-for-modifying-the-class-including-a-module/181/1 "2015-06-24T05:45:09Z")

</div>

There are several solutions that I know:

- [`#included`](http://ruby-doc.org/core-2.2.2/Module.html#method-i-included) plus [`#class_eval`](http://ruby-doc.org/core-2.2.2/Module.html#method-i-class_eval)
- [AS::Concern](http://api.rubyonrails.org/classes/ActiveSupport/Concern.html)  
-[`SuperModule`](https://www.airpair.com/ruby/posts/step-aside-activesupportconcern-supermodule-is-the-new-sheriff-in-town#CAeZ1KTtxAPgPIPa.16)

I am preferring the first one right now to avoid any “magic” & dependency on the huge “active\_support” (while writing gems).  
If I ever got the problem that: when A requiring B, it should also require C **before** B, I would have:

- D wrapping B
- D has `class_eval` to include C then B
- A will require D instead of B  
I haven’t had time to read the source of the 3rd solution, saw it on RubyFlow or RubyWeekly.

What do you use? Do you have other solutions missing here?

---

<div class="post-metadata">

**Author:** ![AstonJ](https://metaruby.com/user_avatar/metaruby.com/astonj/32/8_2.png) [@AstonJ](https://metaruby.com/u/AstonJ)\
**Post date:** [June 24, 2015, 10:48am UTC](https://metaruby.com/t/what-do-you-use-for-modifying-the-class-including-a-module/181/2 "2015-06-24T10:48:20Z")

</div>

AS::Concern now, as I try to stick to the Rails way when using Rails.

Hadn’t heard of SuperModule… will check it out tho!
