After posting some data using httparty, how can I access the posted values in controller?

StackOverflow https://stackoverflow.com/questions/10467956

  •  06-06-2021
  •  | 
  •  

Pregunta

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]
¿Fue útil?

Solución

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.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top