class HerokuController < ApplicationController
def resources
service = Service.create!(
plan: json_params[:plan],
region: json_params[:region],
heroku_uuid: json_params[:uuid] # Will be present in all future requests
)
response = {
id: service.id, # Unique identifier from your system
config: { "SERVICE_URL" => service.url },
message: "Welcome to our service"
}
status 200
response.to_json
end
end
response = {
id: service.id, # Unique identifier from your system
config: { "SERVICE_URL" => service.url },
message: "Welcome to our service"
}
status 200
response.to_json
end
end
我不明白如何创建这个是Service.create! 我应该创建新模型,或者什么?
{
"id": "aaaaaaa",
"api": {
"config_vars": [ "AAAAAAA_URL" ],
"requires": [],
"regions": [ "us" ],
"password": "531fe5d8558846c99383ad4cad196d66",
"sso_salt": "b8f0e46bb9d7b0ca4cf35a21bcb8ff97",
"production": {
"base_url": "https://yourapp.com/heroku/resources",
"sso_url": "https://yourapp.com/sso/login"
},
"test": {
"base_url": "http://localhost:3000/heroku/resources",
"sso_url": "http://localhost:3000/sso/login",
"message": "sssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssssss"
},
"version": "3"
}
}
参数:{&#34; heroku_id&#34; =&gt;&#34; app2431@kensa.heroku.com",&#34;计划&#34; =&gt;&#34;测试&#34 ;,&#34; callback_url&#34; =&gt;&#34; http://localhost:7779/callback/999&#34;,&#34; logplex_token&#34; =&gt; nil,&#34; region&#34; =&gt; ;&#34; amazon-web-services :: us-east-1&#34;,&#34; options&#34; =&gt; {},&#34; uuid&#34; =&gt;&#34; 2570ced0-25a4-45f8-9fc4-ca38855a6527&#34;,&#34; heroku&#34; =&gt; {&#34; heroku_id&#34; =&gt;&#34; app2431@kensa.heroku.com" ,&#34;计划&#34; =&gt;&#34;测试&#34;,&#34; callback_url&#34; =&gt;&#34; http://localhost:7779/callback/999&#34;,&#34; logplex_token&#34; =&gt; nil,&#34; region&#34; =&gt;&#34; amazon-web-services :: us-east-1&#34;,&#34; options&#34; =&gt; ; {},&#34; uuid&#34; =&gt;&#34; 2570ced0-25a4-45f8-9fc4-ca38855a6527&#34;}} 在154ms内完成500内部服务器错误(ActiveRecord:0.0ms)
NameError(未定义的局部变量或方法`service&#39; for#):
app / controllers / heroku_controller.rb:7:在`resources&#39;