我正在使用Paperclip在我的Rails应用程序中保存图片:
用户模型:
class User < ActiveRecord::Base
has_one :profile
end
Run Code Online (Sandbox Code Playgroud)
档案型号:
class Profile < ActiveRecord::Base
has_attached_file :avatar, :styles => {:medium => "300x300>", :thumb => "100x100>"}
belongs_to :user
end
Run Code Online (Sandbox Code Playgroud)
我尝试删除头像:
current_user.profile.avatar = nil
current_user.profile.save
Run Code Online (Sandbox Code Playgroud)
但它不起作用.可能吗?
我正在使用带有JavaScript的Facebook flogin按钮开发Ruby on Rails应用程序.
我的代码:*
<fb:login-button perms="email" onlogin="createFbSession();"></fb:login-button>
<div id="fb-root"></div>
<script src="http://connect.facebook.net/en_US/all.js">
</script>
<script>
FB.init({
appId:"xxxxxxx", cookie:true,
status:true, xfbml:true
});
function createFbSession() {
FB.getLoginStatus(function(response) {
if (response.session) {
window.location = "<%= fb_login_path %>";
}
});
}
</script>
Run Code Online (Sandbox Code Playgroud)
当我点击flogin按钮时,有时我会在弹出窗口中收到以下错误:
发生错误.请稍后再试.
这是什么意思?
我正在使用angular2 observable模式来发出http请求.我正在尝试有条件地重复http get:我想执行http get,直到满足条件:
http.get('url')
.map(res => {
// if the condition is met I should repeat the http get request
})
.subscribe()
Run Code Online (Sandbox Code Playgroud)
有条件重复http get请求的方法吗?
谢谢,马可
angular ×1
facebook ×1
file-upload ×1
get ×1
http ×1
observable ×1
paperclip ×1
rxjs ×1
sdk ×1