help! cannot display model's attr_accessor


i m new to ruby on rails, this question might sound stupid, but i m
really confused by the relationship between attributes of the model
and the column in that model table.

i have two tables 'institutions' and 'alerts' as below:

id site created_at updated_at
1 default null null

id institution_id name value
1 1 testname testvalue

the corresponding models are:

class Institution < ActiveRecord::Base
has_one :alerts

def find_alerts(institution_id)

orthogonal to this, but your associations are borked - that should be

has_many :alerts

and then you can do away with that find method and do

from irb i tried:
a = Alert.find_all(1)
it showed me the correct record
but if i tried:

that dies because your find_all method returns an array and arrays
don't have a name method.
Your view doesn't display the name because you've put attr_accessor in
your model: Active Record creates accessor functions for you, by using
attr_accessor you've overridden those with versions that don't look at
the values Active Record fetches from the database.