jjzjj

apache_get_modules

全部标签

ruby - 使用参数重定向 POST/GET 请求的 Sinatra 应用程序

我正在迁移服务器,但不幸的是,旧服务器IP已硬编码在我的iPhone应用程序中。显然,我将提交一个更新,将API端点设置到我的新服务器,但与此同时,我需要在旧服务器上设置一个应用程序,将所有请求重定向到新服务器。我听说Sinatra非常适合这个。require'sinatra'get"/foo/bar"doredirect"http://new-server.com/foo/bar",303endpost"/foo/bar"doredirect"http://new-server.com/foo/bar",303end问题是它们不会随请求一起转发GET或POST参数。我在Sinatra

ruby-on-rails - rails : dynamically define class method based on parent class name within module/concern

我想根据包含此Mixin的类名在Mixin中动态生成一个类方法。这是我当前的代码:moduleMyModuleextendActiveSupport::Concern#defsome_methods#...#endmoduleClassMethods#HereiswhereI'mstuck...define_method"#{self.name.downcase}_status"do#dosomething...endendendclassMyClass但这给了我以下方法名称:MyClass.mymodule::classmethods_status在方法定义中获取基类名称是可行的(s

ruby-on-rails - 在 Apache 下的子目录中配置 Ruby On Rails App

我在Windows上安装了apache2.2。我正在尝试同时提供颠覆(/svn)和redmine(/redmine)。我的svn使用此配置运行良好:DAVsvnSVNParentPathC:/svn_repository...这很好用——我的svn用户可以点击http://mybox/svn就好了。现在我想为Rails应用程序(RedMine)添加另一个目录:我遵循了thisquestion中的建议设置杂种服务器并让apache代理客户端连接到它。如果我将它设为根目录,它工作正常——但我在将它设为子目录时遇到了问题:ProxyPasshttp://localhost:3000/Prox

ruby - Ruby 的 Object#const_get 是如何工作的?

我最近发现Ruby(2.2.1)有一些“有趣”的行为。moduleFooclassFooendclassBarendendFoo.const_get('Foo')#=>Foo::FooFoo.const_get('Bar')#=>Foo::BarFoo.const_get('Foo::Foo')#=>FooFoo.const_get('Foo::Bar')#=>NameError:uninitializedconstantFoo::Foo::BarFoo.const_get('Foo::Foo::Bar')#=>Foo::BarFoo.const_get('Foo::Foo::Foo:

适用于多行的 Ruby 'gets'

使用IRB,我想输入一个多行字符串,以便从中删除某些字符。“gets”只允许单行-多行是否有类似的功能。ASCII_project.rb(main):002:0*puts="What'sthetextyouwanttostrip?"=>"What'sthetextyouwanttostrip?"ASCII_project.rb(main):003:0>str=gets我现在想粘贴一段文本-因为新行它不起作用。这就是为什么我要收集多行这是代码#encoding:CP850puts="What'sthetextyouwanttostrip?"str=getsstr.gsub!(/\P{AS

ruby-on-rails - 使用 passenger 在 Apache 上设置 Rails 应用程序 - Rails 似乎无法加载

我正在尝试按照https://help.ubuntu.com/community/RubyOnRails等文档在Ubuntu实例上设置Rails.我正在尝试从此处的Rails入门页面设置应用程序:http://guides.rubyonrails.org/getting_started.html.到目前为止我做了什么:通过RVM和GEM安装Ruby/RubyGems/Rails(这安装了Ruby1.9.2和Rails3.0.7)安装mysql和mysql2模块(后者不起作用)创建Rails应用程序(教程指导的博客应用程序)/home/me/www/blog/public/来自/var/

ruby - Rails 3 - 测试 Controller 的 GET 方法 - 尝试使用 JSON 并出现 406 错误

我有一个简单的Controller,它指定:respond_to:json当我尝试构建这样调用它的功能测试时:test"GET"doget'index',:format=>:jsonend一切正常。但是,如果我尝试像这样传递查询参数:test"GET"doget'index',{:my_param='1234'},:format=>:jsonend我收到Controller返回的406错误。如果我通过response.inspect转储响应,我可以看到@status=406和@header的内容类型为文本/html。如果我通过response.inspect为不传递查询参数的简单情况转

ruby-on-rails - 将 form_for 标签与 get 方法一起使用

我正在尝试使用get方法提交表单。早些时候我尝试用form_tag做类似的事情并且它工作正常但现在当我更改为form_for标签时,这似乎不起作用。filter_path,:method=>:get)do|f|%>我收到一个无路由错误。 最佳答案 如果需要,您可以使用:html传递原始HTML属性。对于Rails3:filter_path,:html=>{:method=>'GET'})do|f|%>更新并且在Rails4中,根据下面@andre.orvalho的建议,可以直接提供method参数:

ruby-on-rails - Ruby on Rails 3 + Apache2 + Phusion Passenger:Bundler::GemNotFound 异常

我正在尝试使用PhusionPassenger在Apache2服务器上部署Rails应用程序。虽然一切都在本地运行良好,但我在部署时遇到了臭名昭著的“Bundler::GemNotFound”错误:Couldnotfindabstract-1.0.0inanyofthesources(Bundler::GemNotFound)我所有的gem都安装在我的本地主文件夹中。因此,我的Apache2配置文件中的乘客配置行如下:LoadModulepassenger_module/home/regis/.gem/gems/passenger-3.0.7/ext/apache2/mod_passe

ruby-on-rails - 为什么 Apache 还没有可行的 mod_ruby?

尽管Ruby和Rails很流行,但这个问题似乎早就解决了。JRuby和mod_rails都很好,很花哨,但为什么没有直接用于Ruby的Apachemod? 最佳答案 有PhusionPassenger,一个强大的Apache模块,可以运行Rack最低配置的应用程序。它对共享主机越来越有吸引力,将任何程序变成Rack应用程序都非常容易:ARackapplicationisanRubyobject(notaclass)thatrespondstocall.Ittakesexactlyoneargument,theenvironmenta