Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
jocubeit opened this issue May 31, 2011 · 5 comments
Closed

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

jocubeit opened this issue May 31, 2011 · 5 comments
Milestone

Comments

@jocubeit
Copy link

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") }
@gregbell
Copy link
Contributor

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:
#131

@ghost ghost assigned pcreux Jun 2, 2011
@pcreux
Copy link
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.

@samuelreh
Copy link
Contributor

I would say 1 as well

@jocubeit
Copy link
Author

jocubeit commented Jun 3, 2011

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

@gregbell
Copy link
Contributor

gregbell commented Jun 3, 2011

+1 for number 1

pcreux added a commit to pcreux/active_admin that referenced this issue Jun 3, 2011
@gregbell gregbell closed this as completed Jun 9, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants