How turn off pluralize table creation for Entity Framework 5?
You can write this code in OnModelCreating method: modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
You can write this code in OnModelCreating method: modelBuilder.Conventions.Remove<PluralizingTableNameConvention>();
Rather than extend things, I just it like this: ActionController::Base.helpers.pluralize(count, ‘mystring’) Hope this helps someone else!
I have been looking for the answer to this myself and wasn’t satisfied with any of the existing ones. Here’s the tidiest solution I found: Available <%= “Article”.pluralize(@posts.published.count) %>: Documentation is here. Relevant bits: Returns the plural form of the word in the string. If the optional parameter count is specified, the singular form will … Read more
Actually all you need to do is require ‘active_support/inflector’ and that will extend the String type. you can then do “MyString”.pluralize which will return “MyStrings” for 2.3.5 try: require ‘rubygems’ require ‘active_support/inflector’ should get it, if not try sudo gem install activesupport and then the requires.
There is no convention for this as of EF RC2 build. This is from EF Core team: In past pre-release of EF Core, the table name for an entity was the same as the entity class name. In RC2 we now use the name of the DbSet property. If no DbSet property is defined for … Read more
Simple version (ES6): const pluralize = (count, noun, suffix = ‘s’) => `${count} ${noun}${count !== 1 ? suffix : ”}`; Typescript: const pluralize = (count: number, noun: string, suffix = ‘s’) => `${count} ${noun}${count !== 1 ? suffix : ”}`; Usage: pluralize(0, ‘turtle’); // 0 turtles pluralize(1, ‘turtle’); // 1 turtle pluralize(2, ‘turtle’); // 2 … Read more
I’m no RoR expert, but did find a possible approach. From the referenced site you can add inflection rule inside the config/initializers/inflections.rb file: # Add new inflection rules using the following format ActiveSupport::Inflector.inflections do |inflect| inflect.irregular ‘clothing’, ‘clothes’ end
Try this: en.yml : en: misc: kids: zero: no kids one: 1 kid other: %{count} kids In a view: You have <%= t(‘misc.kids’, :count => 4) %> Updated answer for languages with multiple pluralization (tested with Rails 3.0.7): File config/initializers/pluralization.rb: require “i18n/backend/pluralization” I18n::Backend::Simple.send(:include, I18n::Backend::Pluralization) File config/locales/plurals.rb: {:ru => { :i18n => { :plural => { … Read more
You can avoid all of this messy plurality by just deleting the items without any message and giving the user a really good Undo facility. Users never read anything. You should build a good Undo facility as part of your program anyway. You actually get 2 benefits when you createe a comprehensive Undo facility. The … Read more