retrieving a data according to a given name

i have a table called reply which has id, name, address

i wanna retrieve address when a given name, so can anyone

tell how can i do it.

i can retrieve data using modelname.find(anyid),but i can’t

do it for any name

ModelName.find_by_name('some_name'). I have a doubt with your table it should be replies rather than reply coz' table name are plural form of model name in ROR (if you stick with convention over configuration).

oh thanx,it was a mistake,il try ur code

i tried it but iv got this error

NoMethodError in Agent replyController#show

undefined method `find_by_name' for #<Class:0x3bf8210>

it was success,thankx

Why don't you try it out from your console. And if it work from there than you should have some problem in your controller. plz try it out from your console and let me know.