ruby - Rails Controller Inheritance vs. Concerns and Mixins -


i have lot of similar resources in rails application, , have dry'd code using controller inheritance. see there directory called concerns under controller folder, potentially write similar concerns (such archiving, activate/deactivate etc.) can write mixins too.

is there preferred approach dry controller code? there downside in using inheritance, or there advantages using other techniques?

is there preferred approach dry controller code?

in experience, depends on want code do. i've used concerns simple controller-independent methods, such before_action or something

i use inheritance if controller's methods able rely on super class or something. experience far has lead me use inherited_resources - dry way create controller inheritance


Comments

Popular posts from this blog

android - Get AccessToken using signpost OAuth without opening a browser (Two legged Oauth) -

org.mockito.exceptions.misusing.InvalidUseOfMatchersException: mockito -

google shop client API returns 400 bad request error while adding an item -