2009/12/9 RubyonRails_newbie <[email protected]>:
> cool - i'll give this a go. I hope it's as simple as == instead of =.
>
> Dev log showed my query as a select statement from posts, not
> specifically looking at the active_post.

Are you saying that the :conditions => "active_post = 1" is not in the
actual query run?  If so then that is the problem.  Are you sure you
are looking at the right bit of code?  I think you need to debug the
controller.

Colin

>
> will try a bit more.... :-)
>

> cheers
>
> On 9 Dec, 14:05, Colin Law <[email protected]> wrote:
>> 2009/12/9 RubyonRails_newbie <[email protected]>:
>>
>> > Colin,
>>
>> > Before I debug.... I have had an idea:
>>
>> > What about the view?
>>
>> > If I can write a decent if statement to only return active_posts that
>> > = 1 I should be good to go. I did try this today, but it still showed
>> > the inactive post when I set it to 0..
>>
>> > Here's what I wrote - There's maybe a better (correct way) to do it...
>>
>> >  <% if @posts.active_post = 1 %>
>>
>> That should be == 1
>>
>>
>>
>> > <% render :partial => posts %>
>>
>> > <% end %>
>>
>> > <% if @posts.active_post != 1 %>
>>
>> You can use <% else %> rather then end and another if
>>
>>
>>
>> > There are no posts!
>>
>> > <% end %>
>>
>> > Sadly this didn’t work, but I wondered if anyone knew why? I can
>> > delete a post, setting the 1 value to a 0, but the  post still remains
>> > in the view…
>>
>> If still not working put in your view some debug:
>> <p>posts active_post value is <%= @posts.active_post %></p>
>>
>> But you would be better off debugging the controller first to check
>> that the query is working correctly.  Did you look in development.log
>> to see exactly what query is being run?
>>
>> Colin
>
> --
>
> 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.
>
>
>

--

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