小编Cod*_*eky的帖子

将javascript变量传递给rails控制器

这是我坚持的问题.我想将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)

先感谢您!

javascript variables ruby-on-rails

9
推荐指数
2
解决办法
1万
查看次数

在Heroku上使用Git进行部署时出错

我无法在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)

git ruby-on-rails heroku

3
推荐指数
1
解决办法
56
查看次数

标签 统计

ruby-on-rails ×2

git ×1

heroku ×1

javascript ×1

variables ×1