There is a model
class PlaylistModel < ActiveRecord::Base
/* code */
end
And then in a controller action there is code like this
PlaylistController < ActionController::Base
def a_action
@item = Playlist.find(10)
@item[:visited] = true
end
end
However there is no visited attribute defined in PlaylistModel (or in the schema for the playlist table)! It looks like a new attribute is being dynamically added to the object. Is this what is going on and where is all this functionality defined / where can I read more about it.
Thanks for the help!
This is the attribute setter shortcut as explained here. It is pretty much equivalent to: