4 ms·
RoR has always been rather impenetrable to me, more-so than some late-stage/terminal Node-based projects. I recently wanted to remove IP logging in a RoR applic
by zaarn 8y ago
RoR has always been rather impenetrable to me, more-so than some late-stage/terminal Node-based projects. I recently wanted to remove IP logging in a RoR application but I was unable to find the relevant code anywhere, the only hits that grep spat out where the migrations and I couldn't figure out how to rip all that out. In the end a project developer pointed me to the correct file and I had to change a single line (according to their guidance, I had no idea this line even related to IP logging) which fixed it.
I don't think that this is something I want in my project, I think I'll keep with .NET and Go even if I don't get the "competitive batteries-included all-in-one framework" packaged in.
(Well and there is always the issue that most larger RoR projects like to pull a lot of resources. And seriously the biggest three VMs on my host are an RoR application and the SQL Server which runs both MySQL and PG and the only node.js app I run)
- petepete 8y ago> I recently wanted to remove IP logging in a RoR application but I was unable to find the relevant code anywhere, the only hits that grep spat out where the migrations and I couldn't figure out how to rip all that out. Usually you'd just create a custom logger[0] and tell Rails to use it[1] [0] https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.html https://ruby-doc.org/stdlib-2.5.0/libdoc/logger/rdoc/Logger.... [1] https://guides.rubyonrails.org/configuring.html#rails-general-configuration https://guides.rubyonrails.org/configuring.html#rails-genera...
- zaarn 8y agoIt wasn't putting the IP in the log but in the database and along the username and session data, there is an open ticket about that behavior too. Since I'm in Europe/Germany, this kind of data storage would have been a no-go even before the GDPR.
- bshimmin 8y agoIt sounds like you had to remove the Trackable module from Devise - which would indeed be one line of code to change in a Rails app, but quite hard to figure out if you didn't know. However, Devise is a third party gem which is often used with Rails but isn't actually a part of Rails, so can you really blame Rails for this? (And, unless it's for a very specific string, is grepping a codebase that you have no understanding of ever really a successful strategy?)
- zaarn 8y agoI blame the coding practises of the rails devs, not the gem itself. Grepping can be a successful strategy, esp. when you know what you are looking for and you can search the database column in the code
- bshimmin 8y agoI can't in all honesty understand why you wouldn't just Google "rails login current_sign_in_ip", the top three hits for which would probably all put you on the right track. I would say grepping through the code of third-party libraries would be something I'd do only in desperation when working in an unfamiliar codebase. But hey, each to their own!
- zaarn 8y agoOh, don't worry, I did Google that. Just didn't work because none of the results helped or put me on the right track or were just plain too confused to be understandable.
- ryanbrunner 8y agoRails is definitely a framework where it requires some knowledge of the framework to really be effective. The adherence to convention over configuration means that a whole lot of things are pretty opaque, and if you don't know the conventions it can seem impossible to know how something is happening (logging is a great example). Javascript is the opposite extreme - nothing is assumed and everything is explicit, so there's a clear and obvious spot (at least in well architected programs) where something is configured. When you know the framework well, however, I find one of Rails' strengths is that it massively decreases the time it takes to get familiar with a codebase. There's never a question of how a developer has organized their code, or configured logging (to take your example), because it's not a choice that Rails gives you - every project is going to work the same.