0

我已经使用 httparty 发布了一个帖子。

例如

options={ 
  :foo => '123'
  :bar => 'second',
  :baz => 'last thing'
}

HTTParty.post("localhost/tests" , options)

如何在远程应用控制器中检索选项参数:例如

#post /tests
def create
@k=options[:name]  -------> Here is my question, How can I access options[:name]?

我的意思是我应该将选项作为创建方法的参数传递吗?就像是:

def create(options)
@k=options[:name]
4

1 回答 1

0

好吧,它终于对我有用了。我应该分别检索每个字段而不是整体检索。很高兴!所以现在我有 2 个 rails 应用程序。只需分别包装字段并分别获取它们,我就可以发布和检索。

于 2012-05-06T17:37:20.010 回答