我见过其他人在Mountain Lion上安装RMagick同样的问题但是没有一个建议的解决方案允许我成功安装rmagick.
这是我得到的错误消息:
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
checking for Ruby version >= 1.8.5... yes
checking for /usr/local/bin/gcc-4.2... yes
checking for Magick-config... yes
checking for ImageMagick version >= 6.4.9... yes
checking for HDRI disabled version of ImageMagick... yes
checking for stdint.h... yes
checking for sys/types.h... yes
checking for wand/MagickWand.h... yes
checking for InitializeMagick() in -lMagickCore... no
checking for InitializeMagick() in -lMagick... no
checking for InitializeMagick() in -lMagick++... no
Can't install RMagick 2.13.1. Can't find the …
Run Code Online (Sandbox Code Playgroud) 我正在使用设计,我希望能够在开发模式下跳过确认电子邮件.由于我的应用程序在本地计算机上运行时无法发送电子邮件,因此我将收到警告消息,说明在访问应用程序之前需要确认.
我有一个使用pdfkit创建pdf文档的rails 3.1应用程序,除了生成的pdf没有任何样式这一事实外,一切都按指定的方式工作.我假设wkhtmltopdf无法访问我的样式表,并且它不是一个更大的问题.有人会知道如何允许访问这些样式表吗?我基本上已经关注了这个主题的railscast#220,但是我必须创建一个新的初始化程序来使pdfkit与rails 3.1一起使用.
这是我必须使用的初始化程序,以使pdfkit与rails 3.1一起使用
ActionController::Base.asset_host = Proc.new { |source, request|
if request.env["REQUEST_PATH"].include? ".pdf"
"file://#{Rails.root.join('public')}"
else
"#{request.protocol}#{request.host_with_port}"
end
}
Run Code Online (Sandbox Code Playgroud)
pdf的链接如下所示:
<%= link_to 'Download PDF', load_path(@load, :format => "pdf") %>
Run Code Online (Sandbox Code Playgroud)
这将为我提供一个没有样式的pdf链接.
在我的application.rb中,我已经配置了pdfkit:
config.middleware.use PDFKit::Middleware, :print_media_type => true
Run Code Online (Sandbox Code Playgroud)
我还将此添加到我的layouts/application.html.erb文件中:
<%= stylesheet_link_tag "application", :media => "all" %>
Run Code Online (Sandbox Code Playgroud) 我在Mac上通过Homebrew安装了Postgis和Postgresql,我想将我的Postgis版本升级到2.1.0-rc2.我取消了我的postgis版本,然后编辑了postgis自制软件.在新公式未编译之后,我重新链接了旧公式,每当我尝试使用空间列调用数据库表时,我现在收到以下错误:
PG::UndefinedFile: ERROR: could not load library
"/usr/local/Cellar/postgresql/9.2.4/lib/postgis-2.0.so":
dlopen(/usr/local/Cellar/postgresql/9.2.4/lib/postgis-2.0.so, 10): Symbol not found:
_json_tokener_errors
Referenced from: /usr/local/Cellar/postgresql/9.2.4/lib/postgis-2.0.so
Expected in: /usr/local/lib/libjson.0.dylib
in /usr/local/Cellar/postgresql/9.2.4/lib/postgis-2.0.so
Run Code Online (Sandbox Code Playgroud)
(在执行上述操作之前我没有遇到此问题)我已经重新启动了postgresql服务器,但是没有用.我不确定如何解决这个问题.
我跟随Daniel Azuma关于使用rails进行地理空间分析的讨论,但每当我rake db:migrate
在第二个项目中运行时,我都遇到了困难.
我的设置细节如下:我使用Postgres.app运行Postgresql,它给出了Postgres版本9.1.3和PostGIS 2.0.0版本.我遇到了database.yml文件的一些问题,并运行了迁移.(我添加了相关的宝石,并在application.rb中要求他们的信息)
我的database.yml文件如下所示:
development:
adapter: postgis
postgis_extension: true
host: localhost
encoding: unicode
database: my_app_development
pool: 5
username: my_app
password:
Run Code Online (Sandbox Code Playgroud)
如果我添加以下行,schema_search_path: "public,postgis"
我得到:
rake aborted!
PG::Error: ERROR: schema "postgis" does not exist
: SET search_path TO public,postgis
Run Code Online (Sandbox Code Playgroud)
如果我删除该行,当我尝试迁移数据库时收到以下错误:
rake aborted!
PG::Error: ERROR: relation "geometry_columns" does not exist
LINE 1: SELECT * FROM geometry_columns WHERE f_table_name='schema_mi... ^
: SELECT * FROM geometry_columns WHERE f_table_name='schema_migrations'
Run Code Online (Sandbox Code Playgroud)
有没有人知道如何解决这些问题?
我正在努力的rails应用程序上遇到这个问题.我正在开发一个功能分支,并希望从最新的主人那里重新定义.我运行了以下命令:
$ git checkout master
$ git pull --rebase
Run Code Online (Sandbox Code Playgroud)
如果我尝试检出我的功能分支,我会收到以下错误:
Changes not staged for commit:
(use "git add <file>..." to update what will be committed)
(use "git checkout -- <file>..." to discard changes in working directory)
modified: Gemfile.lock
Run Code Online (Sandbox Code Playgroud)
我尝试了以下命令将Gemfile.lock解析回aster,但没有一个成功:
$ git checkout -- Gemfile.lock
$ git stash
$ git reset HEAD --hard
Run Code Online (Sandbox Code Playgroud)
每次我运行一个新的git命令时,我都会回到Gemfile.lock,其中的更改没有为commit提交.
以下是我正在使用的以下版本的库:
$ git --version => 2.3.3
$ bundler --version => 1.7.9
Run Code Online (Sandbox Code Playgroud) 我创建了一个用户模型Devise
,每当我使用时,rake db:migrate
我都会遇到以下问题:
== DeviseCreateUsers: migrating ==============================================
-- create_table(:users)
rake aborted!
An error has occurred, this and all later migrations canceled:
undefined method `database_authenticatable' for #<ActiveRecord::ConnectionAdapters::TableDefinition:0x00000103fa1ff0>
Tasks: TOP => db:migrate
(See full trace by running task with --trace)
Run Code Online (Sandbox Code Playgroud)
我用完全跟踪,--trace function
但似乎无法弄清楚问题是什么.这是迁移文件:
class DeviseCreateUsers < ActiveRecord::Migration
def self.up
create_table(:users) do |t|
t.database_authenticatable :null => false
t.recoverable
t.rememberable
t.trackable
t.confirmable
# t.encryptable
# t.lockable :lock_strategy => :failed_attempts, :unlock_strategy => :both
# t.token_authenticatable
t.timestamps
end
add_index :users, :email, :unique …
Run Code Online (Sandbox Code Playgroud) 如果您使用单一资源,脚手架的常规方法不起作用,有没有办法通过脚手架获得默认的奇异控制器?假如一个用户只有一个帖子就可以轻松运行如下命令:
rails g scaffold post -singular
Run Code Online (Sandbox Code Playgroud) 我刚刚切换到使用zsh和oh-my-zsh,我在使用rails命令行工具时遇到了问题.以下是我遇到的步骤,以及我收到的错误.
我运行了github页面提供的curl命令:
curl -L https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh | sh
Run Code Online (Sandbox Code Playgroud)
然后我去运行rails s,这是我收到的以下错误消息:
.rvm/rubies/ruby-1.9.3-p0/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (>= 0) amongst [bigdecimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError)
Run Code Online (Sandbox Code Playgroud)
这看起来像我有一个宝石错误所以我重新安装rvm,rails和bundler没有解决问题.但是,如果我将我的终端切换回bash,那么我没有任何问题,导轨工作得非常好.还有其他人遇到过类似的问题吗?我想使用zsh,因为它似乎有更好的功能,但如果我不能使用rails,那么我必须将其转储到路边.
这些是我的.zshrc文件末尾的行:
export PATH=/Users/thomascioppettini/.rvm/gems/ruby-1.9.3p0/bin:/Users/thomascioppettini/.rvm/gems/ruby-1.9.3-p0@global/bin:/Users/thomascioppettini/.rvm/rubies/ruby-1.9.3-p0/bin:/Users/thomascioppettini/.rvm/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/local/git/bin:/usr/X11/bin
PATH=$PATH:$HOME/.rvm/bin # Add RVM to PATH for scripting
Run Code Online (Sandbox Code Playgroud) 我最近看过有关活动管理员的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,这是主动管理员所依赖的.
bundler ×3
devise ×2
postgis ×2
postgresql ×2
rvm ×2
activeadmin ×1
css ×1
email ×1
gem ×1
gemfile.lock ×1
geolocation ×1
geospatial ×1
git ×1
homebrew ×1
imagemagick ×1
pdfkit ×1
railscasts ×1
rake ×1
resources ×1
rmagick ×1
ruby ×1
rubygems ×1
zsh ×1