This helped me understand better something I already thought I understood.
@repoles5 ай бұрын
Thank you very much! I always watch your videos. They help me a lot!
@IanBradbury5 ай бұрын
Always super helpful videos. Thanks.
@Webcrunch5 ай бұрын
Happy to help!
@haroldpepete5 ай бұрын
i have personally used concern in poymorphic associations and when i want some special behavior in several model, and i use module to declaree functions that i need to use in my controllers or services, working with component in rails i make a metaproming module to declare instance variables witth a default values making a merge of all parameters the component can recieve
@MarceloAlarcon-tx6qe5 ай бұрын
I think we can also use concerns in a controller to separate all methods that are not a direct action of the controller. For example a method to generate a cookie would go in the concern, while the action that uses it would obviously be in the controller. This is necessary because we can't use helpers in controllers. What do you think about this practice?
@formigarafa5 ай бұрын
You don't really need that include in the controller if you are using the "static" method calls. You can think of include method pretty much as defining the methods in the module in the context of the class where it is being included. This won't apply for `def self.xyz` methods though. You can operate with the `def self.methods` in similar form using the extend method but the result affects the class not the instances (as include would). This rabbit hole goes a bit deeper, it is meta-programming all the way down. It would become a book on this comment.
@eotfofiw274815 күн бұрын
I am new to rails and was about to ask... With no including, and no extending going on here... Wouldn't this just be a require? I guess the include brings it into scope even if it's not actually including instance methods.
@ahmed_aboelleef5 ай бұрын
thanks for sharing What is the editor theme name ?