calebhearth / formulaic

Simplify form filling with Capybara
MIT License
552 stars 29 forks source link

Fixes human_attribute_name in Label #38

Closed CraigWilliams closed 9 years ago

CraigWilliams commented 9 years ago

Fix humanize_attribute_name

This is the code that was broken. Passing in class_name but using model_name in the method. #classify will also raise an error if model_name is not found.

def class_exists?(class_name)
  Object.const_defined?(model_name.to_s.classify)
rescue NameError
  false
end
calebhearth commented 9 years ago

I'm having trouble figuring out what the underlying issue is here. I'm not in love with the send("attributes_#{model.class}") approach, so I'd like to brainstorm other solutions.

calebhearth commented 9 years ago

Sorry, please ignore hound. We accidentally added it with a bunch of rules we're not following in this project.

CraigWilliams commented 9 years ago

@calebthompson ok, this one has no code changes except the class_name fix

calebhearth commented 9 years ago

Thanks. Squashed & merged in 9b1d28d2c99a3392bc4caaf830f91c4a4d8f3550

calebhearth commented 9 years ago

I also cut a new version, so you should be able to upgrade.