<a>
出于某种原因,我必须在标签中包装我的图标.
有没有可能的方法将字体 - 真棒图标的颜色更改为黑色?
或者只要它包裹在<a>
标签内是不可能的?字体真棒应该是字体而不是图像,对吧?
<a href="/users/edit"><i class="icon-cog"></i> Edit profile</a>
Run Code Online (Sandbox Code Playgroud) 我收到这个错误
未知验证器:'MessageValidator'
我不知道为什么我会这样做.
我的代码出了什么问题?
validates :title,
:presence => true,
:uniqueness => true,
:length => { :maximum => 100 },
:message => "Must be input and has to be less than 100 characters, and unique."
Run Code Online (Sandbox Code Playgroud) 在后台,我希望它重新加载并显示有多少未读消息.
我希望没有刷新页面.我的意思是使用ajax.
如果我在菜单中有这个,我怎么能每隔30秒刷新一次这个部分?
<li><%= link_to sanitize('<i class="icon-envelope"></i> ') + "received messages" + sanitize(' <span class="badge badge-info">'+current_user.mailbox.inbox(:read => false).count(:id, :distinct => true).to_s+'</span>'), messages_received_path %></li>
Run Code Online (Sandbox Code Playgroud)
messages_controller.rb
def received
if params[:search]
@messages = current_user.mailbox.inbox.search_messages(@search).page(params[:page]).per(10)
else
@messages = current_user.mailbox.inbox.page(params[:page]).per(10)
end
add_crumb 'Messages Received', messages_received_path
@box = 'inbox'
render :index
end
Run Code Online (Sandbox Code Playgroud)
更新:_ __ _ __ _ __ _ __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
资产/ JavaScript的/ refresh_messages_count.js
$(document).ready(function () { …
Run Code Online (Sandbox Code Playgroud) 目前我设置0777
了所有目录和文件.
但是,我害怕被别人访问.
日志文件和配置中的所有控制器,模型,视图和文件都设置为0777
一般来说,他们应该如何设置?
我创建了_form.html.erb,其编码方式如此
<%= form_for @book, :html => { :class => 'form-horizontal' } do |f| %>
....
<%= f.submit nil, :class => 'btn btn-primary', :name => 'update' %>
<%= f.submit 'Destroy', :class => 'btn btn-danger', :name => 'destroy' %>
....
<% end %>
Run Code Online (Sandbox Code Playgroud)
是的,我确实有2个以相同形式提交的提交,并且它们都有诸如'update'和'destroy'之类的名称.
当用户按下destroy按钮时,将调用books_controller中的更新操作.
并判断是否"更新"或"销毁"请求.
为此,我怎样才能在控制器中获取其名称参数?
更新动作将是这样的
def update
if params[:books][:name] == 'destroy'
destroy transaction
else
update transaction
end
end
Run Code Online (Sandbox Code Playgroud) 我正在使用Devise.
当用户成功确认时,将显示flash消息.
我想添加一个链接.
所以我想要这条消息
Your account was successfully confirmed. You are now signed in. Go to your profile page, and edit it!
那部分profile
应该是链接example.com/users/username/edit
我怎样才能成功呢?
devise.en.yml
confirmations:
confirmed: 'Your account was successfully confirmed. You are now signed in.'
Run Code Online (Sandbox Code Playgroud) 我让新用户名为"rails"
然后将所有目录和文件的所有者和组设置为"rails"
我确实有应用 /var/www/html/app
所以我应该这样做$ cd /var/www/html/app
并执行它?
find . -type d | xargs chmod 0755 and find . -type f | xargs chmod 0644
Run Code Online (Sandbox Code Playgroud)
是否会为所有事情设置许可,一切都会好起来的?
此代码显示属于当前社区的CommunityTopic的所有记录.如何将数字限制为10条记录显示在这里?
<ul>
<% @community.community_topics.each do |topic| %>
<li>
<%= link_to topic.title, community_topic_path(@community, topic) %>
<%= link_to topic.user.user_profile.nickname, community_topic_path(@community, topic) %>
</li>
<% end %>
</ul>
Run Code Online (Sandbox Code Playgroud) 这是我的代码.
尽管它已经确认,但它在点击时不会显示任何对话框.
为什么?
视图
<%= button_tag( :name => 'destroy', :class => "btn btn-danger", :confirm => 'Are you sure?') do %>
Remove
<% end %>
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用名为的宝石 Simple Captcha
这需要在机器上安装ImageMagick.我安装了它并convert --version
显示了这一点
Version: ImageMagick 6.8.2-10 2013-02-12 Q16 http://www.imagemagick.org
Copyright: Copyright (C) 1999-2013 ImageMagick Studio LLC
Features: DPC OpenMP
Delegates: bzlib freetype jng jpeg lcms png ps tiff x xml zlib
Run Code Online (Sandbox Code Playgroud)
但是,当SimpleCaptcha工作时,它不会显示生成的图像.
所以我看了一下日志.它说这个
StandardError (Error while running convert: sh: convert: command not found):
galetahub-simple_captcha (0.1.3) lib/simple_captcha/utils.rb:17:in `run'
galetahub-simple_captcha (0.1.3) lib/simple_captcha/image.rb:76:in `generate_simple_captcha_image'
galetahub-simple_captcha (0.1.3) lib/simple_captcha/middleware.rb:36:in `make_image'
galetahub-simple_captcha (0.1.3) lib/simple_captcha/middleware.rb:18:in `call'
...
Run Code Online (Sandbox Code Playgroud)
我怎么解决这个问题?
captcha ×1
css ×1
devise ×1
font-awesome ×1
html ×1
imagemagick ×1
jquery ×1
validation ×1
view ×1