我最近看过有关活动管理员的railscast 284并希望将其实现到我的网络应用程序中,但是当我添加资源时遇到了问题.每次尝试导航到创建的选项卡时,我都会收到以下消息:
NameError in Admin::LoadsController#index
undefined local variable or method `per' for []:ActiveRecord::Relation
Rails.root: /Users/thomascioppettini/rails_projects/want-freight
Application Trace | Framework Trace | Full Trace
Request
Parameters:
{"order"=>"id_desc"}
Show session dump
Show env dump
Response
Headers:
Run Code Online (Sandbox Code Playgroud)
没有
我唯一能想到的可能会影响应用程序的是添加一个recaptcha to devise,这是主动管理员所依赖的.
我用自制软件更新到最新版本的postgis.(2.1)
brew unlink postgis
brew install postgis
Run Code Online (Sandbox Code Playgroud)
然后我创建了一个迁移,将postgis扩展名改为2.1
rails g migration alter_postgis_version
def change
execute %q{ALTER EXTENSION postgis UPDATE TO "2.1.0";}
end
Run Code Online (Sandbox Code Playgroud)
在第一条评论中运行brew命令,现在我在迁移时遇到以下错误:
PG::UndefinedObject: ERROR: type "geometry" does not exist:
CREATE EXTENSION postgis_tiger_geocoder;/me/.rvm/gems/ruby-2.0.0-
p247@freight_alert/gems/activerecord4.0.0/
lib/active_record/connection_adapters/postgresql/database_statements.rb:128:in `exec'
Run Code Online (Sandbox Code Playgroud)
我在postgis的架构下设置了postgis,所以如果我运行的话
$: set search_path = "$user", postgis,public;
$: \d
List of relations
Schema | Name | Type | Owner
---------+--------------------------+----------+-------------------
postgis | geography_columns | view | me
postgis | geometry_columns | view | me
etc..
$: \d geometry_columns
View "postgis.geometry_columns"
Column | Type …Run Code Online (Sandbox Code Playgroud) 我将使用思考sphinx为我的应用程序,它需要转换为postgresql.我已经使用自制软件下载了sphinx和postgresql,但我不确定如何转换应用程序的其余部分.我不关心保存我的数据,因为我的数据库中只有大约5条记录.如果有一个分步指南,或一个可以指导我的资源,我将不胜感激.
我正在尝试将nonce值添加到内联脚本中以满足更严格的CSP。但是,我遇到了一个奇怪的问题,即chrome正在从现时属性中剥离值。当我卷曲页面时,会出现现时值。这导致脚本现在无法通过CSP测试,因此无法执行。我以为这可能是由于流氓扩展引起的,但是在完全干净的chrome版本上却失败了。(OSX上的版本73.0.3683.103)随机数的值是一个随机的256位基本编码的字符串,因此它应满足随机数的所有要求。
有人知道发生了什么吗?难道我做错了什么?
我一直遵守以下railscast有关添加pdfkit到一个应用程序,和我有PDF文件的产生一些问题.以下是我做过的事情:
我通过自制软件包管理器下载了wkhtmltopdf
brew install wkhtmltopdf
Run Code Online (Sandbox Code Playgroud)
然后我将pdfkit gem添加到我的gemfile并运行bundle install命令.我在config/application.rb文件中添加了以下内容
require 'pdfkit'
...
config.middleware.use PDFKit::Middleware, :print_media_type => true
Run Code Online (Sandbox Code Playgroud)
然后我更改了我的应用程序布局文件以包含所有样式表类型.
如果我运行rake中间件,命令工作,我可以看到pdfkit中间件
当我尝试将pdf附加到我的路由末尾时,应用程序就会挂起,我必须通过命令行退出.如果我创建一个指向我想要制作成pdf页面的链接,它会更改所有标记,使其看起来像一个损坏的文件.(看起来你将文本文件打开到文字处理器中,反之亦然,如果有帮助,我可以提供图像)如果我尝试在样式表中进行css更改,当我使用pdf链接查看时,它们不会生效.我假设这与rails中的新资产管道有关,还有其他人遇到过这个问题吗?
pdf-generation pdfkit wkhtmltopdf ruby-on-rails-3 ruby-on-rails-3.1
我跟随条带上的railscast#288,但我在设置条纹隐藏令牌方面遇到了一些困难.我正在使用最新版本的设计与简单的表单集成.
这是我的注册控制器:
class RegistrationsController < Devise::RegistrationsController
def create
build_resource
if resource.save_with_payment
if resource.active_for_authentication?
set_flash_message :notice, :signed_up if is_navigational_format?
sign_in(resource_name, resource)
respond_with resource, :location => after_sign_up_path_for(resource)
else
set_flash_message :notice, :"signed_up_but_#{resource.inactive_message}" if is_navigational_format?
expire_session_data_after_sign_in!
respond_with resource, :location => after_inactive_sign_up_path_for(resource)
end
else
clean_up_passwords resource
respond_with resource
end
end
Run Code Online (Sandbox Code Playgroud)
我注册新用户的表单:
<%= simple_form_for(resource, :as => resource_name, :url => registration_path(resource_name), :html => {:class => 'well'} ) do |f| %>
<%= f.error_notification %>
<%= f.error_messages %>
<h3 class="center">Create your credentials for logging in:</h3><hr>
<div class="inputs">
<%= f.input …Run Code Online (Sandbox Code Playgroud) ruby-on-rails payment-processing devise ruby-on-rails-3 stripe-payments
我正在进行巡回演出,我不确定我在问题#23中所犯的错误导致该过程花费的时间太长.http://tour.golang.org/#23
package main
import (
"fmt"
"math"
)
func Sqrt(x float64) float64 {
guess := 1.0
i := 1
for i < 10 {
guess = guess - (math.Pow(guess, 2)-x)/(2*guess)
}
return guess
}
func main() {
fmt.Println(Sqrt(2))
}
Run Code Online (Sandbox Code Playgroud)
我收到错误:[进程花了太长时间]
我已经设置了rails with devise但是当我将可确认模块添加到我的应用程序时,我无法使我的身份验证工作.我在我的用户模型中包含了可确认模块,并在我的迁移文件中包含了未注释的确认和add_index确认令牌.回滚数据库并重新评论这些数据后,身份验证按指定的方式工作.
我已经检查过,我无法退出应用程序,即使我已经提供<%=链接到"注销",destroy_user_session_path%>我的应用程序收到路由错误,没有路由匹配[GET]用户/ sign_out .当我运行rake路线时,我可以使用这条路线
destroy_user_session DELETE /users/sign_out(.:format) {:action=>"destroy", :controller=>"devise/sessions"}
Run Code Online (Sandbox Code Playgroud) devise ×2
postgresql ×2
activeadmin ×1
gem ×1
go ×1
homebrew ×1
nonce ×1
pdfkit ×1
postgis ×1
railscasts ×1
rubygems ×1
wkhtmltopdf ×1