Re: [Rails] Cannot redirect to nil! - basic MVC operation
On Mon, Sep 17, 2012 at 9:31 AM, Bogdan M. <lists@ruby-forum.com> wrote:
> controller:
>
> def random
> @task = Task.find(rand(Task.first.id..Task.last.id))
> # REMOVE - UNNECESSARY render "random"
> end
>
> random.html.erb
> <%= @task %> # i want it to make it work, if i pass manually
> lets #say `../random/1` lets say as an example it works it shows me the
> memory #location of the object.
@task.inspect would be more useful, or actually displaying some
specific attributes of the object :-)
> error log:
>
> ActionController::ActionControllerError in TasksController#show
> Cannot redirect to nil!
But here, you're not even using your "random" method, you're calling
"show" -- check your routes.
--
Hassan Schroeder ------------------------ hassan.schroeder@gmail.com
http://about.me/hassanschroeder
twitter: @hassan
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home