I'm trying to run a simple fetch using ActiveRecord and I'm confused by the result. This is the code I'm trying to run
c = Child.where("name LIKE ?", "%John D%")
I have a Child model and a corresponding table in my database. There is a record for "John Doe" in the database that outputs as being found in the rails console. However, when I execute
c.name
It outputs
=> "Child"
instead of
=> "John Doe"
If I run
c = Child.find_by_name("John Doe")
everything works fine. I'm sure there is an obvious solution here, but I just can't seem to figure it out.