Skip to content

Commit

Permalink
fix: exclude rails 7.1 version error from production (#3042)
Browse files Browse the repository at this point in the history
* fix: exclude error manager from production

* keep error manager on prod

* tweaks
  • Loading branch information
Paul-Bob authored Jul 24, 2024
1 parent 6af4f0e commit b47c312
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
2 changes: 1 addition & 1 deletion app/views/avo/partials/_custom_tools_alert.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
</a>
</div>
<% end %>
<% if Avo.error_manager.has_errors?.present? %>
<% if Avo.error_manager.has_errors? %>
<% Avo.error_manager.all.each do |error| %>
<% if error.is_a? Hash %>
<%
Expand Down
3 changes: 2 additions & 1 deletion lib/avo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ def boot
# Runs on each request
def init
Avo::Current.error_manager = Avo::ErrorManager.build
check_rails_version_issues
# Check rails version issues only on NON Production environments
check_rails_version_issues unless Rails.env.production?
Avo::Current.resource_manager = Avo::Resources::ResourceManager.build
Avo::Current.tool_manager = Avo::Tools::ToolManager.build

Expand Down
4 changes: 2 additions & 2 deletions lib/avo/error_manager.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ def initialize
end

def add(error)
errors << error
@errors << error
end

def has_errors?
errors.present?
@errors.present?
end
end
end
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
class TeamMembershipToolPlayground < Avo::BaseResourceTool
class Avo::ResourceTools::TeamMembershipToolPlayground < Avo::BaseResourceTool
self.name = "Team membership tool playground"
# self.partial = "avo/resource_tools/team_membership_tool_playground"
end
2 changes: 1 addition & 1 deletion spec/dummy/app/avo/resources/membership.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,5 @@ def fields
field :team, as: :belongs_to
end

# tool TeamMembershipToolPlayground, show_on: :all
# tool Avo::ResourceTools::TeamMembershipToolPlayground, show_on: :all
end

0 comments on commit b47c312

Please sign in to comment.