I have a totally wacked problem going on.
I have a model attribute with the same name (“content”) as a helper
function, and when I call “model.content”, it’s calling the “content”
helper function instead of the model’s attribute.
This, of course, causes severe problems.
In our master branch, this is only reproducible on our production
(Rails 2.1.1) machine, which sucks as far as trying to track it down.
I’m working on my dev machine in a Rails 2.3.x branch, in which I can
reproduce the problem with a test. Unfortunately, our code is large
and complex, so I can’t easily tell if it’s something we’re doing, or
an issue with Rails, or what.
Here’s the test result:
test_get_new(MessagingControllerTest):
NoMethodError: undefined method content_tag' for "#<Letter: 0x5dc2ddc>":Letter app/helpers/our_ui_helper.rb:734:in
our_content_tag’
app/helpers/our_ui_helper.rb:74:in content' test/functional/messaging_controller_test.rb:122:in
test_get_new’
The failing line of the test is
assert @reply.content.include?(@original.content), expectation
where @reply is a Letter object, which contains a “content” attribute.
our_ui_helper.rb has a “content” method that’s used by templates.
Why in the world would “model.content” ever call a helper method?
Thanks,
Lee