brent brent wrote in post #1033872:
> Folks im new to rails and was wondering how i would access these
> elements from my view
>
>
> in my controller i have
> @data = Editpatient.find(:all, :conditions => ["patient_id = ?",
> params[:patients]] )
>
> and in the view i have <%= @data %>
>
> this displays all the data but i only want one field. This is what is
> displayed.
>
> [#<Editpatient id: 27, patient_id: 14, provider_id: 11, weight_gained:
> 123, weight_lost: nil, created_at: "2011-11-26 21:07:13", updated_at:
> "2011-11-26 21:07:13", patient_name: nil, provider_name: nil>]
>
> the only field i want is patient_id
>
> ive tried this in the view    @data[:patient_id]     and i get
> can't convert Symbol into Integer
>
> any help is appreciated thanks

Thanks for the help Hassan
This is just a test app that im using to get the hang of ruby and rails. 
Your method worked perfectly.

-- 
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