status_tag helper method doesn't handle nil/null value #131

Closed
JurgenJocubeit opened this Issue May 31, 2011 · 5 comments

Comments

Projects
None yet
4 participants

I get the following error when I have nil/null values in the column where I call status_tag in my index table view:

undefined method `downcase' for nil:NilClass

My thoughts are it should return a css class called .null or .nil rather than not an error. Something like:

<span class="status null">Null</span>

I have managed to work around this in my index table view by using:

column("State") { |order| status_tag(order.state || "New") }
Contributor

gregbell commented May 31, 2011

Thanks for the report. I've added this as a fix for next release

On 2011-05-30, at 6:47 PM, MeetDomreply@reply.github.com wrote:

I get the following error when I have nil/null values in the column I call status_tag in my index table view:

undefined method `downcase' for nil:NilClass

My thoughts are it should return a css class called .null or .nil rather than not an error. Something like:

Null

I have managed to work around this in my index table view by using:

column("State") { |order| status_tag(order.state || "New") }

Reply to this email directly or view it on GitHub:
gregbell#131

pcreux was assigned Jun 2, 2011

Contributor

pcreux commented Jun 2, 2011

I'm working on it. So: status_tag(nil) should return:

  1. "<span class="status"></span>"
  2. "<span class="status none">None</span>"
  3. "<span class="status null">Null</span>"
  4. ""
  5. nil
    ?

I'm for 1.

Contributor

samuelreh commented Jun 2, 2011

I would say 1 as well

Hmmm, I would have to go with 1 as well I think, that makes sense. Thanks for asking.

Contributor

gregbell commented Jun 3, 2011

+1 for number 1

@pcreux pcreux added a commit to pcreux/active_admin that referenced this issue Jun 3, 2011

@pcreux pcreux Fix bug on status_tag. Closes #131 995ae9a

gregbell closed this Jun 9, 2011

pcreux was unassigned by JurgenJocubeit Aug 12, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment