Currently, I am upgrading my application from rails 3.2 to rails 4. When I navigate to a particular tab, I get the following error:
undefined method `raw' for #<LeaseController:0x00000006935e30>
My code:
vacant.tenant = raw("Vacant")
vacant.lease_start_date = raw(" ")
vacant.rent_end = raw(" ")
vacant.base_rent_monthly_amount = raw("")
vacant.base_rent_annual_psf = raw("")
vacant.options = raw("")
vacant.security_deposit_amount = raw("")
vacant.tis_amount = raw("")
vacant.lcs_amount =raw("")
Why is this method now undefined?
This helper is depreceted. http://apidock.com/rails/ActionView/Helpers/RawOutputHelper
If you still want to use raw
, try including
include ActionView::Helpers::OutputSafetyHelper
into your controller.
In rails 4 raw
method is provided by ActionView::Helpers::OutputSafetyHelper
You can check out its documentation at:
http://api.rubyonrails.org/classes/ActionView/Helpers/OutputSafetyHelper.html
But most importantly this code belongs to view helpers, not controller.
You can use html_safe in your controller. like this string.html_safe
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With