我想使用通用代码,并且在完成最基本的功能时遇到了困难.
我想创建一个测试的短名称和一个我的部署,我在Disqus管理面板中做了.
这是我的show动作中的disqus代码:
# inside show.html.erb
<%= render raw 'comments' %>
# partial "comments"
<div id="disqus_thread"></div>
<script type="text/javascript">
var disqus_shortname = '<%= Post::DISQUS_SHORTNAME %>';
var disqus_identifier = '<%= @post.id %>';
var disqus_url = '<%= url_for([:blog, @topic, @post])%>';
(function() {
var dsq = document.createElement('script'); dsq.type = 'text/javascript'; dsq.async = true;
dsq.src = 'http://' + disqus_shortname + '.disqus.com/embed.js';
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(dsq);
})();
</script>
<noscript>Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a></noscript>
<a href="http://disqus.com" class="dsq-brlink">blog comments …Run Code Online (Sandbox Code Playgroud) 我有一个用于生产和开发的S3桶.我已完成我的研究并遇到了这篇文章,但我当前的配置无法按预期工作.我在本地获得以下异常(下面),我从我的heroku应用程序中没有上传到我的S3存储桶的文件:
is not a recognized storage provider
Extracted source (around line #3):
1:
2: <p><%= user.name %></p>
3: <%= image_tag user.avatar.url %>
4: <%= link_to 'Show', user %>
5: <%= link_to 'Edit', edit_user_path(user) %>
6: <%= link_to 'Destroy', user, confirm: 'Are you sure?', method: :delete %>
Run Code Online (Sandbox Code Playgroud)
但是,当我storage :file在*_uploader.rb文件内部设置时,一切都按预期在本地工作.但仍然注意到有人被送到我的S3桶.
这是我的设置:
user.rb
class User < ActiveRecord::Base
attr_accessible :name, :avatar, :avatar_cache, :remote_avatar_url, :remove_avatar
mount_uploader :avatar, AvatarUploader
end
Run Code Online (Sandbox Code Playgroud)
fog.rb
CarrierWave.configure do |config|
if Rails.env.production?
config.storage = :fog …Run Code Online (Sandbox Code Playgroud) 使用rugged你如何执行以下操作:fetch,pull和rebase?
我正在使用该development分支,并在查看此处的文档后,将其作为Remote课程指南.
编辑:既然git pull仅仅是一个速记git fetch和git merge FETCH_HEAD更好的问题是如何执行git fetch,git merge以及git rebase.
问题: 如何使用ActiveAdmin和Devise 2实现下面的模型设计?
我已成功使用现有User模型设置active_admin以进行自举.
我假设这个模型设计意味着("让管理员管理用户").
这是我目前的模型设置:
irb(main):003:0> User.column_names
=> ["id", "created_at", "updated_at", "avatar", "name"]
irb(main):004:0> AdminUser.column_names
=> ["id", "email", "encrypted_password", "reset_password_token", "reset_password_sent_at", "remember_created_at", "sign_in_count", "current_sign_in_at", "last_sign_in_at", "current_sign_in_ip", "last_sign_in_ip", "created_at", "updated_at"]
Run Code Online (Sandbox Code Playgroud)
现在我想为我的User模型添加一些authenticaton.但是,rails generate devise User如果没有此冲突,我无法迁移结果:
== AddDeviseToUsers: migrating ===============================================
-- change_table(:users)
-> 0.7201s
-- add_index(:users, :email, {:unique=>true})
rake aborted!
An error has occurred, this and all later migrations canceled:
PG::Error: ERROR: could not create unique index "index_users_on_email"
DETAIL: Key (email)=() is duplicated.
: CREATE UNIQUE INDEX "index_users_on_email" …Run Code Online (Sandbox Code Playgroud) 寻求解决方案以实现以下目标:
到目前为止,我已经有了它的工作,但不是那里.我的问题实际上是后者,但我想花点时间重新思考整个事情并获得一些关于如何更好地写这个的反馈.
当分支在那里时,变量existing_branch提供SHA和refs/heads/branchName,否则git将保持并提供预期的fatal:
check_for_branch() {
args=("$@")
echo `$branch${args[0]}`
existing_branch=$?
}
create_branch() {
current="git rev-parse --abbrev-ref HEAD"
branch="git show-ref --verify refs/heads/"
args=("$@")
branch_present=$(check_for_branch ${args[0]})
echo $branch_present
read -p "Do you really want to create branch $1 " ans
case $ans in
y | Y | yes | YES | Yes)
if [ ! -z branch_present ]; then
echo "Branch already exists"
else
`git branch ${args[0]}`
echo "Created ${args[0]} branch"
fi
;;
n …Run Code Online (Sandbox Code Playgroud) 更新: 此问题已被修改,以反映下面非常有用的评论和答案.我已经接受了答案,但是到目前为止还没有完整的功能.
.ctags的内容(在〜/中)
-R
--exclude=.git
--exclude=log
--verbose=yes
--langdef=scss
--langmap=scss:.scss
--regex-scss=/^[ \t]*([^\t {][^{]{1,100})(\t| )*\{/| \1/d,definition/
--regex-scss=/^[@]mixin ([^ (]+).*/\1/m,mixing/
Run Code Online (Sandbox Code Playgroud)
当我将光标放在目标下时,vim说 E426 tag not found: tag_name
考虑以下模式:
footer{
.wrapper{
.general-info{
.footer-links{
a{@include ticker($bg, $white);}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
在目录中的单独文件(modules.scss)中,我有ticker的定义:
@mixin ticker($color, $bg-color) {
color: $color;
background-color: $bg-color;
}
Run Code Online (Sandbox Code Playgroud)
当我将光标放在目标下时,vim仍然说 E426 tag not found: tag_name
ctags不会对tickermixin 编制索引.但是我可以使用ctags直接从SCSS gem中查找方法(例如,变暗).
git ×2
activeadmin ×1
bash ×1
carrierwave ×1
css ×1
ctags ×1
devise ×1
disqus ×1
fog ×1
javascript ×1
ruby ×1
rugged ×1
sass ×1
scripting ×1
vim ×1