To all:
hi i am pretty noob. Basically I am learning via copy and paste, so
please forgive me.
I am using rails 1.2.6.
I built 2 scaffold_resource called traders and orders.
I want a localhost:3000/v1/traders/{trader_name}/orders
so I did a
base = ‘/v1’
map.resources :traders, :path_prefix => base
#trader_url
trader_url = base + ‘/traders/:login’
map.resources :orders, :path_prefix => trader_url
inside the orders_controller:
i did this
def index
@orders = Order.find_by_trader_id(@trader.id)
respond_to do |format|
format.html
end
I have 2 questions:
-
am i doing it right in the routes.rb?
-
i get an error at the webpage.
undefined method `each’ for #Order:0x4624f18
Extracted source (around line #7):
4:
5:
6:
7: <% for order in @orders %>
8:
9:
10: <% for column in Order.content_columns %>
what is wrong?
Please help. I thank you all.