我刚刚更新了试用rails 3,使用rvm和ruby 1.9.2-p0.
当我运行我的黄瓜规格时,我会听到奇怪的警告
/home/ubuntu/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/utils.rb:16: warning: regexp match /.../n against to UTF-8 string
/home/ubuntu/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/utils.rb:16: warning: regexp match /.../n against to UTF-8 string
/home/ubuntu/.rvm/gems/ruby-1.9.2-p0/gems/rack-1.2.1/lib/rack/utils.rb:16: warning: regexp match /.../n against to UTF-8 string
Run Code Online (Sandbox Code Playgroud)
我的包包含以下宝石......
Using rake (0.8.7)
Using abstract (1.0.0)
Using activesupport (3.0.0)
Using builder (2.1.2)
Using i18n (0.4.1)
Using activemodel (3.0.0)
Using erubis (2.6.6)
Using rack (1.2.1)
Using rack-mount (0.6.13)
Using rack-test (0.5.4)
Using tzinfo (0.3.23)
Using actionpack (3.0.0)
Using mime-types (1.16)
Using polyglot (0.3.1)
Using treetop (1.4.8)
Using mail (2.2.5) …Run Code Online (Sandbox Code Playgroud) 我已经阅读了大量的文章和stackoverflow问题,但我似乎没有得到它的工作.
我想为客户分发一些产品信息,这些信息将通过CD或USB记忆棒发送出去.回到我用Flash做的那些日子.因为flash可以编译成一个名为Flash放映机的EXE,可以在不安装的情况下运行我的Flash内容.
现在我想给HTML5一个旋转.而且我需要一种方法来将所有内容打包在CD上,使其无需安装即可在任何地方运行.
我听说过我可以编译chrome并将其嵌入到c ++应用程序中.(http://code.google.com/p/chromiumembedded/)我可以将QT与QtWebkit一起使用.(http://developer.qt.nokia.com/doc/qt-4.8/qtwebkit.html)我可以编译Webkit并将其嵌入到c ++应用程序中......(http://www.webkit.org/)
示例很大,我没有任何C++技能=(
然后有一些项目,如mozilla chromeless(http://mozillalabs.com/chromeless)(和berkelium(https://github.com/sirikata/berkelium))
使用chromeless我的JQuery Javascript无法正常工作和Berkelium ...我没有编译...
我没有http://www.appcelerator.com/或其他付费/商业选项的预算......(也不能选择Flash/Air和Silverlight).因为内容也应该部署在Web服务器上而不使用插件...
我不需要任何访问操作系统.我想要的是我的Jquery/Backbone应用程序,它使用JSON文件在没有安装的桌面客户端中运行.
因此,没有浏览器地址栏只是拾取index.html而其他所有内容都由应用程序处理......像Fullscreen和Close这样的东西会很好......
不幸的是,我不能依赖"客户操作系统"的安装浏览器,因为目标组很大,我期待很多旧的浏览器.
任何人都可以给我指导如何"轻松"编译一个应用程序,使我的Web应用程序的东西从CD上运行而没有安全警告等?
或者我可以使用任何预先编译的包装?
我读过很多人建议将nosql与sql数据存储区一起使用.例如,在mysql中有一些报告审计跟踪或日志信息,在mongodb中有一些线程分层数据.
是否有可能在mysql和mongoid上挂起活动记录的rails?
开箱即用它似乎不起作用...任何提示?或者这是一种不推荐的方法?
如何在Ruby中实现Repository或Gateway模式?
我来自一个C#世界,我通常抽象出我的数据访问,但是使用ActiveRecord作为Ruby中的默认数据访问机制,如何实现这一点并不明显.
我通常会做在C#是抽象的接口工作,然后有具体的实现EFCustomerRepository,NHibernateCustomerRepository而且InMemoryCustomerRepository并根据我注入相匹配的具体落实情况.
那么现在,Ruby的方式是什么?!
据我所知,在动态语言中你不需要像DI(依赖注入)这样的东西.Ruby具有强大的语言功能,可以实现mixins之类的功能.
但是你会定义mixin在类或模块级静态使用吗?
如果我想针对内存存储库开发并在生产中我将切换到我的ActiveRecord-Repository,如何编写我的业务逻辑?
如果我可能在错误的道路上,因为我习惯于用静态类型语言思考.如何以Ruby的方式处理这项任务?基本上我想让我的持久层抽象,它的实现可以互换.
编辑:我指的是罗伯特c.martins(unclebob)关于建筑的基调
谢谢你的帮助...
我有一个Ubuntu rails环境来玩ROR.现在我正在运行Rails 2.3.8.
我想查看rails 3.是否可以并排运行两个开发环境?如果没有,我如何清理我的导轨2.x系统以安装导轨3?或者我需要设置一个全新的Ubuntu机器?
任何帮助,链接......指针都会很棒!
我在git的源代码管理下有一个Web应用程序.我为不同的客户提供了不同的css文件以及图像和其他主题特定的东西.还有自定义报告......除了主题外,应用程序的每个其他方面都保持不变.什么是一个建议的方法来保持应用程序以及git中源代码控制下的主题信息.我是否应该为主题和报告或子模块使用分支...在开发期间,我希望将我的客户主题添加到我的开发分支,并对我的客户特定主题进行更改...
有可能与GIT一样吗?
我有一个控制器规格,我得到了以下失败的期望:
Failure/Error: put :update, :id => login_user.id, :user => valid_attributes
#<User:0xbd030bc> received :update_attributes with unexpected arguments
expected: ({:name=>"changed name", :email=>"changed@mail.com", :password=>"secret", :password_confirmation=>"secret"})
got: ({"name"=>"Test user", "email"=>"user@test.com", "password"=>"secret", "password_confirmation"=>"secret"})
Run Code Online (Sandbox Code Playgroud)
对我来说,看起来我正在传递"name" => "Test User",我期待着:name => "test user"
我的规格看起来像这样:
describe 'with valid parameters' do
it 'updates the user' do
login_user = User.create!(valid_attributes)
controller.stub(:current_user).and_return(login_user)
User.any_instance.
should_receive(:update_attributes).
with(valid_attributes.merge(:email => "changed@mail.com",:name=>"changed name"))
put :update, :id => login_user.id, :user => valid_attributes
end
end
Run Code Online (Sandbox Code Playgroud)
我的有效属性有这样的东西:
def valid_attributes
{
:name => "Test user",
:email=> "user@test.com",
:password …Run Code Online (Sandbox Code Playgroud) 我有一个遗留数据库有两个列,我想将它们映射为1 ID这是可能的
例如
public class Product
{
public string ProductID {get;set;}
public string ShortDescription {get;set;}
public string UserName {get;set;}
}
Run Code Online (Sandbox Code Playgroud)
然后我的Modelbinder看起来像这样
modelBinder.Entity<Product>().
HasKey(p=>p.ProductID)
.MapSingle(product =>
new {
colShotDesc = product.ShortDescription,
colUser = product.UserName
}
).ToTable("Products");
Run Code Online (Sandbox Code Playgroud)
我需要的是像映射中的ProductID = ShortDescription + UserName ...因为这两个列共享一个独特的键约束...
不知道这是否有意义,但任何建议都会很棒...请不要问数据库设计=>这就像它是,不应该改变...这就是为什么我认为EF代码优先帮助我(希望交叉手指)...因为它看起来像db没有定义pk只是唯一的键约束...
无论如何......帮助会很棒..
我试图在ASP.NET MVC 3中对我的控制器上的编辑操作进行单元测试.
我通过nuget安装了Mvcontrib.MVC3.TestHelper来模拟我的控制器上下文,但我仍然得到一个NullReferenceException
我的代码看起来像这样:
[TestMethod]
public void it_should_redirect_to_index_after_editing_a_something_successfully()
{
var something= new SomeThing
{
ID = Guid.NewGuid(),
CreatedAt = DateTime.Now,
LastModified = DateTime.Now,
Owner = "Me",
Status = "new",
Title = "my Title",
Attachments = new List<Attachment>()
};
var repo = new FakeRepository();
var controller = new SomethingsController(repo);
new TestControllerBuilder().InitializeController(controller);
var result = controller.Edit(something) as RedirectToRouteResult;
result.AssertActionRedirect().ToAction<SomethingsController>(x => x.Index());
}
Run Code Online (Sandbox Code Playgroud)
生产代码看起来像这样......
[HttpPost]
public ActionResult Edit(SomeThing something)
{
if (ModelState.IsValid)
{
var _something = _repository.GetDocumentByID(something.ID);
TryUpdateModel(_something);
_something.LastModified = DateTime.Now;
_repository.SaveChanges(); …Run Code Online (Sandbox Code Playgroud) asp.net-mvc unit-testing mvccontrib-testhelper asp.net-mvc-3
我有动态的客户名单 IEnumerable<Customer>
现在我想从该列表中获得明显的公司名称?
我以为我可以做点什么
dynamic cur = (from c in result.Customers
select g.CompanyName).Distinct();
Run Code Online (Sandbox Code Playgroud)
但今天学到了我不能......我怎么能建立这样的查询呢?
c# ×2
ruby ×2
architecture ×1
asp.net-mvc ×1
c#-4.0 ×1
c++ ×1
code-first ×1
cucumber ×1
deployment ×1
dynamic ×1
git ×1
html5 ×1
mongodb ×1
mongoid ×1
rspec-rails ×1
rspec2 ×1
rvm ×1
ubuntu ×1
unit-testing ×1
workflow ×1