On Sat, Feb 1, 2014 at 10:22 PM, Bizt <martyn.biz@gmail.com> wrote:
> I've been trying to set default URL parameters in the controller, which will
> also be used within the view.
> ... so I was wondering what the best practise is for handling this.
Personally, I'd say "best practice" is "don't do that" :-)
Instead of passing raw params to a view, build your model object
(or a service object) with them and pass that in. And if you need
defaults for missing attributes specified, the model/s.o. would be
a better place for them.
FWIW,
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/CACmC4yA3wzegOGHJ8_bKchdpqVXEb6wCAkp9W382G%3DLb%2BmzCQQ%40mail.gmail.com.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment