actionmailer delayed job error

i have a strange bug using mailer and delayed job with rails 3 and ruby 1.9.2. I have a method in my mailer def new_site_message(sitereq) @footer = Textvar.where(:title => "email_footer").first @sitereq = Sitereq.first mail(:to => EmailGroup.where(:name => "new_sitemessage_group").first.emails.map(&:email).join(", "), :subject => "Test") end It works good while und

actionmailer推迟了作业错误

我有一个奇怪的错误使用邮件和延迟工作与轨3和红宝石1.9.2。 我在邮件中有一个方法 def new_site_message(sitereq) @footer = Textvar.where(:title => "email_footer").first @sitereq = Sitereq.first mail(:to => EmailGroup.where(:name => "new_sitemessage_group").first.emails.map(&:email).join(", "), :subject => "Test") end 它工作得很好,延迟工作无延迟。 但是当我延迟它 - 我

"bash : command not found" error

I am trying to setup my machine for development and I keep getting the error, -bash: command not found . I am getting while running various commands. I am brand new to this, trying to get into development, and am not sure how to fix it. From what I have read it may have something to do with my PATH. Again, I'm new to this so I really have no clue. new-host:~ Home$ echo $PATH /opt/local

“bash:command not found”错误

我正在尝试设置我的机器进行开发,并且不断收到错误, -bash: command not found 。 我正在运行各种命令。 我是这个品牌的新手,试图进入开发阶段,我不知道如何解决这个问题。 从我读过的内容来看,它可能与我的PATH有关。 再次,我是新来的,所以我真的不知道。 new-host:~ Home$ echo $PATH /opt/local/bin:/opt/local/sbin:/usr/local/rvm/gems/ruby-1.9.3-p194/bin:/usr/local/rvm/gems/ruby-1.9.3-p194@全球/斌:/u

How to modify PATH for Homebrew?

Trying to install ruby 1.9.3, read that I need to install homebrew first. Ran brew doctor, and it's giving me a bunch of warnings. One of which is: Warning: /usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. The following tools exist at both paths: easy_install easy_install-2.6 Consider amending your PATH s

如何修改PATH for Homebrew?

试图安装红宝石1.9.3,请阅读我需要先安装自制软件。 冉酿博士,这给了我一堆警告。 其中之一是: 警告:/ usr / bin出现在/ usr / local / bin之前这意味着将使用系统提供的程序而不是由Homebrew提供的程序。 两种路径都有以下工具: easy_install easy_install-2.6 考虑修改PATH,以便/ usr / local / bin位于PATH中的/ usr / bin之前。 人们如何做到这里所要求的? 打开/ etc / paths文件,将/ usr / local / bin

ruby 1.9.1 error after installing compass gems

I installed compass on ubuntu 12.04 like so: sudo gem install compass sudo gem install sass But after running this command: compass version I get this error: /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in require': cannot load such file -- sass/script/node (LoadError) from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in rescue in requ

安装指南针宝石后,红宝石1.9.1错误

我在Ubuntu 12.04上安装了指南针,如下所示: sudo gem install compass sudo gem install sass 但是在运行这个命令之后: compass version 我得到这个错误: /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in require': cannot load such file -- sass/script/node (LoadError) from /usr/local/lib/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in rescue in require from

How do I start IRB console from a rake task?

