当我开始使用rails时:
$ rails s
Run Code Online (Sandbox Code Playgroud)
我明白了:
/Users/snowcrash/.rvm/gems/ruby-2.1.5@global/gems/bundler-1.3.5/lib/bundler/spec_set.rb:92:in `block in materialize': Could not find rake-10.4.2 in any of the sources (Bundler::GemNotFound)
Run Code Online (Sandbox Code Playgroud)
所以,我跑了bundle install:
$ bundle install
Using rake 10.4.2
Run Code Online (Sandbox Code Playgroud)
但gem list rake给出:
*** LOCAL GEMS ***
rake (10.1.0, 10.0.4)
Run Code Online (Sandbox Code Playgroud)
怎么没有rake 10.4.2安装?
此外,当我运行bundle check它给我:
The Gemfile's dependencies are satisfied
Run Code Online (Sandbox Code Playgroud)
这似乎不正确.为什么?
====更新
我通过以下方式修复了问题rake:
gem install rake
Run Code Online (Sandbox Code Playgroud)
但为什么我必须手动安装它?我以为那是Bundler的工作.
并尝试再次启动rails给了我另一个问题:
Could not find multi_json-1.10.1 in any of the sources (Bundler::GemNotFound)
Run Code Online (Sandbox Code Playgroud)
显然,这里存在一些潜在的问题.有什么建议?
WYSIWYG编辑器是否有一个很好的红宝石宝石,可以轻松使用rails应用程序?
我需要一个博客在我现有的应用程序内,但它不一定是花哨的,一些类别和一种方式将纺织品目录转换为博客帖子,包括日期将适合,已经搜索过但没有任何幻想出现.
关于将博客添加到现有rails应用程序的好宝石的任何建议?
我想我会想出一个灵活的方法来扩展Rails 3.x gem中的ApplicationController.
在我的宝石中lib/my_namespace/my_controller.rb,我有:
class MyNamespace::MyController < ApplicationController
before_filter :some_method
after_filter :another_method
def initialize
# getting classname of the subclass to use for lookup of the associated model, etc.
# and storing the model_class in an instance variable
# ...
end
# define :some_method, :another_method, etc.
# ...
private
attr_accessor :subclass_defined_during_initialize # etc.
# etc.
end
Run Code Online (Sandbox Code Playgroud)
但是当加载Gem时,app/controllers/application_controller.rb尚未加载,因此失败:
/path/to/rvm/gemset/gems/activesupport-3.2.6/lib/active_support/dependencies.rb:251:
in `require': cannot load such file -- my_gem_name/application_controller (LoadError)
Run Code Online (Sandbox Code Playgroud)
作为一种解决方法,我在我的gem中定义了ApplicationController lib/gem_namespace/application_controller.rb:
class ApplicationController < ActionController::Base
end
Run Code Online (Sandbox Code Playgroud)
我假设即使我在那里定义它,它也会在我的Rails …
gem ruby-on-rails applicationcontroller ruby-on-rails-3 load-order
我正在尝试使用Twitter Bootstrap(gem twitter-bootstrap-rails)设置Rails应用程序,但我仍然无法克服错误
File to import not found or unreadable: twitter/bootstrap.
Run Code Online (Sandbox Code Playgroud)
我在宝石的官方Github上发现了这个问题,但没有一个解决方案对我有用.这是我的设置: Gemfile
gem "twitter-bootstrap-rails"
gem 'font-awesome-rails'
gem 'sass-rails', '~> 3.2.3'
group :assets do
#gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
end
Run Code Online (Sandbox Code Playgroud)
application.css
*= require_self
*= require bootstrap_and_overrides
*= require font-awesome
*= require_tree .
Run Code Online (Sandbox Code Playgroud)
bootstrap_and_overrides.css.sass
@import "twitter/bootstrap";
@import "twitter/bootstrap/bootstrap";
@import "twitter/bootstrap/responsive";
// Font Awesome
@import "fontawesome";
// Glyphicons
@import "twitter/bootstrap/sprites.scss";
Run Code Online (Sandbox Code Playgroud)
我错过了正确的设置?
谢谢
ruby gem ruby-on-rails twitter-bootstrap twitter-bootstrap-rails
我在我的电脑上安装了rubyinstaller-2.0.0-p195并用Ruby打开了命令提示符.接下来我运行gem update --system命令来更新并成功更新.
现在,每当我试图跑步时gem install <program>,例如.gem install rhc,, gem install af它每次都无法安装并显示类似的SSL_certificate相关错误,如下所示 -
C:\Windows\System32>gem install rhc
ERROR: Could not find a valid gem 'rhc' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect retur
ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (
https://rubygems.global.ssl.fastly.net/quick/Marshal.4.8/rhc-1.15.6.gemspec.rz)
ERROR: Possible alternatives: rhc
Run Code Online (Sandbox Code Playgroud) 我正在做一个
sudo gem install mysql
在OS X上安装mysql gem.这失败,输出如下:
构建原生扩展.这可能需要一段时间......
错误:安装mysql时出错:
错误:无法构建gem原生扩展.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
检查mysql_ssl_set()...是的
检查rb_str_set_len()...是的
检查rb_thread_start_timer()...没有
检查mysql.h ...是的
创建Makefile
让"DESTDIR ="干净
制作"DESTDIR ="
编译mysql.c
链接共享对象mysql/mysql_api.bundle
clang:错误:未知参数:' - multiply_definedsuppress'[-Wunused-command-line-> argument-hard-error-in-future]
clang:注意:将来这将是一个很难的错误(不能降级为警告)
make:* [mysql_api.bundle]错误1
make failed,退出代码2
Gem文件将保留在/Library/Ruby/Gems/2.0.0/gems/mysql-2.9.1中以供检查.
结果记录到/Library/Ruby/Gems/2.0.0/extensions/universal-darwin-13/2.0.0/mysql-2.9.1/gem_make.out
知道是什么原因引起的吗?我有自制的mysql安装,如果这有所作为.
当我想安装sass和指南针时,我收到了这条消息.有人能帮我吗?
Microsoft Windows [version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. Tous droits réservés.
C:\Users\Bk>gem install sass
ERROR: While executing gem (Encoding::UndefinedConversionError)
U+2019 to CP850 in conversion from UTF-16LE to UTF-8 to CP850
Run Code Online (Sandbox Code Playgroud) 在Python中,我可以使用"可编辑"模式从源安装包pip install -e.然后我可以继续编辑代码,其他Python脚本会自动选择任何更改import library
是否有类似的工作流程来开发Ruby宝石?什么是使用库的"Ruby方式",因为它们正在开发,而不是每次我对源进行更改时编译和安装gem?
我试图理解来自github repo的代码.它是设置客户端的gem的主要模块.
module Github
# more code
class << self
def included(base)
base.extend ClassMethods # what would this be for?
end
def new(options = {}, &block)
Client.new(options, &block)
end
def method_missing(method_name, *args, &block)
if new.respond_to?(method_name)
new.send(method_name, *args, &block)
elsif configuration.respond_to?(method_name)
Github.configuration.send(method_name, *args, &block)
else
super
end
end
def respond_to?(method_name, include_private = false)
new.respond_to?(method_name, include_private) ||
configuration.respond_to?(method_name) ||
super(method_name, include_private)
end
end
module ClassMethods
def require_all(prefix, *libs)
libs.each do |lib|
require "#{File.join(prefix, lib)}"
end
end
# more methods ...
end …Run Code Online (Sandbox Code Playgroud)