客户对象可以在Stripe.com中拥有许多卡.你如何收取现有的卡?
我已经尝试了一些东西,但条纹api由于某种原因borks什么时候得到一个旧的客户令牌和一个新的卡令牌,而不是只是在该客户上创建一张新卡.所以我走了检索所有客户卡的路线,然后通过单选按钮选择一个,然后将所选卡的令牌提交到收费中
charge = Stripe::Charge.create(
:amount => "#{@subscription.price}",
:currency => "usd",
:card => params[:existing_card_id],
:description => "Subscription for #{current_user.email}"
)
Run Code Online (Sandbox Code Playgroud)
但我得到了错误
Stripe::InvalidRequestError: Invalid token id: card_24j3i2390s9df
Run Code Online (Sandbox Code Playgroud) 尝试使用我的按钮的字体真棒图标,但我不能让它显示在submit_tag中
<%= submit_tag icon("search"), class: "btn-primary", style:"width:40px;" %>
Run Code Online (Sandbox Code Playgroud)
输出:
<input class="btn-primary" name="commit" style="width:40px;" type="submit" value="<i class='icon-search' style='font-size:1em' ></i>">
Run Code Online (Sandbox Code Playgroud)
帮手:
def icon(name, size=1)
#icon("camera-retro")
#<i class="icon-camera-retro"></i>
html = "<i class='icon-#{name}' "
html += "style='font-size:#{size}em' "
html += "></i>"
html.html_safe
end
Run Code Online (Sandbox Code Playgroud)
当我删除帮助器的html.html_safe行时,我得到同样的东西.它像html_safe一样无效.我也尝试过html = raw(html)也没有效果.
brew install mongodb
==> Downloading http://downloads.mongodb.org/src/mongodb-src-r2.4.8.tar.gz
Already downloaded: /Library/Caches/Homebrew/mongodb-2.4.8.tar.gz
==> Downloading patches
######################################################################## 100.0%
######################################################################## 100.0%
==> Patching
patching file src/third_party/v8/SConscript
patching file src/third_party/v8/src/spaces.h
==> scons install --prefix=/usr/local/Cellar/mongodb/2.4.8 -j4 --64 --cc=/usr/bin/clang --cxx=/usr/bin/clang++ -stdlib=libstdc++
Run Code Online (Sandbox Code Playgroud)
无限期挂起(10分钟+).
以下是流程:
PID TTY TIME CMD
428 ttys000 0:00.14 -bash
439 ttys001 0:00.14 -bash
425 ttys002 0:00.20 -bash
2472 ttys002 0:00.12 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0 /usr/local/Library/brew.rb inst
2491 ttys002 0:00.17 /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -W0 -I /usr/local/Library/Homebrew
2517 ttys002 0:08.25 python /usr/local/bin/scons install --prefix=/usr/local/Cellar/mongodb/2.4.8 -j4 --64 --cc=/usr/bin/cla
2583 ttys002 0:00.02 /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -stdlib= …Run Code Online (Sandbox Code Playgroud) 我的服务器正在运行websocket-rails gem来处理websockets.
我在使用带有角度的phonegap项目的websocket-rails时遇到了麻烦,因为我需要在我的Angular前端初始化websocket-rails客户端,而不依赖于rails资产管道.
是否可以将websocket-rails客户端单独加载到角度项目中?或者我可以使用角度套接字指令来管理带有websocket-rails的套接字?
无法获得ajax form_for以尊重format.js respond_to仅响应format.html.任何帮助非常感谢.
视图
此视图由AJAX部分调用,然后用户提交表单.初始的ajax调用会混淆这个表单的'remote:true'吗?
<%= form_for([@nested, @nested.resources.new], remote: true) do |i|%>
<%= i.hidden_field :inviter_id, value: current_user.id %>
<%= i.hidden_field :fb_pic_url, value: f['pic_square'] %>
<%= i.hidden_field :name, value: f['name'] %>
<%= i.hidden_field :uid, value: f['uid'] %>
<%= i.submit "Invite", class:"btn btn-success invite_button" %>
<% end %>
Run Code Online (Sandbox Code Playgroud)
的routes.rb
resources :nested do
resources :resources
end
Run Code Online (Sandbox Code Playgroud)
调节器
def create
code code code
respond_to do |format|
format.html { redirect_to @nested, notice: "Successfully Posted Nested" }
format.json { render json: @nested, status: :created, location: @nested …Run Code Online (Sandbox Code Playgroud) ajax ruby-on-rails form-for nested-form-for ruby-on-rails-3.2
Node/Express是否有像RABL(https://github.com/nesquena/rabl)或JBuilder 这样的JSON模板引擎?(http://railscasts.com/episodes/320-jbuilder?view=asciicast).我不是指像Handlebars,Jade或Underscore.js这样的HTML模板引擎.我的意思是JSON模板引擎.这些库简化了选择和选择JSON的元素和关联的过程.
我正在尝试将websocket导轨与angular和heroku一起使用。它正在开发中,但现在正在生产中。这是发布事件的服务器代码以及侦听事件的客户端。
#Server
WebsocketRails[channel_name].trigger('new_message', @json)
//Client
var dispatcher = new WebSocketRails(window.location.host + "/websocket");
var channel = dispatcher.subscribe(channel_name);
channel.bind('new_message', function(data) {
$scope.$apply(function(){
cr.unread_messages += 1;
});
});
Run Code Online (Sandbox Code Playgroud)
我正在生产SSL。我已经尝试过设定
force_ssl = false
Run Code Online (Sandbox Code Playgroud)
在中production.rb,但无济于事。
我得到的错误是:
WebSocket connection to 'wss://domain.com/websocket' failed: Error during WebSocket handshake: Unexpected response code: 503
Run Code Online (Sandbox Code Playgroud)