Search code examples
restrubymotion

Post command not writing to database with BubbleWrap


I currently have an iOS app i'm creating with Rubymotion. I am using Bubblewrap to do my REST commands. I have the below code, and it is creating the record, but not writing any of the data.

first = @kidfirst.text
last = @kidlast.text
data = {first_name: '#{first}', last_name: '#{last}'}
BW::HTTP.post("url", {payload: data}) do |response|
  if response.ok?
    p "Success"
  else
    p "response.error_message"
  end
end

I am getting the "Success" response also. What would stop it from posting the data to my application but create the account?


Solution

  • first = @kidfirst.text
    last = @kidlast.text
    data = {:child => {first_name: '#{first}', last_name: '#{last}'}}
    BW::HTTP.post("url", {payload: data}) do |response|
      if response.ok?
        p "Success"
      else
        p "response.error_message"
      end
    end
    

    The issue was when it went to post it didn't know where to post it on the rails backend because I was calling params[:child].