I'm trying to write a rake task that will set up an environment mirroring my project. task :environment do require 'rubygems' require 'sequel' # require 'my_projects_special_files' end task :foo => [:environment] do require 'irb' IRB.start end Leads to irb complaining that "foo" doesn't exist (the name of the task) 10:28:01:irb_test >> rake foo --trace (in /Us

如何从rake任务启动IRB控制台?

我正在尝试编写一个rake任务,它将设置一个镜像我的项目的环境。 task :environment do require 'rubygems' require 'sequel' # require 'my_projects_special_files' end task :foo => [:environment] do require 'irb' IRB.start end 导致irb抱怨“foo”不存在(任务的名称) 10:28:01:irb_test >> rake foo --trace (in /Users/mwlang/projects/personal/rake/irb_test) ** Invoke foo (first_time) ** Invok

Format output to 40 characters long per line

I'm fairly new to Ruby and I've been searching Google for a few hours now. Does anyone know how to format the output of a print to be no more than 40 characters long? For example: What I want to print: This is a simple sentence. This simple sentence appears on four lines. But I want it formatted as: This is a simple sentence. This simple sentence appears on four lines. I have ea

将输出格式化为每行40个字符

我对Ruby相当陌生,现在我一直在Google上搜索几个小时。 有谁知道如何格式化打印输出不超过40个字符长? 例如: 我想要打印的内容: This is a simple sentence. This simple sentence appears on four lines. 但我希望它的格式如下: This is a simple sentence. This simple sentence appears on four lines. 我把原来的每一行放入数组中。 所以x = ["This is a simple sentence.", "This simple&q

loop over hash in defined order in ruby template

I have a ruby template (.erb) that I want to iterate over a hash. It should produce the same output file each time the puppet agent runs. What I currently have is the following. This is my template (part of rsyslog config if anyone is wondering): <% log_files.each do |log_file, tag| -%> # <%= log_file %> $InputFileName <%= log_file %> $InputFileTag <%= tag %>: This t

在ruby模板中按照定义的顺序循环散列

我有一个红宝石模板(.erb),我想在一个散列上迭代。 每次puppet代理运行时,它应该产生相同的输出文件。 我目前拥有的是以下内容。 这是我的模板(rsyslog配置的一部分,如果有人想知道): <% log_files.each do |log_file, tag| -%> # <%= log_file %> $InputFileName <%= log_file %> $InputFileTag <%= tag %>: 该模板使用如下所示的散列呈现: log_files => { '/root/apache_auth.loc

Sorting a YAML output in an ERB template

In an ERB template used by Puppet, I'm trying to sort a YAML output of a hash to make sure it's always the same output. Here is what I have so far (in mytest/templates/hash.erb ): <%= class MyHash < Hash def to_yaml( opts = {} ) YAML::quick_emit( self, opts ) do |out| out.map( taguri, to_yaml_style ) do |map| keys.sort.each do |k| v = sel

在ERB模板中排序YAML输出

在Puppet使用的ERB模板中,我试图对散列的YAML输出进行排序,以确保它始终是相同的输出。 这是我到目前为止(在mytest/templates/hash.erb ): <%= class MyHash < Hash def to_yaml( opts = {} ) YAML::quick_emit( self, opts ) do |out| out.map( taguri, to_yaml_style ) do |map| keys.sort.each do |k| v = self[k] map.add( k, v ) end

Preventing session fixation in ruby sinatra

Most of the session fixation topics in ruby are mostly related to rails. Are there any session fixation vulnerabilities in sinatra? In rails we are mostly recommended to do reset_session before assigning sessions. How can we prevent session fixation in sinatra? Sinatra by default uses the Rack::Protection gem which protects against a lot of common vulnerabilities. You might be particularly

防止在红宝石sinatra会议固定

大多数红宝石的会话固定主题都与轨道有关。 sinatra中有会话固定漏洞吗? 在rails中,我们大多建议在分配会话之前先执行reset_session。 我们如何防止sinatra中的会话固定? Sinatra默认使用Rack :: Protection gem,它可以抵御很多常见的漏洞。 您可能对会话劫持保护特别感兴趣。 这些是Rack :: Protection gem所保护的部分内容: 跨站请求伪造 真实性标记:只有在给定的访问令牌与会话中包含的令牌相匹配时才接受不

RPC using EventMachine & RabbitMQ

I've been starting to play around with RabbitMQ RPC sample code provided in AMQP gem doc, trying to write very simple code performing synchronous remote calls: require "amqp" module RPC class Base include EM::Deferrable def rabbit(rabbit_callback) rabbit_loop = Proc.new { AMQP.connect do |connection| AMQP::Channel.new(connection) do |channel| c

RPC使用EventMachine&RabbitMQ

我已经开始尝试使用AMQP gem doc中提供的RabbitMQ RPC示例代码,尝试编写执行同步远程调用的非常简单的代码: require "amqp" module RPC class Base include EM::Deferrable def rabbit(rabbit_callback) rabbit_loop = Proc.new { AMQP.connect do |connection| AMQP::Channel.new(connection) do |channel| channel.queue("rpc.queue", :exclusive => false, :durable =&