![]() | reflection with Ruby |
|
29 Dec 2011, 17:23
Mahesh Dsouza (2 posts) |
I had a question on Reflection. Assuming that I have an ActiveRecord object (Post). I know as an object we can do Post.find_by , Post.where . Can we do something like |
|
01 Jan 2012, 03:00
Dave Thomas (231 posts) |
What is the class of “s”? That class doesn’t support the #where method. |
|
04 Jan 2012, 01:02
Mahesh Dsouza (2 posts) |
Actually I should have elaborated more. Lets say I have a page which takes the name of a Model. Example -> Post . On submit I need to get all the columns associated with the Model object. So I need to somehow dynamically find the value of “Post” which is a string and dynamically translate it to a Model object. I am from a java background and new to ruby. In java you can use reflection to create such dynamic objects passing string. I tried using |
|
01 Feb 2012, 14:06
Dave Thomas (231 posts) |
If that’s the actual error message, then it;s simply that “columns” was misspelled. |
| You must be logged in to comment |

