No fred

its not something like that this 2 types of array are total different it 
seems like that

becuase if you write

@users = User.find(:all)

then in view file you can directly use that array with each loop

@users.each do |c|
  c.title
end

but in my case

in view file i write same code like for @users but I am getting errr 
like

undefined title

when I use this array

[#,#] [active record array ] it works in view file

but after modifying this array with
[{zip=>'d',{po => 'd'}}]

then we can't use that directly in view it should some thing i have to 
write in file file liek

@users.each  do |c|
c.title it will not work
end

instead of that i have to write @users[0].title

got it ? any solution ?

Frederick Cheung wrote:
> On Feb 21, 11:11�am, Cyrus Dev <rails-mailing-l...@andreas-s.net>
> wrote:
>> thanks fred
>>
>> but in o/p
>>
>> when we use find method and print that object �it shows like that
>>
>> [#, #, #, #]
> 
> That's probably because of exactly what I said. the default to_s/
> inspect produces output like #<ClassName: ...> but that's not legal
> html so it displays as just #. If you want something useful to be
> displayed that's up to you, eg <%= records.collect {|r| r.name}.join
> (', ') %> (assuming what you wanted to display was the name attribute
> of the records. If you want to display all the attributes you could
> probably just call inspect on the attributes property of each of  your
> records.
> 
> Fred

-- 
Posted via http://www.ruby-forum.com/.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to