6 Replies Latest reply on Oct 20, 2014 9:56 AM by BHAKTA RANJAN SATAPATHY

    Write operation in Rhodes Framework

    Subhajit Choudhury

      Hi,

       

      I am facing 2 issues:

      1) Create a file in the project directory through code in controller

      2) Cannot write into an existing JSON file.

       

      For issue 2), I have created a code to write into an existing JSON file, but an error is thrown: App error: invalid access mode test.json

      Following is the snippet:

          tempHash = {

              "key_a" => "val_a",

              "key_b" => "val_b"

          }

          File.open(Rho::RhoApplication::get_model_path('app','JsonTest'), 'test.json','w') do |f|

            f.write(tempHash.to_json)

       

      What I can guess is that 'w' is not working in Rhodes.

      Much appreciated if anyone can work me out from these 2 issues

       

      Subhajit