Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我目前正在使用closure_tree gem 在我的rails 应用程序上建模标记。在我的新标签视图中,我有一个字段,用户可以在其中输入要创建的标签的父标签。保存新标签后,编辑标签会将父字段显示为#。如何改为在字段中显示父标签的名称?
原来我只需要一个 to_s 函数来为我的模型和正确显示的东西。
def to_s self.name end