这就是我所拥有的:
state_machine :state, :initial => :open do
after_transition :on => :buy, :do => :send_buy_notification_email
after_transition :on => :take, :do => :send_take_notification_email
after_transition :on => :accept, :do => :send_accept_notification_email
after_transition :on => :cancel, :do => :send_cancel_notification_email
Run Code Online (Sandbox Code Playgroud)
现在我想在初始状态打开时触发:send_trade_notification_email.
我怎么做?
干杯,
乔尔
当我生成包含éèà等字符的文本的PDF时,我确实会得到有趣的字符.
我知道这必须与编码有关.
我在字符串上尝试使用force_encoding("UTF-8"),但这些字符没有成功.
乔尔
环境Mac OS X Rails 4.0.4 Ruby 2.1.1
宝石: simple_form
创建一个带有json类型字段的模型,这里是我的迁移文件:
create_table :my_model do |t|
t.string :name
t.json :my_field
t.timestamps
end
Run Code Online (Sandbox Code Playgroud)
现在当我尝试创建一个New对象(New form)时,我收到了这个错误
RuntimeError - No input found for json:
simple_form (3.0.2) lib/simple_form/form_builder.rb:551:in `find_mapping'
simple_form (3.0.2) lib/simple_form/form_builder.rb:482:in `find_input'
simple_form (3.0.2) lib/simple_form/form_builder.rb:111:in `input'
Run Code Online (Sandbox Code Playgroud)
我猜测simple_form没有很好地处理JSON类型,我真的不知道如何解决这个问题(newbie with simple_form).
希望你能帮忙
从我的终端:
$ heroku pg:psql --app my-app
---> Connecting to HEROKU_POSTGRESQL_CYAN_URL (DATABASE_URL)
sh: psql: command not found
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用命令行工具部署一个简单的ExpressJS应用程序,我必须使用Openshift.我在下面提供了一个调试跟踪:
>npm info ok
Preparing build for deployment
Deployment id is 5e2abc99
Activating deployment
HAProxy already running
HAProxy instance is started
Starting NodeJS cartridge
Sat Aug 15 2015 15:17:47 GMT-0400 (EDT): Starting application 'xxxxx' ...
Waiting for application port (8080) become available ...
Application 'xxxxx' failed to start (port 8080 not available)
Run Code Online (Sandbox Code Playgroud)
和
Git Post-Receive Result: failure
Activation status: failure
Activation failed for the following gears:
55cf8fc589f5cf9dbf00023c (Error activating gear: CLIENT_ERROR: Failed to execute: 'control start' …Run Code Online (Sandbox Code Playgroud) 我安装pm2在 Windows Server 2012 上
npm install pm2 -g
Run Code Online (Sandbox Code Playgroud)
我关闭了我的 PowerShell 并再次打开它。
当我尝试运行pm2它时失败并出现此错误
> pm2 list
pm2 : The term 'pm2' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the
spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ pm2 list
+ ~~~
+ CategoryInfo : ObjectNotFound: (pm2:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException …Run Code Online (Sandbox Code Playgroud) 我正在将在Ubuntu 14.04上编译的代码移植到16.04。我已经克隆了我的 git repo,安装了依赖项并尝试了通常的make命令,很快我就遇到了g++: internal compiler error: Segmentation fault (program cc1plus)......但我不确定从哪里开始诊断和解决这个问题。
我会尽可能多地分享,看看是否有人可以指导我解决问题。
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
Run Code Online (Sandbox Code Playgroud)
$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Run Code Online (Sandbox Code Playgroud)
$ python --version
Python 2.7.12
Run Code Online (Sandbox Code Playgroud)
PYTHON /usr/bin/python2.7
ARCH x86_64
OS Linux
VERSION 4.4.071generic
PLATFORM linux2
HOSTNAME deploy
USER myUser
WUSS_BUILD NO
CCVER gcc
PYLIBDIR build.x86_64-linux2
LIBDIR build.x86_64-linux2
BINDIR build.x86_64-linux2 …Run Code Online (Sandbox Code Playgroud) 我的共享能力受到限制,因为这是我从Ubuntu 14.04移植到16.04的大量代码的一部分。
这应该是微不足道的,但是我却为此而苦苦挣扎。找不到numpy/arrayobject.h我在源文件中引用的#include <numpy/arrayobject.h>
我将尽力分享尽可能多的东西,看看是否有人可以指导我解决问题。
$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial
Run Code Online (Sandbox Code Playgroud)
$ make --version
GNU Make 4.1
Built for x86_64-pc-linux-gnu
Run Code Online (Sandbox Code Playgroud)
$ g++ --version
g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609
Run Code Online (Sandbox Code Playgroud)
升级到
# g++ --version
g++ (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even …Run Code Online (Sandbox Code Playgroud) 我的笔记本电脑坏了,我需要从另一台电脑编码.
我正在使用Heroku,我想从Heroku到另一台机器获取最新版本的代码.
我知道非常建议使用GitHub或BitBucket获取正确的远程存储库.
我决定尝试BitBucket.
在创建我的帐户时,它会询问我的git repo的旧网址.由于我的机器已经死了,我希望填写heroku URL,但这不起作用.
任何想法如何进行?
我的想法是,我可以从任何一台机器拉动并推动我的更改(当我的笔记本电脑来自维修时).
我有一个问题要恢复上次迁移.
自从我安装了'letrate'宝石进行评级后,任何rake db:rollback恢复精确地都会让宝石迁移,而不是最后的迁移.
我怀疑这是由于宝石本身.
任何想法如何解决这个问题,所以我可以享受非常方便的回滚?
同样的问题:
rake db:migrate:redo
Run Code Online (Sandbox Code Playgroud)
结果:
== CreateRates: reverting ====================================================
-- drop_table(:rates)
-> 0.0224s
== CreateRates: reverted (0.0225s) ===========================================
== CreateRates: migrating ====================================================
-- create_table(:rates)
NOTICE: CREATE TABLE will create implicit sequence "rates_id_seq" for serial column "rates.id"
NOTICE: CREATE TABLE / PRIMARY KEY will create implicit index "rates_pkey" for table "rates"
-> 0.1787s
-- add_index(:rates, :rater_id)
-> 0.0032s
-- add_index(:rates, [:rateable_id, :rateable_type])
-> 0.0024s
== CreateRates: migrated (0.1850s) ===========================================
Run Code Online (Sandbox Code Playgroud)
rake db:migrate:status
...
up …Run Code Online (Sandbox Code Playgroud) c++ ×2
g++ ×2
heroku ×2
node.js ×2
postgresql ×2
bitbucket ×1
git ×1
javascript ×1
json ×1
makefile ×1
npm ×1
numpy ×1
openshift ×1
pm2 ×1
python ×1
rake ×1
simple-form ×1
ubuntu-14.04 ×1
ubuntu-16.04 ×1
wicked-pdf ×1