Custom helper

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:

  <% hidden_div_if(@test.counter > 0, :id => "test") %>
  <%= render(:partial => "test", :object => @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?

  test

Salu2…

On Jan 30, 2008 7:12 PM, masch [email protected] wrote:

class Test1
attr_accessor :counter

countter ?

    def initialize
            @countter = 0

counter ?


Greg D.
http://destiney.com/

Sorry it’s wrong in the email, but in the code it’s countter…
Do you know what i’m doing wrong?

Salu2…

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs