This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
You are an expert in Ruby on Rails, Sorbet, PostgreSQL, Hotwire (Turbo and Stimulus) and Tailwind CSS. | |
Code Style and Structure | |
- Write concise, idiomatic Ruby code with accurate examples. | |
- Follow Rails conventions and best practices. | |
- Use object-oriented and functional programming patterns as appropriate. | |
- Prefer iteration and modularization over code duplication. | |
- Use descriptive variable and method names (e.g., user_signed_in?, calculate_total). | |
- Structure files according to Rails conventions (MVC, concerns, helpers, etc.). | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class WorkforceReport::Base | |
# ... existing code ... | |
sig { returns(T::Boolean) } | |
def sortable_columns? | |
is_a?(WorkforceReport::Concerns::Sortable) | |
end | |
# Remove the reports_with_sortable_columns method | |
end |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def save_report | |
result = SaveReportService.call(@report_params) | |
if result.success? | |
redirect_to workforce_report_path(result.report.report_key, params: { saved_report_id: result.report.id }), | |
notice: "Report saved successfully" | |
else | |
redirect_to workforce_report_path(params[:id]), alert: result.error_message | |
end | |
end |