0

I was doing my ER diagram for a rails application I'm about to begin with and there I have an entity called Class News so I'd have a model ClassNew but I don't know if I will have problems in the future with the New part or what would be the right way to do this o how should I call the model? since the right thing would be ClassNews and the table should be class_news...

What's the best thing to do when working with News at the time of creating models for ActiveRecord in Ruby on Rails.

Thanks.

1

Why would the model be called "ClassNew" ? "News" is an uncountable noun. If RAILS doesn't already have "News" marked as uncountable, you can change the rules.

  • So, before running the migrations and generating the model, I could do rails g model class_news title description and AR will generate ClassNews model using class_news table and I'll be able to use without a problem if its marked as uncountable in Rails? – Mr_Nizzle Jul 20 '12 at 16:45
  • @Mr_Nizzle: If you are currently getting "ClassNew" from "class_news", instead of "ClassNews", then changing the rules to mark "News" as uncountable (like "fish") should fix that problem. – kevin cline Jul 20 '12 at 18:45
  • Thanks, ran the model generator with ClassNews and it generated the model ClassNews and the migration creates the table class_news and it works fine in the application like: ClassNews.new and ClassNew.all, seems like it won't mean any trouble. – Mr_Nizzle Jul 20 '12 at 20:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.