Ruby/Rails - Models Named with Two Words (Naming Convention Issues)

后端 未结 4 762
青春惊慌失措
青春惊慌失措 2020-12-23 16:44

This is really a question about naming conventions.

I have a model called PromotedEvents

The file is called promoted_events.rb

I created the table wi

4条回答
  •  悲哀的现实
    2020-12-23 17:46

    Model names are singular and camel case like so pe = PromotedEvent.new()

    the file should be promoted_event.rb

    Controllers are plural

    PromotedEventsController

    constants are ALL_CAPS

    locals are separated_by_underscores_and_lowercase

    table names are plural 'SELECT * FROM promoted_events`

提交回复
热议问题