我不知道为什么我无法检查我之前工作过的分支机构.请参阅以下命令(注意:co是别名checkout):
ramon@ramon-desktop:~/source/unstilted$ git branch -a
* develop
feature/datts_right
feature/user_controlled_menu
feature/user_controlled_site_layouts
master
remotes/origin/HEAD -> origin/master
remotes/origin/develop
remotes/origin/feature/datts_right
remotes/origin/master
ramon@ramon-desktop:~/source/unstilted$ git co feature/user_controlled_site_layouts
error: pathspec 'feature/user_controlled_site_layouts' did not match any file(s) known to git.
Run Code Online (Sandbox Code Playgroud)
我不确定这意味着什么,我似乎无法在Google上找到任何我能理解的内容.
如何查看该分支,以及我可以采取哪些措施来解决这个问题?
更新:
我找到了这个帖子,跑步git show-ref给了我:
97e2cb33914e763ff92bbe38531d3fd02408da46 refs/heads/develop
c438c439c66da3f2356d2449505c073549b221c1 refs/heads/feature/datts_right
11a90dae8897ceed318700b9af3019f4b4dceb1e refs/heads/feature/user_controlled_menu
c889b37a5ee690986935c9c74b71999e2cf3c6d7 refs/heads/master
c889b37a5ee690986935c9c74b71999e2cf3c6d7 refs/remotes/origin/HEAD
e7c17eb40610505eea4e6687e4572191216ad4c6 refs/remotes/origin/develop
c438c439c66da3f2356d2449505c073549b221c1 refs/remotes/origin/feature/datts_right
c889b37a5ee690986935c9c74b71999e2cf3c6d7 refs/remotes/origin/master
23768aa5425cbf29d10ff24274adad42d90d15cc refs/stash
e572cf91e95da03f04a5e51820f58a7306ce01de refs/tags/menu_shows_published_only
429ebaa895d9d41d835a34da72676caa75902e3d refs/tags/slow_dev
Run Code Online (Sandbox Code Playgroud)
.git目录上的UPDATE(user_controlled_site_layouts在refs/heads/feature folder)中:
$ ls …Run Code Online (Sandbox Code Playgroud) 我正在尝试将图像上传到PingFM.他们的文件说:
media – base64 encoded media data.
Run Code Online (Sandbox Code Playgroud)
我可以通过URL访问此图像.我试过(几乎猜到了)这个:
ActiveSupport::Base64.encode64(open("http://image.com/img.jpg"))
Run Code Online (Sandbox Code Playgroud)
但我得到这个错误:
TypeError: can't convert Tempfile into String
from /usr/lib/ruby/1.8/base64.rb:97:in `pack'
from /usr/lib/ruby/1.8/base64.rb:97:in `encode64'
from (irb):19
from :0
Run Code Online (Sandbox Code Playgroud) 我已经为我的Rails应用程序(3.0.1)安装了Devise,它主要用于工作.我似乎无法自定义邮件程序视图.
app/controllers/users/,就像这样app/controllers/users/sessions_controller.rbapp/views/users/这样的app/views/users/registrations/new.html.haml
devise_for :users, :controllers => {
:sessions => "users/sessions",
:registrations => "users/registrations",
:passwords => "users/passwords",
:confirmations => "users/confirmations",
:unlocks => "users/unlocks"
} do
get "/login" => "devise/sessions#new"
get "/logout" => "devise/sessions#destroy"
end
至少在上面的一切都有效.但是,在发送邮件时,Devise似乎使用的模板不是我编辑过的模板app/views/users/mailer/.设计似乎仍然是默认的(好像我从未编辑过文件).我猜测Devise仍然使用gem中的文件.
如果它有帮助,这是黄瓜错误:
Feature: Manage accounts
In order to manage accounts
users
should be able to signup
# By default, www.example.com is the host when testing.
# This is a problem because when our …Run Code Online (Sandbox Code Playgroud) 我正在学习如何在Rails中创建一个多租户应用程序,该应用程序根据用于查看应用程序的域或子域来提供来自不同模式的数据.
我已经回答了一些问题:
这三点涵盖了我需要知道的许多一般内容.但是,在接下来的步骤中,我似乎有许多实现方法.我希望有更好,更简单的方法.
当新用户注册时,我可以轻松创建架构.但是,加载其余模式已有的结构的最佳和最简单的方法是什么?以下是一些可能为您提供更好主意的问题/方案.
谢谢,我希望不会太久!
基于我所读到的内容(如果我弄错了,请纠正我),处理模型应该保存的逻辑以及下一步转换的逻辑应该在路由器中.
如果是这种情况,我遇到了一个问题:我不知道如何从路线访问模型.
这是我的控制器(并且在我按下提交后控制台记录"CREATED"):
App.ScoutsNewController = Ember.ObjectController.extend
submit: ->
model = @get('model')
model.on 'didCreate', ->
console.log 'CREATED' # I want to redirect to the index after creation
model.save()
Run Code Online (Sandbox Code Playgroud)
我应该将这条逻辑移到路线上,对吗?我们试试看:
App.ScoutsNewRoute = Ember.Route.extend
model: ->
App.Scout.createRecord()
events:
submit: ->
# Based on what I've read, the right place to put the code you see in the controller is here. How do I get access to the model?
# I have tried @get('model'), @get('content')
Run Code Online (Sandbox Code Playgroud)
注意:我知道提交事件从视图,控制器,然后最终路由起泡,停在任何一个已定义"提交"的路由.因为我想要路由来处理它,我删除了控制器.我能够console.log在路线中看到任何完成,我只需要能够到达模型实例.
我正在使用 Ember v1.0.0-rc.5-7-g610589a
谢谢!
我不是Rails或Rspec的新手,但我是制作宝石的新手.当我测试我的控制器时,REST方法"get","post","put","delete"给我一个未定义的方法错误.
您可以在下面找到代码,但如果您希望在贴图中看到它,请单击此处.
谢谢!
这是我的spec_helper:
$LOAD_PATH.unshift(File.dirname(__FILE__))
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'active_support' unless defined? ActiveSupport # Need this so that mattr_accessor will work in Subscriber module
require 'active_record/acts/subscribable'
require 'active_record/acts/subscriber'
require 'action_view'
require 'action_controller' # Since we'll be testing subscriptions controller
#require 'action_controller/test_process'
require 'spec'
require 'spec/autorun'
# Need active_support to user mattr_accessor in Subscriber module, and to set the following inflection
ActiveSupport::Inflector.inflections do |inflect|
inflect.irregular 'dorkus', 'dorkuses'
end
require 'active_record' # Since we'll be testing a User …Run Code Online (Sandbox Code Playgroud) 我一直在Ubuntu 9.10上的ImageMagick上播放图像.我希望能够让它识别字体,以便我可以用它的"昵称"来称呼它.
我可以通过输入找到ImageMagick识别的字体列表
identify -list fontRun Code Online (Sandbox Code Playgroud)
在那个列表中,我看到了Times-Bold.因此
convert -font Times-Bold label:abcdef times.gifRun Code Online (Sandbox Code Playgroud)
将使用Times New Roman Bold字体生成一个gif文件.
我知道我可以将路径传递给字体而不是它的昵称,但是我需要能够使用它的昵称,这样我在从系统移动到系统时会有更少的错误.我试图开始工作的字体是一种名为Segoe UI的真实字体.
我已经在我的系统中安装了Segoe UI.如果我将路径传递给它工作的字体.但我希望能够使用类似的东西
convert -font Segoe-UI label:abcdef segoe.gifRun Code Online (Sandbox Code Playgroud)
谢谢!
我正在尝试在液体布局中渲染液体模板(Liquid Template lang,而不是CSS液体布局的东西).我似乎无法获得渲染的布局部分.目前使用:
assigns = {'page_name' => 'test'}
@layout = Liquid::Template.parse(File.new(@theme.layout.path).read)
@template = Liquid::Template.parse(File.new(self.template.path).read)
@rend_temp = @template.render(assigns)
@rend_layout = @layout.render({'content_for_layout' => @rend_temp})
render :text => @rend_layout, :content_type => :html
Run Code Online (Sandbox Code Playgroud)
页面生成的HTML显示"模板"以流畅的方式呈现,但不包含布局(使用呈现的模板替换布局中的"content_for_layout")
我一直在寻找使用RSpec创建gem的方法,但还没有找到描述性的教程.
我从Ryan Bates的制作宝石开始,但我正在寻找一个讨论用RSpec创建一个acts_as样式宝石的教程.
通过acts_as,我的意思是说gem将某些方法添加到Rails中的现有类中.为什么这很重要?因为我找到了像New Gem这样的宝石模板,有一个规范可以运行但是当我尝试测试一个Active Record对象时它会开始窒息.我已经尝试在spec_helper.rb中要求active_record但我必须做错了,因为它没有解决问题.
说到插件,我发现了这个Rails指南.如果周围有一个宝石版本那就太棒了.
多谢你们!
PS我喜欢截屏.
我正在对文本编辑器进行更改,我需要能够选择文本以使用 JavaScript 对其进行操作。如何使用 Cucumber、Capybara 和 Selenium 选择文本?
ruby ×3
gem ×2
rspec ×2
base64 ×1
capybara ×1
coffeescript ×1
cucumber ×1
devise ×1
ember.js ×1
encode ×1
fonts ×1
git ×1
imagemagick ×1
installation ×1
liquid ×1
multi-tenant ×1
postgresql ×1
schema ×1
selenium ×1
testing ×1