在我的一个开发分支中,我对我的代码库进行了一些更改.在我能够完成我正在处理的功能之前,我不得不将当前分支切换到master来演示一些功能.但只是使用"git checkout master"保留了我在开发分支中所做的更改,从而破坏了master中的一些功能.所以我所做的是使用提交消息"临时提交"在我的开发分支上提交更改,然后为演示提供checkout master.
现在我已完成演示并重新开始在我的开发分支上工作,我想删除我所做的"临时提交",同时仍然保留我所做的更改.那可能吗?
我正在尝试安装libv8 3.16.14.3,但使用最新的稳定rvm和ruby-1.9.3-p125在OSX Mavericks上出错.
这是运行命令'gem install libv8'的输出:
~/src(branch:master) » gem install libv8
Fetching: libv8-3.16.14.3.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing therubyracer:
ERROR: Failed to build gem native extension.
/Users/me/.rvm/rubies/ruby-1.9.3-p125/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.5
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: g++
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Unable to find a compiler officially supported …Run Code Online (Sandbox Code Playgroud) 我有一些我想在我的RoR应用程序中使用的字体,但它们的格式主要是.ttf和.otf等.我如何在Rails应用程序中嵌入这些文件?也就是说,一旦我把它们放在我的资源文件夹中,我将它们嵌入我的CSS和/或LESS文件的语法究竟是什么?
编辑:这是我现在的代码:
@font-face {
font-family: Vow;
src: url('/assets/Vow.otf');
}
h1 {
font-family: Vow;
text-align: center;
}
Run Code Online (Sandbox Code Playgroud)
它似乎对我不起作用.Rails控制台中的输出类似于:
ActionController::RoutingError (No route matches [GET] "/assets/Vow.otf")
Run Code Online (Sandbox Code Playgroud)
用Firebug检查页面说:
downloadable font: download failed (font-family: "Vow" style:normal weight:normal stretch:normal src index:0): status=2147746065
source: http://localhost:3000/assets/Vow.otf
Run Code Online (Sandbox Code Playgroud) Ruby on Rails在很大程度上因为缺乏可扩展性选项而受到质疑,而另一种选择通常是迁移到某种形式的Java webapp或类似的东西.但在某种程度上,所有的担忧似乎都是非常随意的.
当某个应用程序需要用不同的语言重写时,是否有任何具体的数字?Heroku提供各种缩放选项以及应用程序可用的dynos数量,但在什么时候收益递减,如果有的话,显而易见?或者说,拥有这么多dynos的成本会在多大程度上超过简单编写新应用程序的成本?
在Heroku的基本免费托管计划中,我可以期望能够支持多少活动并发用户而不会遇到性能问题?
我有一个运行Bootstrap的Ruby on Rails应用程序,我使用gem twitter-bootstrap-rails安装.
我现在想整合一个新的Bootswatch主题,但我无法弄清楚要做什么.
每个主题有四种可能的下载 - bootstrap.css文件,bootstrap.min.css文件,variables.less文件和bootswatch.less.我的问题是:我是否需要下载并将它们全部添加到我的~/app/assets/stylesheets文件夹中?或者我只需要其中的一部分?目前里面~/app/assets/stylesheets只有两个文件:application.css和boostrap_and_overrides.css.less.LESS真的把我扔到了这里,所以我完全不知道它是如何工作的以及我需要做些什么来添加这个设置添加新的css文件.任何帮助表示赞赏.
我有一个使用namecheap注册的域,其DNS记录由AWS Route 53管理.目前,该域指向常规EC2实例.我想要一个子域设置指向一个单独的EC2实例(特别是一个Elastic Beanstalk实例).我已经设置了Beanstalk实例(所以如果我访问该实例的弹性IP,一切正常).
问题是,我在向Route 53添加子域时看到的所有文档都暗示父域的DNS记录仍由注册商管理.我不清楚我需要在哪里添加子域的新NS记录,以使其指向正确的事情.
我正在尝试在通过代理连接到互联网的Ubuntu机器上安装Heroku Toolbelt.我是Ubuntu及其设置的新手,但我设法连接到互联网.互联网似乎正常工作只是浏览和通过apt-get获取更新总是成功的,curl命令返回预期的.
当我尝试在Heroku Toolbelt站点上运行命令时:
wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
Run Code Online (Sandbox Code Playgroud)
我收到一些错误:
me@mypc-vb:~/Documents/stuff$ wget -qO- https://toolbelt.heroku.com/install-ubuntu.sh | sh
This script requires superuser access to install apt packages.
You will be prompted for your password by sudo.
[sudo] password for hsiehbe:
--2012-11-15 15:09:46-- https://toolbelt.heroku.com/apt/release.key
Resolving toolbelt.heroku.com... failed: Name or service not known.
wget: unable to resolve host address `toolbelt.heroku.com'
gpg: no valid OpenPGP data found.
Ign http://us.archive.ubuntu.com oneiric InRelease
Ign http://security.ubuntu.com oneiric-security InRelease
Ign http://extras.ubuntu.com oneiric InRelease
...
Fetched 12.9 MB in 32s …Run Code Online (Sandbox Code Playgroud) EDIT2:等待我的更改是否成功.
编辑:我使用命令行Zerigo安装命令重新安装了一切(原始问题是手动设置).现在的问题是:我设置的自定义域无法正常工作.访问自定义域只会在Chrome中返回错误:"糟糕!Google Chrome无法找到www.myapp.com",即使我添加的自定义域名为"www.myapp.com"?
我一直在尝试按照https://devcenter.heroku.com/articles/custom-domains和https://devcenter.heroku.com/articles/zerigo_dns上的说明在我的Cedar Heroku应用上设置自定义域.
在Zerigo上设置域的教程中,添加主机的说明之一是添加Web服务器的IP地址.我如何查找此信息?我找不到任何可以帮助我的资源.
我应该在_ .herokuapp.com 上添加我的应用的IP地址吗?当我试着查看这个地址时,我从来没有得到一致的地址(可能是因为Heroku的许多服务器).任何帮助表示赞赏.
在我的Ruby on Rails应用程序中,我使用imdb gem(https://rubygems.org/gems/imdb)按标题搜索电影并抓取海报网址并将其添加到我在数据库中的电影模型中.然后在我看来,我将该url放在图像源标签中并将图像显示给用户.
当我在本地运行我的应用程序时,我没有任何问题,但是当我将它部署到Heroku时,有时会成功渲染一些图像,但在大多数情况下,它们显示不正确.我尝试过多个浏览器,当我尝试加载图片时,我得到一条"推荐被拒绝"消息说:
You don't have permission to access "[poster url here]" on this server. Reference #[some ref. number here]
Run Code Online (Sandbox Code Playgroud)
我该如何解决这个问题?我猜这是因为IMDB服务器拒绝我的访问权限,因为我要么从我的应用程序发出太多请求,要么因为我的应用程序没有必要的凭据来获取数据或者两者兼而有之.有没有办法绕过这个?
这是我正在使用的结构:
应用程序/模型/ model.rb
class Model < ActiveRecord::Base
attr_accessor :some_var
end
Run Code Online (Sandbox Code Playgroud)
应用程序/模型/ model_controller.rb
class ModelsController < ApplicationController
def show
@model = Model.find(params[:id])
@other_var
if @model.some_var.nil?
@model.some_var = "some value"
@other_var = "some value"
else
@other_var = @model.some_var
end
end
end
Run Code Online (Sandbox Code Playgroud)
每当我运行此代码(例如show方法)时,if子句被评估为true(例如@ model.some_var == nil).我该如何解决这个问题?我对attr_accessor的工作方式有什么不妥吗?
heroku ×3
bootswatch ×1
css ×1
fonts ×1
gem ×1
git ×1
git-reset ×1
hotlinking ×1
image ×1
imdb ×1
less ×1
libv8 ×1
model ×1
osx-yosemite ×1
rubygems ×1
scalability ×1
ubuntu ×1
undo ×1