How to pass an argument when calling a view file?
问题 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 file from the Sinatra/Ruby script. Here is a part of my code: #!/usr/bin/env ruby require 'rubygems' require 'sinatra' require 'haml' get '/' do haml :index end post '/' do name = params[:name] vlan = params[:vlan] tmp = nil tmp = %x[./wco-hosts.rb -a -n #{name} -v #{vlan}] if tmp.include?("Error") haml :fail else haml :success