Rails:
Rails Style Guide : https://github.com/bbatsov/rails-style-guide
Ruby Style Guide : https://github.com/bbatsov/ruby-style-guide
Rails Best Practises : http://rails-bestpractices.com
There used to be a "Complete Guide to Rails Plugins (2 part article) :" but site is gone now http://nubyonrails.com/articles/the-complete-guide-to-rails-plugins-part-i
Ruby:
Ruby From Other Languages : https://www.ruby-lang.org/en/documentation/ruby-from-other-languages
Ruby Language Tips, Tricks, Dos and Don'ts and Gotchas : http://www.zenspider.com/Languages/Ruby/QuickRef.html
Another way to understand mysterious workings of a framework is to understand the principles and implementation details on which it is built. Internals often dictate why something must be just-so. "Rebuilding Rails" is a book which claims to give this X-Ray vision into Rails internals. It's available for a price though. Might be cheaper to just browse the source-code with source-insight or some Rails IDE instead.
The book 'The Rails Way' is a good insight into different aspects of WHY Rails is the way it is.
Chapter 18 onwards of the book "Agile Web Development with Rails" talks about Rails module-by-module i.e. "what each module does, how to extend or even replace the module and why you'd even want to do so".
Many of the "magic"/conventions arise by using Ruby Meta-programming features you might find Pragmatic Programmers book Meta-programming Ruby - Program like the Ruby Pros useful.
Though not accessible for a novice programmer more intermediate/advanced programmers can browse the Rails source code at Github Rails Repository