Fixed it. Rails 14.1 sees a column of tinyint in MySQL as a Boolean and that
is where the failure in the consition was
On 10/20/05, Brien Dilts
<hybridindie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> I just upgrade my rails to 14.1 and now a simple condition to show an
> article state, and Boolean states with icons only evaluates for the first
> record and then applies that value to the every additional record
retrieved.
> What would cause this?
>
> #View Code excerpt
> # calls a helper method that in turn calls a Model function that retrieves
> the records with the associated FK reference
> <% articles_in_category(cat.id <http://cat.id>).each do |art|
-%>
> <tr class="data">
> <td><%= image_tag((art.allow_comments == 1 ?
"icons/green.png" :
> "icons/red.png"), :size => "14x14") %></td>
> <td><% if art.allow_comments != 0 -%><%= link_to
"(" +
> art.comments.size.to_s + ")", :controller =>
"comments", :action =>
> "article", :id => art.id <http://art.id> %><% end
-%></td>
> <td><%= art.published == 0 ? "Draft" :
"Published" %></td>
> </tr>
> <% end -%>
>
> # Model Query
> def self.admin_get_category_articles(cat)
> Article.find(:all, :conditions => ["articles.published != 2 AND
> articles.id <http://articles.id> = articles_categories.article_id AND
> articles_categories.category_id = ?", cat], :order =>
"articles.created_atDESC", :include => [:categories, :comments,
:user])
> end
>
> Any ideas, i think it is something in the way ActionView renders that has
> changed bit i cant find anything in the change logs and it worked in 13.1
> --
> J "Brien" Dilts | HybridIndie Productions |
http://hybridindie.com |
> hybridindie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
--
J "Brien" Dilts | HybridIndie Productions | http://hybridindie.com |
hybridindie-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org
_______________________________________________
Rails mailing list
Rails-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org
http://lists.rubyonrails.org/mailman/listinfo/rails