小编Ben*_*mir的帖子

ERROR错误请求行 - 强制ssl - rails

我偶然将force_ssl设置为true,然后当恢复为false并运行服务器时,我收到以下错误:

ERROR bad Request-Line 

WEBrick 1.3.1
INFO  ruby 1.9.3 (2012-02-16) [x86_64-darwin11.4.0]
WEBrick::HTTPServer#start: pid=472 port=3000
ERROR bad Request-Line `\x16\x03\x01\x00?\x01\x00\x00?\x03\x02P?Mf\x00??C?'.
Run Code Online (Sandbox Code Playgroud)

我怎样才能解决这个问题?

当我在本地主机上点击http url时,它会重定向到https并给我这个错误:

SSL connection error
Unable to make a secure connection to the server. This may be a problem with the server, or it may be requiring a client authentication certificate that you don't have.
Error 107 (net::ERR_SSL_PROTOCOL_ERROR): SSL protocol error.
Run Code Online (Sandbox Code Playgroud)

ssl configuration ruby-on-rails-3

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

部署到heroku资产管道Sprockets :: fileNotFound

我正在尝试将我的应用程序部署到Heroku.Heroku没有加载我的jscss文件

我跑了RAILS_ENV=production bundle exec rake assets:precompile ,它仍然无法正常工作.

然后我跑了 heroku rake assets:precompile

我在Heroku日志中收到此错误:

Error compiling asset application.css:
 Sprockets::FileNotFound: couldn't find file 'jquery.ui.datepicker'
 (in /app/app/assets/stylesheets/application.css.scss:13)

Served asset /application-989f5e5266d9b066eb316183d7db5c77.css - 500 Internal Server Error


 Error compiling asset application.js:
 Sprockets::FileNotFound: couldn't find file 'jquery.ui.datepicker'
 (in /app/app/assets/javascripts/application.js:16)
Served asset /application-d81c946c6f47242e5e97de9bca4938be.js - 500 Internal Server Error
Run Code Online (Sandbox Code Playgroud)

config production.rb:

config.cache_classes = true
  config.consider_all_requests_local       = false
  config.action_controller.perform_caching = true
  config.serve_static_assets = true
  config.assets.compress = true
  config.assets.compile = true
  config.assets.initialize_on_precompile = false …
Run Code Online (Sandbox Code Playgroud)

configuration heroku ruby-on-rails-3 asset-pipeline

12
推荐指数
1
解决办法
5550
查看次数

Simple_form如何使内联接受条件复选框

<p><%= f.input :terms, :as => :boolean, :label => false, :boolean_style => :inline %> 
Accept <%= link_to "Terms of use", terms_path,:remote => true %> 
and <%=link_to "privacy Policy", privacy_path, :remote => true%></p>
Run Code Online (Sandbox Code Playgroud)

它最终看起来像这样

在此输入图像描述

在同一条线上排列它们的最佳方法是什么.

html css ruby-on-rails simple-form twitter-bootstrap

10
推荐指数
1
解决办法
8451
查看次数

找不到NGINX brew安装命令

我做

$ brew install nginx
Run Code Online (Sandbox Code Playgroud)

得到:

==> Downloading http://nginx.org/download/nginx-1.2.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/nginx-1.2.2.tar.gz
==> Patching
patching file conf/nginx.conf
==> ./configure --prefix=/usr/local/Cellar/nginx/1.2.2 --with-http_ssl_module --with-pcre         --with-ipv6 --with-cc-opt=-I/usr/local/include --with-ld-opt=-L/usr/local/lib --conf
==> make
==> make install
==> Caveats
In the interest of allowing you to run `nginx` without `sudo`, the default
port is set to localhost:8080.

If you want to host pages on your local machine to the public, you should 
change that to localhost:80, and run `sudo nginx`. You'll need to turn off
any …
Run Code Online (Sandbox Code Playgroud)

bash homebrew command-line nginx .bash-profile

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

PostgreSQL版本不会更改为默认值

Mac OS X Lion 10.7.4

psql --version-> psql(PostgreSQL)9.0.5

我想安装最新版本并运行它的Rails应用程序。

我做

brew install postgresql

it is installed here: /usr/local/Cellar/postgresql/9.1.4  

initdb /usr/local/var/postgres

pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start
Run Code Online (Sandbox Code Playgroud)

我得到:

pg_ctl: another server might be running; trying to start server anyway
Run Code Online (Sandbox Code Playgroud)

运行postgres --version

 -> 9.1.4
Run Code Online (Sandbox Code Playgroud)

邮编-p 5433

 postgres does not know where to find the server configuration file.
 You must specify the --config-file or -D invocation option or set the PGDATA environment variable.
Run Code Online (Sandbox Code Playgroud)

postgresql ruby-on-rails-3 postgresql-9.1

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

ActionMailer :: Base Dynamic:来自电子邮件地址

如何在我的电子邮件邮件中更改此代码,以便当current_user从应用程序发出电子邮件时,收件人会收到该邮件:from => current_user.email.

目前它来自"notification@example.com",但我希望这可以动态更改,这是否可能,而不会导致电子邮件进入垃圾邮件?

class EmailMailer < ActionMailer::Base
    default :from => "notification@example.com"

    def email_listing(user, listing, email)
        @user = user 
        @listing = listing
        @email = email
        @url  = "www.example.com"

        mail(:to => @email.email, :subject => @user.name)
    end
end 
Run Code Online (Sandbox Code Playgroud)

actionmailer ruby-on-rails-3

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

无法批量分配受保护的属性:stripe_card_token

我正在尝试用条纹创建电荷.尝试创建订单对象时出现以下错误,但我设置了attr_accessor:stripe_card_token.有谁知道我做错了什么?

ActiveModel::MassAssignmentSecurity::Error in OrdersController#create
Can't mass-assign protected attributes: stripe_card_token
Run Code Online (Sandbox Code Playgroud)

OrdersController - 创建动作

def create
@order = current_cart.build_order(params[:order])
@order.ip_address = request.remote_ip
@order.user_id = current_user.id


respond_to do |format|
  if @order.save_with_payment

    @order.add_line_items_from_cart(current_cart)         
    Cart.destroy(session[:cart_id])
    session[:cart_id] = nil


    format.html { render :action => "success", :notice => 'Thank you for your order.' }
    format.xml { render :xml => @order, :status => :created, :location => @order }

  else
    format.html { render :action => "new" }
    format.xml { render :xml => @order.errors,
    :status => :unprocessable_entity }
  end
end …
Run Code Online (Sandbox Code Playgroud)

shopping-cart ruby-on-rails mass-assignment attr-accessor stripe-payments

0
推荐指数
1
解决办法
1316
查看次数