How do you check URL parameters in Ruby on Rail, which are not Model Attributes (such as Pages, Pay_Pages, Sort Mode) ? In the controller or model?
For example, when a more complex database is querying, will you check the parameters in the controller and set the default and then for example I adjust the parameters in the controller. Good practice that models declare their interface and it depends on controllers to control them Is the way In this way you have a clear fragmentation of your layers. There are helpers to help you with ideas that come as part of the ActionPack's ActionView you can see the MyModel.search (page, per page , Order, sort-mode, query) , or will you set the recognition inside the model and just the non-rearranged parameter
MyModel.search (params) ? P> And how do you report that parameter back to the view? For example, use a serial parameter as a result of a small arrow on the sequence for the sort direction. Do you check and clear the paramous hash and get the data in the view from the parameter, or do you use an example variable for yourself?
class ApplicationController & lt; ActionController :: Base before_filter: sanitise_params protected def sanitise_params # tidy up # set default end and end
app / assistants
Comments
Post a Comment