torso
June 30, 2008, 9:46am
1
Hi!
I have made an scaffold for Item table like script/generate scaffold
Item. Everything went fine, but now i like to add list action to
controller
Def list
$items = Item.finde(:all)
end
I have added it, but how i can see the template like
http://address/items/list
Can i redirect it some how?
Action index does same thing as list action,but i want to make
different kind of view for those.
torso
June 30, 2008, 11:42am
2
torso wrote:
Hi!
I have made an scaffold for Item table like script/generate scaffold
Item. Everything went fine, but now i like to add list action to
controller
Def list
$items = Item.finde(:all)
end
I have added it, but how i can see the template like
http://address/items/list
Can i redirect it some how?
Action index does same thing as list action,but i want to make
different kind of view for those.
I think you did not declare it in your rooting file.
Try to add/update something like that :
map.resources :items,
:collection => {
:list => :get
}
Hope this helps.
Guillaume Petit
http://www.nomadsper.com
torso
June 30, 2008, 12:11pm
4
So i have to add it to the routers.rb in config directory. Am i
right?
On Jun 30, 12:42 pm, Guillaume Petit <rails-mailing-l…@andreas -
torso
June 30, 2008, 2:43pm
5
I would be more concerned with the fact he’s defining $items in his
action…
The $ signifies a global variable, which I personally have never found a
use
for. Change the $ to a @ to make it an instance variable so the variable
is
only defined for that instance.