Hi!
I have a model like this:
class Test1
attr_accessor :counter
def initialize
@countter = 0
end
def increase
@countter += 1
end
end
A helper
module DiscsHelper
def hidden_div_if(condition, attributes = {})
if condition
attributes["style" ] = "display: none"
end
attrs = tag_options(attributes.stringify_keys)
"<div #{attrs}>"
end
end
A view:
<!-- Begin div=test -->
<% hidden_div_if(@test.counter > 0, :id => "test")
%>
<%= render(:partial => "test", :object => @test) %>
<!-- End div=test-->
The problem is that when y try to test it the HTML result is wrong,
it'' not create the header of the dev test, what am i doing wrong?
<!-- Begin div=test -->
test
</div>
<!-- End div=test-->
Salu2...
--~--~---------~--~----~------------~-------~--~----~
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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
On Jan 30, 2008 7:12 PM, masch <the.masch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> class Test1 > attr_accessor :countercountter ?> def initialize > @countter = 0counter ? -- Greg Donald http://destiney.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Sorry it''s wrong in the email, but in the code it''s countter.. Do you know what i''m doing wrong? Salu2... On Feb 1, 2008 2:57 PM, Greg Donald <gdonald-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> > On Jan 30, 2008 7:12 PM, masch <the.masch-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > class Test1 > > attr_accessor :counter > > countter ? > > > def initialize > > @countter = 0 > > counter ? > > > > -- > Greg Donald > http://destiney.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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---