Rails: difference between :source => ?? and :class_name => ?? in models

They are conceptually the same, just need to be different for different uses.

:source is used (optionally) to define the associated model name when you’re using has_many through; :class_name is used (optionally) in a simple has many relationship. Both are needed only if Rails cannot figure out the class name on its own. See the documentation for has_many in the API here.

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)