Ember data save to rails server


#1

i want save ember data to rails side . I am using Rails Api v5.0 and ember cli v3.0 but when i click on submit button @ the rails side i get empty params with permitted false

==params====<ActionController::Parameters {“format”=>“json”, “controller”=>“api/v1/invoices”, “action”=>“create”} permitted: false>

what should i do ?

here is the action =>
createNewInvoice(invoice) { invoice.save(); }


#2

ember-data implements JSON API specification as default. Please verify that your server is supporting that one. If not, you must customize Adapter and Serializer.


#3

thanks for reply . i goes through the your links . for back end we use JSONAPIserilizer , and now i got the parameters. but i didn’t get relationship data in params .

Parameters: {“data”=>{“id”=>“69185”, “attributes”=>{“account_id”=>383513, “company_id”=>6941, “created_by”=>8785, “due_date”=>“2016-03-01”, “total_amount”=>10012, “invoice_date”=>“2016-02-23”, “invoice_number”=>“INV/003”, “customer_notes”=>"", “terms_and_conditions”=>"", “place_of_supply”=>nil, “cash_invoice”=>nil, “invoice_status_id”=>0}, “relationships”=>{“invoice_line_items”=>{“data”=>[{“type”=>“invoice-line-items”, “id”=>“192216”}, {“type”=>“invoice-line-items”, “id”=>nil}]}, “account”=>{“data”=>{“type”=>“accounts”, “id”=>“383513”}}, “customer”=>{“data”=>nil}}, “type”=>“invoices”}, “id”=>“69185”, “invoice”=>{}}


#4

The data you have posted is not JSON. Please post the JSON returned by your API. You could get it from network tab of browser’s developer tools for example. Would be helpful if it’s prettified.