[Instantrails-users] One Last Question for me..
MaxSteel
maxsteel at gmail.com
Thu Jan 19 01:41:16 EST 2006
And then I should be ready to roll with my project.. I have some fine
tuning of the looks to do after, but funtionality first!
This is probably a rails question.. but I'm not sure where to sign up
for the rails questions email group? (I guess I turned this into a 2
question email).
I'll ask here and then if someone will send me the url of where I go
to sign up for the rails type questions, that'd be great!
now let's see if i can explain it:
(once again using the recipe example provided)
by default after you edit a category name, it "redirects" to a showing
of the new category name (by id) eg: /category/show/6
because I've feverishly edited the show.rhtml (for a different
purpose) I get nasty errors after updating the category name.
What is the easiest way to change that so it redirects back to say
/category/list ?
i know that:
def show
redirect_to :action => 'list'
end
will work, but that will kill my current "show" (for category controller):
@categories = Category.find_all
@recipes = Recipe.find_all
@c = @params['c']
@r = @params['r']
@recipe = Recipe.find(@params["r"])
is there some way to accomplish this with an if/else statement?
I've googled high and low.. I can't seem to find much documentation on
controller syntax, so it's easily errored (anyone have a good site for
this? ..please?)
my attempts has lead me to such:
def show
if
redirect_to :action => 'list'
else
@categories = Category.find_all
@recipes = Recipe.find_all
@c = @params['c']
@r = @params['r']
@recipe = Recipe.find(@params["r"])
end
end
I just don't know what to put after the if to say if (url) "
/category/show/id# " then redirect_to :action => 'list'
else just pass the params.
If anyone can help much appreciated..
(hope that made sense)
If I can get it to work I'm willing to pass on my recipe 2.0, if you
will, to anyone who cares to take a peek!
Thanks again!
Ryan
More information about the Instantrails-users
mailing list