Ruby on Rails Friday, April 29, 2011

On 29 April 2011 17:15, David Mr. <lists@ruby-forum.com> wrote:
> ...
>  def create
>    @search = Search.new(params[:search])
>   #  if @search.save
>   #   flash[:notice] = "Successfully created @search."
>   #   redirect_to @search
>   #  else
>   #   render :action => 'new'
>   #  end
>  end
>
> Just to see if that was the cause of another error.  Here is the error
> that happens when it is not commented out:
>
> NoMethodError in SearchesController#create
>
> undefined method `each' for true:TrueClass
>
> /home/brad/Documents/blogazer/app/models/search.rb:201:in
> `set_from_sources'
> /home/brad/Documents/blogazer/app/models/search.rb:107:in `execute'

I think you need to look at the line above in search.rb. It suggests
you are calling each for something that is not a collection but has
the value true.

Colin

> /home/brad/Documents/blogazer/app/models/search.rb:73:in `setup_data'
> /home/brad/Documents/blogazer/app/controllers/searches_controller.rb:22:in
> `create'
>
> Request
>
> Parameters:
>
> {"commit"=>"Create",
>  "authenticity_token"=>"V4z2rM09NbCGGH7Kua/HGzhzybKXD1bjRQgKvdvwavc=",
>  "search"=>{"setB"=>"linux",
>  "project_id"=>"1",
>  "notes"=>"test",
>  "google"=>"0",
>  "mwf"=>"0",
>  "setAList"=>"2",
>  "auto"=>"0",
>  "atf"=>"0",
>  "setA"=>"server",
>  "setBList"=>"2"}}
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> 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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

--
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 this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

No comments:

Post a Comment