Ruby and PHP working together

To anyone who has work with Ruby on Rails and LAMP(linux,apache,mysql,php) arch.

I got this new web project where I was planning using LAMP for the front-end and back-end and using ruby code for other server process/tasks.

I try looking in forums but haven’t found much since this is uncommon, but in your experience is this good or bad, the pros and cons.

If it has been succesfully implemented or have any example, let me know. Would you rather using just one or both or which one in what case.

Thanks in advance!

Source: stackoverflow-php

In Rails, how do I query my database from JavaScript so that I can fill in a textbox?

I have a view that uses the select method in Ruby on Rails to return the following code:

    <select class="form-control" name="xyz" id="food_id">
    <option value="1">Peach</option>
    <option value="2">Apple</option>
    <option value="3">Orange</option>

To pass this information over to the JavaScript file, I am basically using a link_to method in my view, such as the following:

<%= link_to "Import text", "#/", :onclick => "fillTextBox()" %>

In the JS file, how can I basically get the name and description of whatever value is selected in the dropdown? This is as far as I’ve gotten before I got confused:

function fillTextBox(){
    var dropdown = document.getElementById('food_id');
    var foodID = dropdown[dropdown.selectedIndex].value;

I need to do something like:

var foodName = Food.find(foodID).name;
var foodDescription = Food.find(foodID).description;

Is this possible? The rest of the JS function would basically fill in a textbox using foodName and foodDescription, but I first need to be able to query the database for this information in the first place.

Source: stackoverflow-javascript