A
Alexandre Brillant
Hi,
I don't understand one point with Ruby on Rails :
I have the following migration file :
class Personne < ActiveRecord::Migration
def self.up
# Commentaire à enlever si vous avez déjà une table personnes
# drop_table ersonnes
create_table( ersonnes ) {
|p|
p.string renom
p.string :nom
p.string :telephone
p.text :adresse
}
end
def self.down
drop_table ersonnes
end
end
-------------------------------------------------
My model is very simple :
class Personne < ActiveRecord::Base
end
------------------------------------------------
In my controller, I put the following code :
class CarnetController < ApplicationController
def voir
# Find all the objet Personne from the table personnes
@personnes = Personne.findall)
end
end
And it works, but I don't understand how Rails can know that the classe
Personne should be mapped to the
personnes table. Where it is stored ?
Txa lot !
I don't understand one point with Ruby on Rails :
I have the following migration file :
class Personne < ActiveRecord::Migration
def self.up
# Commentaire à enlever si vous avez déjà une table personnes
# drop_table ersonnes
create_table( ersonnes ) {
|p|
p.string renom
p.string :nom
p.string :telephone
p.text :adresse
}
end
def self.down
drop_table ersonnes
end
end
-------------------------------------------------
My model is very simple :
class Personne < ActiveRecord::Base
end
------------------------------------------------
In my controller, I put the following code :
class CarnetController < ApplicationController
def voir
# Find all the objet Personne from the table personnes
@personnes = Personne.findall)
end
end
And it works, but I don't understand how Rails can know that the classe
Personne should be mapped to the
personnes table. Where it is stored ?
Txa lot !