How to pass an argument when calling a view file?

后端 未结 4 684
深忆病人
深忆病人 2021-02-04 01:38

I wrote a webform using Sinatra and Haml that will be used to call a Ruby script.

Everything seems fine except for one thing: I need to pass an argument to a Haml view f

4条回答
  •  無奈伤痛
    2021-02-04 02:03

    Haml supports passing variables as locals. With Sinatra, you can send these locals like so:

    haml :fail, :locals => {:vm_name => name}
    

    and in the view, reference the variable using locals[:vm_name] or simply vm_name.

提交回复
热议问题