简体   繁体   中英

Recommended way to find a record in rails

I can see that the find method is now deprecated in rails. So what is the recommended way now?

Room.find(params[:id]

Even though Room.find_by_id(params[:id]) works just want to know the recommended way

SomeModel.find(id) is not deprecated.

Deprecated is the old pre-rails-3 behavior of it:

SomeModel.find(:all, :conditions => { :approved => true })

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM