jeudi 23 juillet 2015

Class name to table name ambiguity

I had an already existing data base dump. I wanted to make a model for rails from that dump. I took a database schema dump and made a migration from it. My table name in database is planet_osm_line and respective model is planet_osm_line.rb Code inside the model is

    class PlanetOsmLine < ActiveRecord::Base
    end

Now playing around in rails console when I execute this query

PlanetOsmLine.where("name ilike '%salvi%'")

It searches in planet_osm_lines. How do I make it refer to planet_osm_line instead of planet_osm_lines. Please help.

Aucun commentaire:

Enregistrer un commentaire