Ruby on Rails Sunday, February 2, 2014

On Sunday, February 2, 2014 2:10:10 PM UTC, Colin Law wrote:
> On 2 February 2014 13:57, Frederick Cheung <frederick.cheung@gmail.com> wrote:
>
> > ...
>
> > You could update params in place , ie params.merge!(...).
>
>
>
> Would that not use the value from defaults if it was already present in params?
>

I was assuming this was after checking that params didn't have the values in question, although if not you could use reverse_merge!

Fred


>
>
> >
>
> > Personally I wouldn't do this. I'd be more likely to have a controller method called something like get_date_range that would get the dates from params that would do things like parse the strings into actual dates and/or replace missing params with defaults.
>
>
>
> +1
>
>
>
> Colin

--
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/581a9dc1-482c-4adb-8291-a8b1ff6a650c%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment