How to replace rails 3 Model.scoped by rails 4 Model.all -
i converting project rails 3 4.2. found scoped deprecated. me scoped confusing. current code in index controller below
@customers = customer.scoped @customers = customer.between(params['start'], params['end']) if (params['start'] && params['end'])
so how can remove customer.scoped above code still keep same functionality??
as other articles suggested use all
instead of scoped
. tried this
@customers = customer.all @customers = @customers.between(params['start'], params['end']) if (params['start'] && params['end'])
i not sure though if converted code okay or not.
have tried this
@customers = customer.where(nil)
instead of
@customers = customer.scoped
Comments
Post a Comment