Ruby on Rails Sunday, February 9, 2014

On Friday, February 7, 2014 9:24:43 PM UTC, Bob Kendall wrote:

 am running ruby 1.9.2 and rails 3.2. I have active record call that is returning nil even though the data is there. So my question is, what part am I missing to return the records?


There are a few weird things in your code:
    def self.find_stores(params)
Customer.where("CAD505=? AND TRYT20=?", params[:parmstate],    params[:parmrep]).where.not(cusn05: nil)  end  
Using .not like that is a rails 4 thing but you've said you're using rails 3.2
 

my view: store.html

            <% @customers |customer| %>  
I'm surprised that doesn't cause a syntax error.

What is it that is nil? even if your conditions were incorrect, the code you posted would return an empty relation/array rather than nil

Fred

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/90f7345a-3420-449b-b8da-43c28c573e3e%40googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

No comments:

Post a Comment