Ruby on Rails Wednesday, November 24, 2010

John N. wrote in post #963524:
>
> def grab_settings
> @set = Setting.first

@set.company_name ||= 'My Company'

> end
>

Well, you could always read the Settings, then impose your own defaults
inside the grab_settings method. Any code outside that method has no
idea whether the value was read, or set by you. It just knows that the
value is filled.

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment