Closed mattslay closed 10 years ago
:+1: Same here. When I run formatter.methods
, :link_to
is not in the list.
Hey,
link_to
is stored on an object inside of the formatter, specifically: url_formatter
. You should be able to access as such:
def format_id(value)
link = formatter.url_formatter.link_to value, formatter.url_formatter.url_helpers.edit_contact_path(value)
Integer === value ? link : value
end
Alternatively, to shorten that up, you can make your formatter for that report class include the Dossier::Formatter::UrlFormatter
module
def formatter
@formatter ||= Class.new(Dossier::Formatter::UrlFormatter) {
include Dossier::Formatter
}.new
end
def format_id(value)
Integer === value ? formatter.link_to value, formatter.url_helpers.edit_contact_path(value) : value
end
Please let me know if you have any questions. Thanks!
I'm getting this error when running a report. It says the url_helpers method is undefined:
NoMethodError at /reports/contacts. undefined method `url_helpers' for Dossier::Formatter:Module