发表文章

[Ruby] 删除模型的硬要求 Remove hard requirement for a model[trailblazer-generator]

pmackay 2017-10-9 59

有时, 一个单元格可能需要一些没有模型的东西, 例如页脚。如果我给出一个单元格名称 footer 我得到:

Error: You provided an invalid class name

是否可以有一个标志或某种方法来禁用此检查, 并只生成文件?

原文:

Sometimes a cell might be needed for something that doesnt have a model, e.g. a footer. If I give a cell name of footer I get:

Error: You provided an invalid class name

Could there be a flag or some way to disable this check, and just generate the files?

相关推荐
最新评论 (11)
apotonick 2017-10-9
1

只是将一个 nil 对象传递到单元格中?

原文:

What about just passing a nil object into the cell?

apotonick 2017-10-9
2

啊对不起!这是发电机的宝石!

原文:

Ah sorry! This is the generator gem!

emaglio 2017-10-9
3

此 gem 遵循TRB 文件结构, 此时, 它只在文件夹中创建文件 app/concepts , 因此需要该类的名称以确保该文件进入正确的文件夹。您将页眉/导航/版式/页脚文件放在哪里?

但是如果添加一个标志来设置接受 None 作为类名的目标路径, 可能会有意义。你们觉得怎么样?@apotonick@fernandes

原文:

This gem follow the TRB file structure and, at the moment, it creates files only in the app/concepts folder, so the name of the class is required to make sure that the file goes in the correct folder. Where do you keep your header/navigation/layout//footer files?

BUT maybe it make sense to add a flag to set the destination path accepting a None as class name for example? What do you guys think? @apotonick @fernandes

apotonick 2017-10-9
4

也许我们应该换一个术语 modelconcept

原文:

Maybe we should swap the term model with concept ?

emaglio 2017-10-9
5

也许我们应该把两者都放在一起, 因为在大多数情况下, 它实际上是一个模型。错误信息可能类似于 Error: You provided an invalid name for the model and/or the concept folder

原文:

Well maybe we should put both because in most of the cases it's actually a model. The error message could be something like Error: You provided an invalid name for the model and/or the concept folder ?

apotonick 2017-10-9
6

我们想离开以模型为中心的世界观, 所以也许让我们放弃模型。

原文:

We want to move away from the model-centric world view, so maybe let's drop model.

fernandes 2017-10-9
7

@pmackay页脚不需要模型, 但单元格是 Ruby 类.。

trailblazer generate cell Footer

我想你只是忘了大写 F, 所以它是一个有效的 Ruby 名称

原文:

yeah @pmackay the Footer doesn't need the model, but the Cell is a Ruby Class...

trailblazer generate cell Footer

I think you just forgot the capital F, so it's a valid Ruby name

fernandes 2017-10-9
8

@apotonick@emaglio您的 ruby 类与模型/概念呵呵混淆

生成器要求 Ruby Class heheh

原文:

@apotonick @emaglio your are confusing ruby Class with Model/Concept hehehehe

the generator asks for a Ruby Class heheh

fernandes 2017-10-9
9

@pmackay, 其他事情我记得, 它不需要是一个现有的类在系统上... 只需要是一个有效的 Ruby 类名

原文:

ahhhh @pmackay, other thing I remembered, it doesn't need to be an existing Class on the system... just need to be a valid Ruby Class name

pmackay 2017-10-9
10

好的, 谢谢@fernandes!我想知道它是否可以通过检查不同的表单来解决, 例如, 如果命令行名称都是小写的, 则假定它需要将转换为类而不是来自?很高兴关闭它, 因为它没有对模型的依赖。

原文:

Ah OK, thanks @fernandes! I wonder if it could work out by checking different forms, e.g. if the command line name is all lowercase, assume it needs converting to a classname rather than from? Happy to close this though as it doesnt have a dependency on the model.

fernandes 2017-10-9
11

太棒了!很高兴它帮助了你。:)

原文:

ohh awesome! glad it helped you.. :)

返回
发表文章
pmackay
文章数
9
评论数
42
注册排名
37127