Hy, I have some table in my DB like following: *Post(id, title, content, created_at, updated_at)*
First question, what type ActiveRecord returns? For example if i do something like: @posts = Post.all, through debugger i can see: #<ActiveRecord::Relation *[*#<Post id: 1, title: "My first post", content: "Zdravo, ovo je moj prvi post.", created_at: "2013-10-17 10:06:55", updated_at: "2013-10-17 10:06:55">, #<Post id: 3, title: "My second post", content: "Zdravo, ovo je moj drugi post.", created_at: "2013-10-17 11:11:29", updated_at: "2013-10-17 11:11:29">, #<Post id: 18, title: "My third post", content: "Dobar dan, ovo je moj treci post.", created_at: "2013-10-18 11:31:07",updated_at: "2013-10-18 11:31:07">*]*> So this is array of hashes? or array of Post objects? Second if i do something like: @post = Post.first (this will return Post object?) then through debugger i can do: @post.id Here, i'm guessing, because each model is inherit from ActiveRecord::Base, ActiveRecord will create accessor for each column in table that represent model? Because that i can write something like @post.id or @post.id = 100. So internally ActiveRecord does something like attr_accessor :id for Post model? (and for every other column in posts table, attr_accesor: title, etc) -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/971cd771-07cf-4796-a530-8300ddbe8feb%40googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.