2009/5/25 pl
>
> This is pretty weird actually, in the show view the name is displayed
> (nice!!!), but in the index view (the list of all the posts) it isn't
> working yet. The code for the index view (not working) is as I wrote
> earlier:
>
> <% @posts.each do |post| %>
>
><%=h post.clien
This is pretty weird actually, in the show view the name is displayed
(nice!!!), but in the index view (the list of all the posts) it isn't
working yet. The code for the index view (not working) is as I wrote
earlier:
<% @posts.each do |post| %>
<%=h post.client.name %>
<%=h post.title
hey.. ( pepijnloo...@gmail.com )
i hope you got it working by now.. :)
anyway, I've got my problem solved like this.
i wrote
belongs_to :Country, :foreign_key => :Country_id
in products.rb it means that the each products belongs to the
Country table
with the foreign_key of Country_id th
hey.. Thanx Chauhan..
i got it working..
in my case, I used has_one with options..
thanx a bunch :)
On 5월25일, 오전3시32분, Hemali Chauhan wrote:
> Hi,
>
> You must have defined has_many and belongs_to association for Country
> and Product.
>
> So now you can directly write:
> @product.country.name
On 25/05/2009, at 4:30 PM, pepijnloo...@gmail.com wrote:
>
> Hi, I'm also new to rails and I'm trying the same thing. I'm extending
> the Getting Started example to learn.
>
> I've made an extra table called `clients`: (id | name) and I already
> had the table `posts`: (id | title | content | cre
Hi, I'm also new to rails and I'm trying the same thing. I'm extending
the Getting Started example to learn.
I've made an extra table called `clients`: (id | name) and I already
had the table `posts`: (id | title | content | created_at | updated_at
| client_id). The index view for posts loops thr
Also you will make life much easier for yourself if you stick to the rails
naming conventions, so the column names will be id, name, price, country_id
and id, country_name.
You might find this helpful
http://guides.rubyonrails.org/getting_started.html
Colin
2009/5/24 Hemali Chauhan
>
> Hi,
>
>
Hi,
You must have defined has_many and belongs_to association for Country
and Product.
So now you can directly write:
@product.country.name
-Hemali Chauhan
On May 24, 3:14 pm, Mike75 wrote:
> hi
> i'm trying things out with rails, and I'm having trouble with showing
> a list of products.
> i
8 matches
Mail list logo