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

get url and add instance to a model with prefilled foreign key :django admin -

css - Make div keyboard-scrollable in jQuery Mobile? -

android - Keyboard hides my half of edit-text and button below it even in scroll view -