On 9 Dec, 16:43, Colin Law <[email protected]> wrote:
> 2009/12/9 RubyonRails_newbie <[email protected]>:
>
> > I'll need to take another look at it. I dont think it's there,
>
> > Would it look like select * from posts where active_post = 1?
>
> If it is using the code in fetchFirstPostForSessionUser that you
> posted earlier, ie
> Post.find_by_user_id( session[:user_id], 1, :limit => 1, :conditions
> => "active_post = 1", :order => "created_at desc")
>
> Then it should have all of that in it - the user id the conditions,
> the order and the limit.
>
> If your log is getting large you can just delete it and then run the
> query to make it easier to find the bits of interest.
>
> Colin
>
> By the way I do wish you would stop top posting, it makes it much
> harder to follow what you are replying to.


Sorry about that - it this better?


>From my log file I have this:

UPDATE `posts` SET `updated_at` = '2009-12-09 20:24:55', `active_post`
= 0 WHERE `id` = 176

That looks correct in my opinion, and what I know about SQL.

So - I think the problem is with the view.

If the query is working correctly, then all i need to do is correctly
show a post (if it is active only)

So I wrote this:
                <% if @posts.active_post == 1 %>
                <%= render :partial => @posts %>
                <% end %>

This doesn't return a post - even though the database shows 1 active
post. (active_post = 1)

Debugging - I'm new to rails and find this hard enough to follow. I've
not learnt anything about debugging so wouldn't know where to start. I
think the issue is the view, but what do you think?

CHeers

--

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 [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en.


Reply via email to