[Rails] find_by_sql - ActiveRecord - Help please.
I am new to the language and trying to add a couple of simple tests on
user input, followed by a DB query, then using the returned values
(where the problem lies)
I first run a find_by_sql similar to this
@my_names = modelname.find_by_sql
I then check to see if NO returns via
if @my_names.size == 0
==================
My question is, how do I access the values that are now in the array. I
seem to be able to set session variables by way of
session[:whatever] = @my_names[0].column_name
etc..
but am unable to perform a if construct that looks like
if @my_names[0].column_name == "TEST VALUE"
I keep getting an undefined method error when I try to run the code.
Thanks very much in advance for any assistance with this.
--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home