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 Answer 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
andAR
will generateClassNews
model usingclass_news
table and I'll be able to use without a problem if its marked as uncountable inRails
?Mr_Nizzle– Mr_Nizzle2012年07月20日 16:45:49 +00:00Commented 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.kevin cline– kevin cline2012年07月20日 18:45:51 +00:00Commented Jul 20, 2012 at 18:45
-
Thanks, ran the model generator with
ClassNews
and it generated the modelClassNews
and the migration creates the tableclass_news
and it works fine in the application like:ClassNews.new
andClassNew.all
, seems like it won't mean any trouble.Mr_Nizzle– Mr_Nizzle2012年07月20日 20:11:16 +00:00Commented Jul 20, 2012 at 20:11
Explore related questions
See similar questions with these tags.