Reputation: 2273
I have a table that has a column of org_import_paths_id
That id
has the foriegn key of another table org_import_paths
. This table has the another column of filename
.
I want to show the filename
of this table from that table in ruby on rails. I want to display the
datas to the grid. Please suggest me to do the things.
Upvotes: 0
Views: 68
Reputation: 5317
".. I have a table that has a column.. " Lets assume that the Model name is FirstTable
and the table name is first_tables
. So the Model
will be
class FirstTable < AR::Base
belongs_to :org_import_paths, :foreign_key => 'org_import_paths_id'
end
Now if you have a object of FirstTable like
ft = FirstTable.first
You can get the value like
ft.org_import_paths.filename
Would you please clarify the line "I want to display the datas to the grid".
Upvotes: 2