这是我坚持的问题.我想将javascript变量传递给rails控制器.
<script>
var mdate = "26 December 2013";
var phone = prompt('Enter your phone!');
if (phone) {
//Passing mdate and phone variables to rails controller(book_date & phone)
}
else
{
alert("Cancelled");
}
</script>
Run Code Online (Sandbox Code Playgroud)
我的控制器
def new
@booking = Booking.new
end
def create
@booking = Booking.new(book_param)
if @booking.save
redirect_to root_url
else
flash[:notice_booking_failed] = true
redirect_to root_url
end
end
private
def book_param
params.require(booking).permit(:id, :book_date, :phone)
end
Run Code Online (Sandbox Code Playgroud)
先感谢您!
我无法在Heroku中部署.我Permission Denied!每次都会得到.我的存储库已经存在.
$ git remote -v
heroku git@heroku.com:catapp11.git (fetch)
heroku git@heroku.com:catapp11.git (push)
Run Code Online (Sandbox Code Playgroud)
但是当我尝试推入Heroku时,我总是会遇到错误.
$ git push -u heroku master
Permission denied (publickey).
fatal: Could not read from remote repository.
Please make sure you have the correct access rights
and the repository exists.
Run Code Online (Sandbox Code Playgroud)