...
/Controllers Should Convert Parameters to Richer Types
Controllers Should Convert Parameters to Richer Types
Learn about why controllers should convert parameters to richer types in our Rails application.
We'll cover the following...
Active Record handling
As the invokers of business logic, controllers are responsible for converting parameters into properly typed objects:
def show
@widget = Widget.find(params[:id])
end
This code takes a string containing an identifier that we assume identifies a widget and looks it up in the database, passing the actual widget to ...