April 3rd, 2015
(written by lawrence krubner, however indented passages are often quotes). You can contact lawrence at: email@example.com
When you start using ruby on rails, its ease of use makes it great to get you started. Everything works out of the box. You may be using Devise for authentication, Cancan for authorization and every time you need something that you believe Rails do not provide, you search google for a gem doing what you seek.
And joy is everywhere, your app works fine, you didn’t even need to write that much code to get where you are!
you need to change little things that are handled by the myriad of gems you use and you just don’t know where to start looking. Should you fork the gem? Then I’ll have to merge upstream changes. Maybe monkey patching? Updating the gems can break my monkey patch without notice…
It seems you are walking on eggs. You’re not sure what does what, and monkey patching is not simple anymore as you don’t know what implications a tiny change can have on your system. You feel trapped by all your previous choices.
You may be installing some gems for a reason: You just don’t know enough how rails work so many small features seems hard to implement when in reality, it isn’t. And it’s normal, it’s part of learning a new framework. The same would apply to any framework in any language. You have to try stuff before understanding them. And this post today is about understanding them.
If I say I’d need you to change a view, you probably would start looking at the controller, the views or the helpers and start making changes right away. However, if I’d ask you to implement or change something that has to do with:
You’d probably have to stop for a few seconds and scratch your head wondering where to start.
All the posts I could find about railtie explained pretty much the same thing and I wanted to know how to interact with ActionController & ActionView with railtie. Unfortunately, I couldn’t find much information about that. I thought it would be a good idea to put my findings into writing so I don’t forget them and it also might be useful for someone out there.