Since you don't have the ticket_id, it's not a valid route.
In your HTML, if the ticket_id is available and you're already displaying it somewhere then you can create a data attribute like
<%= tag :div, id: 'some_name', data: { 'ticket-id': @ticket.id } %>
You can access the value of the ticket's id in jQuery like
var ticket_id = $('#some_name').data('ticket-id');
And then in the AJAX POST
data: { ticket_id: ticket_id, upc: code }
Looks like you should remove the collection on the orders and instead do something like this
post '/orders/get_barcode', as: :get_barcode, controller: :orders, action: :get_barcode
Since it sounds like you have a barcode which references a record in the Order model, you're not really going to be able to do a nested resource and have the collection on the Orders. Instead, you can create a manual path (as shown above) which goes to your orders#get_barcode action.
In the get_barcode action, you can look up the order and then get the ticket association.
It might look something like
def get_barcode
@ticket = Order.includes(:ticket).find_by(barcode: params[:upc]).ticket
end
This is assuming that a Ticket has_many Orders and an Order belongs_to a Ticket.
The previous example will generate two queries and could be a bit slower. You could get fancy with your query and also do something like this which will create an inner join
@ticket = Ticket.joins(:orders).where(orders: {barcode: params[:upc]})
I'd recommend using https://aws.amazon.com/elasticsearch-service if hosting your instances in AWS. Just be mindful and lock the security of the search instance/cluster to the EC2 instance.
You could add https://github.com/rails/rails/blob/master/activerecord/lib/active_record/enum.rb to your lib folder and have it loaded in your path on the app boot. It should give you the functionality of enum prefix. I did something similar like this before I had fully upgraded a few Rails 4 apps to Rails 5.
The visitor view is just a simple controller and has an action. Within there is a DIV which contains the ID calendar which is where I'm displaying the calendar. You would place the calendar div where ever appropriate for your application.
For the requests responding as HTML instead of JSON, this could be how you're requesting the data. I'm using format: :json which will make a call to get the json data by default. I didn't do anything special in creating the events controller/model. Check your application logs to see how it is being handled. You might get some hints there.
For the JSON list of events in the jQuery, I'm calling the url /events.json which would be the same in Ruby as calling events_path(format: :json).
Hope this helps.