Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Why are the dynamic finders being deprecated? Is it a speed/parsing thing? Or changing styles?


Changing styles is my guess; less a reliance on auto-generated magic. There is nothing wrong with this:

    find_all_by_user_id_and_conversation_id(params[:user_id], @conversation.id)
But this is equally (actually more) concise:

    where(user_id: params[:user_id], conversation_id: @conversation.id)
...and it builds on the composable scope system (derived from ARel).


I had that question too...I was thinking that it must have some effect on performance but I thought it would be pretty minuscule?


OT performance rumination: I've not run tests on Rails' performance in this capacity, but I've always thought that the runtime gymnastics to pluralize model names would be a big drag on Rails performance. I'm guessing something's cached, but I've never understood the 'opinion' that a class should be 'Person' and the table name should be 'people'.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: