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.

asked Jul 20, 2012 at 14:50

1 Answer 1

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.

answered Jul 20, 2012 at 16:08
3
  • 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? Commented Jul 20, 2012 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. Commented Jul 20, 2012 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. Commented Jul 20, 2012 at 20:11

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.