views:

58

answers:

2

I'm using this command:

rails generate model DayOfMonth day:integer

Rails generated the model "DayOfMonth" and the table "day_of_months".

I want it to create the table "days_of_month" instead.

I know this has something to do with the Inflector class and the inflector.rb in initializers folder.

But I don't understand how to get this to work.

I'm using Rails 3.

Could someone help me out here or point me to a tutorial for this?

Thanks

+1  A: 
ActiveSupport::Inflector.inflections do |inflect|
 inflect.irregular 'day of month', 'days of month'
end

Read: http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html

NullUserException
it still doesn't work. I added that line, then i run "rails generate model DayOfMonth day:integer" but it still creates a migration named CreateDayOfMonths.
never_had_a_name
+1  A: 

You could just edit the migration and then add

class DayOfMonth < ActiveRecord::Base
  set_table_name "days_of_month"
end
Jesse Wolgamott