On Nov 3, 6:41 pm, Sijo Kg <[EMAIL PROTECTED]> wrote:
> Hi
> Thanks for the reply.May I ask one more question? As Daniel Bush said
> this isn't a test fixture but just a file that is being used to set
> default values..So my question normally in which directory I can store
> this yml file whether inside models or view or anywhere?
>
I can't see the reason for using yaml like this - but I guess you have
your reasons.
Since you're set on having your controller load up a yaml file every
time it's accessed then I'd probably stick it in db/ somewhere. As
Fred says, you could put it anywhere.
You could lazy load it to save hitting the file system every time:
class YourModel < ActiveRecord::Base
def YourModel.default_values
@@default_values ||= YAML.load_file(RAILS_ROOT+'/db/
get_value.yml')
end
end
--
Daniel Bush
--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---