Ok, in PHP I can do this in 5 minutes. With Rails I am completely lost. I am so new to Rails and I have a requirement to do more advanced stuff with it then I am comfortable with currently. The Big guy decided lets go Rails from PHP. So its crash course learning. Fun times..
I understand from the javascript side making the post/get with jquery remains the same. On the ruby side however I am completely lost. What do I need to do in order to do a post/get to a Rails App. How would I define my controller? Lets say from the HTML side I am posting
input1 and input2 standard jquery $.post with a JSON request for data back. With php I would make a simple controller like:
public function myFormPostData(){
$errors = "none";
$errorMsg = "";
if($_POST['input1'] == ""){$errors = "found"; $errorMsg .= "Input 1 Empty<br>";}
if($_POST['input2'] == ""){$errors = "found"; $errorMsg .= "Input 2 Empty<br>";}
if($errors == "found"){ $output = array("error" => "found", "msg" => $errorMsg); }
else{
$output = array("error" => "none", "msg" => "Form Posted OK!!");
}
echo json_encode($output);
}
but in ruby I dunno how to translate that concept. I'm open to suggestions and good practices. Grant it the above is a super mediocre rendition of what I am needing to do I would sanitize things more than that and all else, but it gives the idea of what I am looking for in Rails..