On Feb 21, 12:06 pm, Cyrus Dev <rails-mailing-l...@andreas-s.net>
wrote:
>
> 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

Well you've changed your array of active record objects into a hash or
an array of hashes - you just need to access that appropriately
(exactly how will depend on what you did to your original array).

Fred

>
> @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 viahttp://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