rails-image-post-solution 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35594d5a6f9cda075e583af74f9ff17aafdf598bc0eb815adbfd86c7c164f66e
4
- data.tar.gz: 33b5f597cea3c34477866d350e3d405ee3c69194ee020e118575585684010fc7
3
+ metadata.gz: a63ded42219e8889a07102f23cc347cd43e44e7464cbc9b611bebdf96d3484a9
4
+ data.tar.gz: e1f35c63835147c647aae29b143b0b349d81ea7f53331270c7a915ef4463e50b
5
5
  SHA512:
6
- metadata.gz: bfcad48d82a46e37f13acf454b04de447a2992e765e9eed4714ba3231a84b7b118ddc0d3cbca2b99e73463d50aae210d65a6c0437309d2cc6d23ac036982a14a
7
- data.tar.gz: 9bf67e931816a16d3b402b4ab810f4f811e2f9b2bb857336e416a40fcd55f3038345664e3d531e75a47f708a9df43e3f38299309a60275530ec2c53e781148b6
6
+ metadata.gz: 2767f9d38c23053f231ab39dcd7af5b37c436c886e3c16ee4c1a5567b8d8819744ccf7d7a241566c93bdf5f059d0a2ba457fb73991e6a8a10791996e3aa02658
7
+ data.tar.gz: 68f042ea40bfffe8e62b211081be779b2407409357ec82014cd7e784c53ed74b5d3cb8aef2da07fb69a24bc3a0d95f98ddc7f4d20742979278fd8d428c78adcc
@@ -5,25 +5,38 @@ module RailsImagePostSolution
5
5
  # Engine's base controller inherits from host application's ApplicationController
6
6
  # This allows the engine to use the host app's authentication methods
7
7
 
8
+ # Include main app's route helpers
9
+ include Rails.application.routes.url_helpers
10
+ helper Rails.application.routes.url_helpers
11
+
8
12
  # Add engine view path before rendering
9
13
  before_action :add_engine_view_path
10
14
 
11
15
  # Override require_login to use main_app routes
12
16
  def require_login
13
17
  unless logged_in?
14
- redirect_to main_app.login_path, alert: I18n.t("errors.messages.login_required")
18
+ redirect_to login_path, alert: I18n.t("errors.messages.login_required")
15
19
  end
16
20
  end
17
21
 
18
22
  # Add require_admin method for admin controllers
19
23
  def require_admin
20
24
  unless logged_in?
21
- redirect_to main_app.login_path, alert: I18n.t("errors.messages.login_required")
25
+ redirect_to login_path, alert: I18n.t("errors.messages.login_required")
22
26
  return
23
27
  end
24
28
 
25
29
  unless current_user.admin?
26
- redirect_to main_app.root_path, alert: I18n.t("errors.messages.admin_required")
30
+ redirect_to root_path, alert: I18n.t("errors.messages.admin_required")
31
+ end
32
+ end
33
+
34
+ # Ensure default_url_options includes locale
35
+ def default_url_options
36
+ if defined?(super)
37
+ super.merge(locale: I18n.locale)
38
+ else
39
+ { locale: I18n.locale }
27
40
  end
28
41
  end
29
42
 
@@ -33,7 +46,7 @@ module RailsImagePostSolution
33
46
  prepend_view_path Engine.root.join("app", "views")
34
47
  end
35
48
 
36
- # Make main_app available as a helper
49
+ # Make main_app available as a helper for engine routes
37
50
  helper_method :main_app
38
51
 
39
52
  def main_app
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module RailsImagePostSolution
4
- VERSION = "0.1.21"
4
+ VERSION = "0.1.23"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rails-image-post-solution
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.21
4
+ version: 0.1.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - dhq_boiler