Forum: Ruby on Rails retrieving a data according to a given name

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Ishara G. (Guest)
on 2008-11-01 06:48
(Received via mailing list)
i have a table called reply which has id, name, addressi 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
mrbless (Guest)
on 2008-11-01 06:56
(Received via mailing list)
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).

On Nov 1, 9:47 am, "Ishara G." <removed_email_address@domain.invalid>
Ishara G. (Guest)
on 2008-11-01 06:57
(Received via mailing list)
oh thanx,it was a mistake,il try ur code

2008/11/1 mrbless <removed_email_address@domain.invalid>
Ishara G. (Guest)
on 2008-11-01 07:01
(Received via mailing list)
i tried it but iv got this errorNoMethodError in Agent
replyController#show

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


2008/11/1 Ishara G. <removed_email_address@domain.invalid>
Ishara G. (Guest)
on 2008-11-01 07:05
(Received via mailing list)
it was success,thankx

2008/11/1 Ishara G. <removed_email_address@domain.invalid>
mrbless (Guest)
on 2008-11-01 07:09
(Received via mailing list)
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.

On Nov 1, 10:04 am, "Ishara G." <removed_email_address@domain.invalid>
This topic is locked and can not be replied to.