我已经在Yosemite上安装了imagemagick,但在安装过程中我遇到了这个错误......
Linking /usr/local/Cellar/libtool/2.4.2...
Error: Could not symlink share/info/libtool.info
/usr/local/share/info is not writable.
我试过brew link libtool但得到同样的错误
我试过跑步 brew doctor and brew prune
我还能做些什么来尝试正确安装?
我有一个问题按当前日期排序数组.
我的数据库有一个名为的字段 day
day有周如的日子:Monday,Tuesday,等.
我正在尝试按索引视图页面排序current day.
我想在我的控制器中做这样的事情,
@happies = Happy.where(id: @search.results.map(&:id))
.page(params[:page])
.where(:day => Date.today.strftime('%A').capitalize.to_s)
Run Code Online (Sandbox Code Playgroud)
但而不是返回only与天人们高兴Monday我想order通过day这里day等于current day.
在我看来,我也考虑过这样做
喜欢的东西
<% @happies.sort_by(:day => Date.today.strftime('%A').capitalize.to_s).each do |happy| %>
上面的方法不起作用,但是我试图实现我想达到的目标.有关如何实现这一点的任何想法?
也许有一个activeview助手?
我的admin:boolean用户模型中有一个字段,并且希望能够在我们的控制器中检查用户是否为管理员,然后才能编辑任何内容.
如何修改before_action :authenticate_user!, only: [:edit]以检查用户是否是管理员?
我正在为控制器操作构建一个worker,但是由于我在perform方法中调用params,sidekiq将无法启动.有关如何使其工作的任何想法?
调节器
def call_warrants_with_date_range
CallLogWorker.perform_async(params[:call_log])
redirect_to call_logs_path, notice: 'Calls were successfully made.'
end
Run Code Online (Sandbox Code Playgroud)
工人
class CallLogWorker
include Sidekiq::Worker
def perform(params[:call_log])
client = Twilio::REST::Client.new TWILIO_ACCOUNT_SID, TWILIO_ACCOUNT_AUTH_TOKEN
start_date = params[:call_log][:warrant_start_date]
end_date = params[:call_log][:warrant_end_date]
query = "SELECT people.id, warrants.warn_type, warrants.warn_date_issued, phone_numbers.phone_number
FROM people
LEFT OUTER JOIN warrants ON people.id = warrants.person_id
LEFT OUTER JOIN phone_numbers ON people.id = phone_numbers.person_id
WHERE warrants.warn_date_issued BETWEEN ? AND ? AND warrants.warn_type = 'AW'"
@numbers = CallLog.find_by_sql(["#{query}", start_date, end_date])
@numbers.each do |dial|
begin
call = client.account.calls.create( …Run Code Online (Sandbox Code Playgroud)