Search code examples
ruby-on-railsruby-on-rails-3ruby-on-rails-3.1

Is Property in any way reserved for rails model naming? (Rails pluralisation is killing me.)


I am trying to add a model called Properties in Rails 3.1 So I used created it using ryan bates nifty generator, although the model itself is very basic for now and only includes.

class Property < ActiveRecord::Base
  belongs_to :user
end

in my resources I have"

resources :properties

In one of my views I am simply trying to do the following:

<% for property in Property.all %>
 <p>description etc</p>
<% end %>

but it gives me the following error?!

undefined method `all' for Property:Module

Now it works if I replace Property.all with User.all or House.all but for some reason Property doesn't work. I'm kinda new to rails and think it has something to do with pluralization but I can't figure it out and its killing me. If anyone could please help that would be epic! Cheers


Solution

  • You can use Inflections to extend default dictionary ( peoperty word is not included by default). The official API can help you with it