小编Jos*_*ose的帖子

如何使用收件人的区域设置在Rails 3中发送电子邮件?

如何使用收件人的区域设置在邮件程序中发送邮件.我有数据库中每个用户的首选语言环境.请注意,这与当前区域设置(I18n.locale)不同,只要当前用户不必是收件人即可.所以困难的是在不改变I18n.locale的情况下在不同的语言环境中使用邮件程序:

def new_follower(user, follower)
  @follower = follower
  @user = user
  mail :to=>@user.email
end
Run Code Online (Sandbox Code Playgroud)

在mail:to => ...之前使用I18n.locale = @ user.profile.locale将解决邮件程序问题,但会改变线程其余部分的行为.

actionmailer internationalization ruby-on-rails-3

24
推荐指数
3
解决办法
9386
查看次数

节点不需要*.coffee文件

根据/sf/answers/333835561/,我应该能够从.js文件中获取.coffee文件:

$ echo 'console.log "works"' > module.coffee

$ echo '
> require("coffee-script")
> require("./module")
> ' > test.js

$ node test.js
works
Run Code Online (Sandbox Code Playgroud)

但是,当我这样做时,我在运行test.js时收到此消息:

module.js:340
    throw err;
      ^
Error: Cannot find module './module'
  at Function.Module._resolveFilename (module.js:338:15)
  at Function.Module._load (module.js:280:25)
  at Module.require (module.js:364:17)
  at require (module.js:380:17)
  at Object.<anonymous> (/Users/jose/Desktop/pedo/test.js:2:1)
  at Module._compile (module.js:456:26)
  at Object.Module._extensions..js (module.js:474:10)
  at Module.load (module.js:356:32)
  at Function.Module._load (module.js:312:12)
  at Function.Module.runMain (module.js:497:10)
  at startup (node.js:119:16)
  at node.js:902:3
Run Code Online (Sandbox Code Playgroud)

我正在使用NVM安装Node 0.10.25.还使用使用NPM 1.3.24安装的CoffeeScript 1.7.1.

require node.js coffeescript

0
推荐指数
1
解决办法
820
查看次数