Dynamic find methods Vs conditional statements in rails

Posted by piemesons on Stack Overflow See other posts from Stack Overflow or by piemesons
Published on 2010-06-18T11:48:33Z Indexed on 2010/06/18 11:53 UTC
Read the original article Hit count: 366

Filed under:

Hello

 Student.find_all_by_name_and_status(‘mohit’, 1)

As this will create a exception 'No method exception' first then it will be handled by dynamic Method handler and this will not

 Student.find(:all, :conditions => [‘name = ? and status = ?’ ‘mohit’, 1])

Does

 Student.find(1)

Will generate method missing exception and will it prevent SQL injection?

© Stack Overflow or respective owner

Related posts about ruby-on-rails