我在我的应用程序中有两个设计身份验证模型,并希望在它们之间创建聊天.任何人都知道如何为用户编写连接.以下是我所拥有的.我想检查是否可以有两个连接根据各自的登录拒绝不同用户的连接.任何帮助表示赞赏.
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
identified_by :current_supplier
def connect
self.current_user = find_verified_user
self.current_supplier = find_verified_supplier
end
private
def find_verified_user
if current_user = env['warden'].user('user')
current_user
end
end
def find_verified_supplier
if current_supplier = env['warden'].user('supplier')
current_supplier
else
reject_unauthorized_connection
end
end
end
end
Run Code Online (Sandbox Code Playgroud) 我最近将我的操作系统X更新到10.10,然后面临通过RVM安装ruby的问题.gcc46存在依赖性,我无法解决.任何帮助表示赞赏.下面是错误堆栈.
rvm reinstall ruby-1.9.3-p547
ruby-1.9.3-p547 - #removing src/ruby-1.9.3-p547 - please wait
ruby-1.9.3-p547 - #removing rubies/ruby-1.9.3-p547 - please wait
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.10/x86_64/ruby-1.9.3-p547.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system - please wait
Installing required packages: gcc46 - please wait
Error running 'requirements_osx_brew_libs_install gcc46',
showing last 15 lines of /Users/saurabh/.rvm/log/1414321731_ruby-1.9.3-p547/package_install_gcc46.log
+rvm_pretty_print:10> case …Run Code Online (Sandbox Code Playgroud) 我正在开发一个电子商务应用程序,并在其管理网站上工作.这两个应用程序具有相同的业务域,并且在管理应用程序中需要一些来自电子商务应用程序的模型.
我已经在网上找到了一些共享模型的解决方案,虽然我不清楚哪个更好,我应该如何实现它.
找到的解决方案:
自动将模型从电子商务应用程序加载到管理ruby搜索
config.autoload_paths += %W(#{config.root}/../e-commerce-app/app/models/)
Run Code Online (Sandbox Code Playgroud)我认为第二种解决方案是正确的方法,虽然我不确定如何实现它.
我正在尝试启动sunspot_solr,但它给了我以下错误
Sunspot::Solr::Server::JavaMissing: You need a Java Runtime Environment to run the Solr server
Run Code Online (Sandbox Code Playgroud)
我的mac上有java运行时,我尝试搜索堆栈溢出但无法获得任何解决方案.
Saurabhs-MacBook-Pro% java -version
java version "1.7.0_51"
Java(TM) SE Runtime Environment (build 1.7.0_51-b13)
Java HotSpot(TM) 64-Bit Server VM (build 24.51-b03, mixed mode)
Saurabhs-MacBook-Pro% bundle exec rake --execute 'puts `which java`'
/usr/bin/java
Saurabhs-MacBook-Pro% which java
/usr/bin/java
Run Code Online (Sandbox Code Playgroud)
感谢您的帮助.