After posting some data using httparty, how can I access the posted values in controller?
-
06-06-2021 - |
Frage
I have done a posting using httparty.
E.g.
options={
:foo => '123'
:bar => 'second',
:baz => 'last thing'
}
HTTParty.post("localhost/tests" , options)
How can I retrieve options parameters in my remote app controller: E.g.
#post /tests
def create
@k=options[:name] -------> Here is my question, How can I access options[:name]?
I mean should I pass options as an argument of create method? Something like:
def create(options)
@k=options[:name]
Lösung
Okay it worked for me finally. I should have retrieved each fields separately rather than as a whole. So happy! So now I have 2 rails app. just by wrapping fields separately and fetching them separately I was able to post and retrieve.
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow