我有一个使用Imagemagick的应用程序,但我不得不重建我的环境,现在当我尝试上传一个头像(这就是我使用Imagemagick的原因)时,它在我尝试添加图像时不断给我以下错误.
Avatar Failed to manipulate with MiniMagick, maybe it is not an image? Original Error: ImageMagick/GraphicsMagick is not installed
Run Code Online (Sandbox Code Playgroud)
我将它安装在包含我的应用程序的文件夹中,但似乎应用程序无法识别安装.有没有办法让应用程序识别minimagick或我是否在错误的地方安装它或我完全关闭.
-UPDATE-
我卸载了minimgick并重新安装,但仍然得到相同的错误,虽然它显示它已安装.这是我的版本......
-imagemagick-6.9.1-6
-ruby 2.2.1p85(2015-02-26修订版49769)[x86_64-darwin14]
-Rails 4.0.10
- 在mac上运行
我在rails应用程序上有一个ruby.我按照facebook的说明添加了一个像素.
但是,要跟踪转化,Facebook要求您将页面放入到达所需结果时显示的转换中.即如果我想展示一个客户已经注册,我会在注册后将你去的页面作为跟踪的成功对象.
我的问题是,在我的应用程序中,当客户注册时,没有登录页面.该应用程序将用户带回主页.它在主页上显示一条消息,因此我试图查看是否有办法跟踪控制器操作而不是实际页面的转换.
我需要计算的动作没有页面,它们是控制器动作.有没有人知道如何做到这一点的宝石,文档或最佳实践?
这是进入布局文件的像素......
<!-- Facebook Pixel Code -->
<script>
!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?
n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;
n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;
t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,
document,'script','https://connect.facebook.net/en_US/fbevents.js');
fbq('init', '18027724*****', {
em: 'insert_email_variable,'
});
fbq('track', 'PageView');
</script>
<noscript><img height="1" width="1" style="display:none"
src="https://www.facebook.com/tr?id=180277241*****&ev=PageView&noscript=1"
/></noscript>
<!-- DO NOT MODIFY -->
<!-- End Facebook Pixel Code -->
Run Code Online (Sandbox Code Playgroud)
但是我需要它在控制器中点火......
def create
@reportapproval = current_user.reportapprovals.create(authorization_params)
if @reportapproval.valid?
if @reportapproval.manager_paying_report == true
flash[:notice] = "Please make payment before proceeding"
redirect_to new_managers_charge_path(id: @reportapproval.id)
else
flash[:notice] = "You have requested a report from #{@reportapproval.tenant_last_name}."
redirect_to managers_dashboard_path
@reportapproval.save
end
<----PIXEL FIRES …Run Code Online (Sandbox Code Playgroud) 我有一系列这样的数字......
a= [28, 67, 20, 38, 4, 39, 14, 84, 20, 64, 7, 24, 17, 8, 7, 6, 15, 52, 4, 26]
Run Code Online (Sandbox Code Playgroud)
我需要检查每个数字是否大于30,如果是,那么我想计算这个数字,并计算出多少数量大于30的数量.我有这个,但它到目前为止还没有工作
def late_items
total_late = []
if a.map { |i| i > 30}
total_late << i
end
self.late_items = total_late.count
end
Run Code Online (Sandbox Code Playgroud) 我需要在 Flash 通知中添加换行符。到目前为止我有这个
flash[:success] = "We will notify you when we go LIVE! #{<br />} Meantime, complete this quick survey so we can get to know your interest.
Run Code Online (Sandbox Code Playgroud)
但这是不正确的。有谁知道如何在控制器中正确执行此操作?
我正在使用 ruby 2.2.1p85 和 Rails 4.0.10
我正在尝试制作一个仅验证字母、数字和空格的正则表达式。我不希望接受任何特殊字符(即 # )(*&^%$@!,)
我一直在尝试几件事,但没有给我字母(大写和小写)、数字和空格。
所以它应该接受这样的东西......
John Stevens 12
james stevens
willcall12
Run Code Online (Sandbox Code Playgroud)
或者
12cell space
Run Code Online (Sandbox Code Playgroud)
但不是这个
12cell space!
John@Stevens
james 12 Fall#
Run Code Online (Sandbox Code Playgroud)
我已经尝试了以下
^[a-zA-Z0-9]+$
[\w _]+
^[\w_ ]+$
Run Code Online (Sandbox Code Playgroud)
但它们允许特殊字符或不允许空格。这是用于 ruby 验证。
我在rails模型中有一个对象,可以是字符串或数组.在我看来,我有以下几点:
<% current_user.transaction[:account_name].each do |name| %>
Run Code Online (Sandbox Code Playgroud)
如果对象account_name是字符串,则会引发错误.
我想运行这样的东西:
<% current_user.transaction[:account_name].each, if sting? each_line do |name| %>
Run Code Online (Sandbox Code Playgroud)
使用each_line如果对象是一个字符串,但使用each,如果它是一个数组.我不确定这是否是最佳解决方案.无论对象是数组还是字符串,有何方法可以使其工作?
我有四列,我试图在它们之间添加空间,但是当我将填充放入 css 中时,列仍然很接近,并且填充是在列内添加的。我究竟做错了什么。
/* Create four columns of equal width */
.columns {
float: left;
width: 25%;
padding: 8px 10px;
opacity: .8;
background-color: grey;
border: 2px solid #eee;
text-align: center;
box-sizing: border-box;
-webkit-transition: 0.3s;
transition: 0.3s;
}Run Code Online (Sandbox Code Playgroud)
<div class="columns">
<%= image_tag("sign-up.ico", align: "center", class:"ico") %>
<h5>Sign-Up</h5></br>
<p>Create A <u>FREE</u> Account to make rent payments to your landlord</p>
</div>
<div class="columns">
<%= image_tag("cash_wallet.ico", class:"ico") %>
<h5>Make your rent payments</h5></br>
<p>Make rent payments thru your LikeHome account & we report history to …Run Code Online (Sandbox Code Playgroud)