ActiveRecord::Naming and ActiveSupport::Concern

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?

Thanks,

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: ActiveModel::Naming

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 ActiveSupport::Concern

1 Like

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?

Thanks,

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. :smile:

Thank you erikguzman!