Assuming that your yaml file is in test/fixtures directory. Do something like this #say ticket is an object going to be created yml=File.open("#{RAILS_ROOT}/test/fixture/get_value.yml){|ym| YAML::load(ym) } ticket.service_desk_status_id=yml["sd"] ["service_desk_status_id"].to_i #assuming it to be integer ticket.service_desk_category_id=yml["sd"] ["service_desk_category_id"].to_i ticket.service_desk_sub_category_id=yml["sd"] ["service_desk_sub_category_id"].to_i
On Nov 3, 10:49 am, Sijo Kg <[EMAIL PROTECTED]> wrote: > Hi > I have a controller open_service_desk and create action .Inside the > action when create a ticket I need to get default values of some fields > from a yml file say get_value.yml In that file I am storing values > like ..(I dont know whether this the right way)..Why I am storing this > is these are mandatory fields and I have set validation also these are > not get from the user directly. > > sd: > service_desk_status_id: 1 > service_desk_category_id: 1 > service_desk_sub_category_id: 1 > > How can I read this in the action? > > Thanks in advance > Sijo > -- > Posted viahttp://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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---