Hello, I was going through screencast #3, and got totally lost when ActiveRecord::Naming came out.
I don’t seem to understand what they exactly do and how they work.
Does anyone know where I can find good documentations with detailed explanation about those modules?
Matt extends ActiveModel::Naming so that its includes method so that rails can figure out what the name of the partial should be when attempting to render the object(s):
<%= render @model %>
Here is the docs on it: http://api.rubyonrails.org/classes/ActiveModel/Naming.html#method-c-route_key
ActiveSupport::Concern does seem a little more magical though. In this case it just allow us to clean up our model a little by grouping logic into a modules. Here the docs on its usage http://api.rubyonrails.org/classes/ActiveSupport/Concern.html
Thanks for the help erikguzman,
As I am going through those documents, I was able to find another module that works.
Instead of ActiveModel::Naming, I was able to get it working by including ActiveModel::Conversion.
I guess this is just another way of doing it. Am I right? or is this a big mistake?
I personally dont see any downside to using ActiveModel::Conversion, it gets the job. I actually used when I couldnt remember ActiveModel::Naming and found ActiveModel::Conversion when googling the solution.