rails subclass not found when trying to locate a specific phrase in a db table -


i'm trying make page show results in table have word ford inside type column.

heres have

controller:

  def type     @type = brand.where(type: "ford")   end 

and in view have:

<% @type.each |t| %> 

this returning error on line above,

the single-table inheritance mechanism failed locate subclass: 'ford'. error raised because column 'type' reserved storing class in case of inheritance. please rename column if didn't intend used storing inheritance class or overwrite brand.inheritance_column use column information. 

why getting error , how go fixing it?

sam

edit

@type = brand.where(car_type: "ford") 

type reserved keyword in rails models.

you can refer reserved keywords here.

it work, if change column name type else


Comments

Popular posts from this blog

c - How to retrieve a variable from the Apache configuration inside the module? -

c# - Constructor arguments cannot be passed for interface mocks -

python - malformed header from script index.py Bad header -