Adding tags to posts in Ruby on Rails

后端 未结 3 1396
抹茶落季
抹茶落季 2021-01-02 00:25

I am creating a blog in Rails using Scaffolding. I want to add a \'tags\' field on each post like on StackOverflow and WordPress. I can do this with the string type (

3条回答
  •  一个人的身影
    2021-01-02 01:00

    I would suggest creating a Tag model and using has_and_belongs_to_many to assign tags to posts. I don't know if the scaffold feature will help you create a form for that, but it shouldn't be difficult to add it yourself. I also suggest using the formtastic plugin as it's much easier and nicer to create forms with it.

提交回复
热议问题