V
V
V2016-08-20 22:41:30
MongoDB
V, 2016-08-20 22:41:30

How to update attribute value in mongo via AJAX in Rails?

I have two models: bot.rb and order.rb

I display on the show (bot) page a list of all its orders via
@orders = Order.where(chat_id: @bot.chat_id)

<% @orders.each do |order| %>
    <%= order.status %>
    <%= order.number %>

<% end %>

That is, I did not create a separate controller for order. The order model has a :status attribute. I want to change the status value of order (via checkbox) on the show (bot) page using AJAX and immediately make changes in the database (mongo). How can this be implemented?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question