我在一个小项目上工作,有一个textarea,我需要帮助使文本区域扩展鼠标点击像twitter和Facebook.textarea应该首先看起来像文本字段,然后点击时应该展开.
我在这里有一些代码,用户可以通过他们的Twitter帐户登录.这里的问题是,我如何跳过用户注册外部服务(如twitter)的电子邮件确认.我正在使用设计,我不知道如何跳过这类用户的电子邮件确认.我的代码示例如下
class AuthenticationsController < ApplicationController
# GET /authentications
# GET /authentications.json
def index
@authentications = current_user.authentications if current_user
end
# POST /authentications
# POST /authentications.json
def create
omniauth = request.env["omniauth.auth"]
authentication = Authentication.find_by_provider_and_uid(omniauth['provider'], omniauth['uid'])
if authentication
flash[:notice] = "Signed in successfully"
sign_in_and_redirect(:user, authentication.user)
elsif current_user
current_user.authentications.create!(:provider => omniauth['provider'], :uid => ['uid'])
flash[:notice] = "Authentication successful"
redirect_to authentication_url
else
user = User.new
user.apply_omniauth(omniauth)
if user.save
flash[:notice] = "Signed in successfully"
sign_in_and_redirect(:user, user)
else
session[:omniauth] = omniauth.except('extra')
redirect_to new_user_registration_url
end
end
rescue …
Run Code Online (Sandbox Code Playgroud) 当我尝试在我的rails应用程序中发送通知时,我收到以下错误
Net::SMTPAuthenticationError (535-5.7.1 Username and Password not accepted. Learn more at
):
app/models/friendship.rb:6:in `send_request'
app/controllers/friends_controller.rb:21:in `make_friendship'
Run Code Online (Sandbox Code Playgroud)
我的development.rb邮件配置设置是
# Don't care if the mailer can't send
config.action_mailer.raise_delivery_errors = true
config.action_mailer.delivery_method = :smtp
# Gmail SMTP server setup
config.action_mailer.smtp_settings = {
:address => "smtp.gmail.com",
:enable_starttls_auto => true,
:port => 587,
:domain => '@example.com',
:authentication => :plain,
:user_name => 'user@gmail.com',
:password => 'secret'
}
Run Code Online (Sandbox Code Playgroud) 我将服务器切换到生产状态,我无法加载任何图像.这一切都在开发模式下工作正常但是当我切换到生产时它都停止工作我启用了server_static_assets但仍然无效.这样做的任何帮助
我使用的是ruby 1.9.3和rails 3.2.2.每次我使用瘦服务器与private_pub gem它不起作用我做了rackup private_pub.ru -s瘦-E生产.我收到以下错误
/home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `require': cannot load such file -- thin (LoadError)
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `<top (required)>'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `const_get'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `block in get'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `each'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `inject'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in `get'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/server.rb:269:in `server'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/server.rb:265:in `start'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/server.rb:137:in `start'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/bin/rackup:4:in `<top (required)>'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/bin/rackup:19:in `load'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/bin/rackup:19:in `<main>'
rzaartz@ubuntu:~/paper$ rvm 1.9.3
rzaartz@ubuntu:~/paper$ rackup private_pub.ru -s thin -E production
/home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `require': cannot load such file -- thin (LoadError)
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler/thin.rb:1:in `<top (required)>'
from /home/rzaartz/.rvm/gems/ruby-1.9.3-p125/gems/rack-1.4.1/lib/rack/handler.rb:20:in …
Run Code Online (Sandbox Code Playgroud) 我正在尝试使用解析设置推送通知来处理收到的通知.
我使用了phonegap-parse-plugin插件,并且能够正确设置它.
我的问题是我无法处理收到的通知.我想根据通知json params将用户重定向到通知页面.
所以,我决定切换到parse-push-plugin,但我的问题是我甚至无法显示警告注册框; 它甚至找不到ParsePushPlugin方法.
我按照教程很简单,并将其添加到我的app.js文件中
ParsePushPlugin.register(
{ appId:"xxx", clientKey:"xxx", eventKey:"myEventKey" }, //will trigger receivePN[pnObj.myEventKey]
function() {
alert('successfully registered device!');
},
function(e) {
alert('error registering device: ' + e);
});
ParsePushPlugin.on('receivePN', function(pn){
alert('yo i got this push notification:' + JSON.stringify(pn));
});
Run Code Online (Sandbox Code Playgroud)
警报成功未能显示,所以我猜它不起作用或我做的不对.
我有一个帮助用户提交文章的rails应用程序.有没有人知道如何让应用程序中的用户使用他们的Facebook地址在Facebook上分享这些文章?一个好的参考或教程会很好.
我有一个简单的rails应用程序,我使用paperclip gem进行图像处理.上传一个类似风格的图像后(:thumb => "30x30#")
我想添加一个新的风格(:large => "300x300>")
.我遇到的问题是,如果我添加新样式,我会在渲染图像时有一个损坏的图像链接,除非我上传新图像或更新旧图像.是否可以重新生成以前上传的图像的样式?如果是这样我想知道如何或者我必须重新上传图像以获得新的样式.
您好,我是新手使用谷歌驱动器宝石,我不知道如何使用它与回形针上传照片到谷歌驱动器.它是一个简单的rails应用程序,我正在开发上传照片到谷歌驱动器,是否有任何rails应用程序示例,我可以用来启动我的宝石或可以任何身体提供一个示例在这里帮助我们初学者使用谷歌驱动器宝石.应使用Paperclip上传文件.谢谢
ruby-on-rails paperclip ruby-on-rails-3 ruby-on-rails-3.1 google-drive-api
如何使用单个回形针字段来处理不同的文件类型.例如,我有一个带有回形针方法的文件模型,该方法说:
has_attached_file :file
Run Code Online (Sandbox Code Playgroud)
此文件可以是图片,音频,视频或文档.
如果它是一张图片,我怎样才能使它has_attached_file :file
能够以这种方式处理图片:
has_attached_file :file, styles: {thumb: "72x72#"}
Run Code Online (Sandbox Code Playgroud)
然后,如果它是其他文档类型,它将在没有样式的情况下正常工作,因此我不必为不同的文件类型创建字段.