Calling model methods even when the param is a not set

Subscribe to Calling model methods even when the param is a not set 1 post, 1 voice

 
Avatar clem_c_rock 17 posts

Hello, I’m setting a checkbox values based on the return of a model field method. The way the method is set up – it only gets called when a checkbox value is set.

Here’s the model code:

[code] def within=(new_within) @within = new_within "1" || new_within true || new_within 'true' || new_within ‘on’ end [/code]

I would like that method to be called even when the checkbox is not set.

Thanks for any help anyone can provide.

Clem C