Hello All,
I am very new to Ruby on Rails and I have a quick question for you all, which is as follows:
I have this following line of code in an partial that renders itself on the posts/index view: Created By (User): <%= User.find(:all, :select => 'name', :conditions => ["id = ?", 1]) %> (I am hard-coding that '1' there)
Now, when I run the server; the above line of code displays just the '#' symbol.. nothing else (no name is displayed ): Created By (User): #
I have the following tables: User, Post & Comment. For your reference, I am also pasting here the contents of my 'User' table that I got from my console:
User.find(:all)
=> [#<User id: 1, name: "Ron", created_at: "2010-03-15 02:45:28", updated_at: "2010-03-15 02:45:28">, #<User id: 2, name: "David", created_at: "2010-03-15 21:13:22", updated_at: "2010-03-15 21:13:22">, #<User id: 3, name: "Tom", created_at: "2010-03-15 21:38:31", updated_at: "2010-03-15 21:38:31">, #<User id: 4, name: "John", created_at: "2010-03-15 21:38:43", updated_at: "2010-03-15 21:38:43">, #<User id: 5, name: "Harry", created_at: "2010-03-15 21:38:50", updated_at: "2010-03-15 21:38:50">, #<User id: 6, name: "Martin", created_at: "2010-03-15 21:38:57", updated_at: "2010-03-15 21:38:57">]
Can you please let me me know if I am missing something here or if I am doing anything wrong?