Ad
Override ShopifyApp Module Method
I'm trying to override ShopifyApp's new method but not sure where to start. Basically I need to add another field to get a params
:
/lib/shopify_app/sessions_concern/new.rb:
module ShopifyApp
module SessionsConcern
module New
def new
if params[:field] == "abc"
authenticate if params[:shop].present?
end # or else ...
end
end
end
end
To use that module, I would do something like this in a controller:
ShopifyApp::SessionsConcern.prepend ShopifyApp::SessionsConcern::New
But there's no where to use that. How to go about this the correct way?
Ad
Answer
Overriding is overriding. The following would do it for you without any prepend
ing (having that you are loading the code from lib
directory):
# lib/shopify_monkeypatching.rb
module ShopifyApp
module SessionsConcern
def new
if params[:field] == "abc"
authenticate if params[:shop].present?
end # or else ...
end
end
end
Ad
source: stackoverflow.com
Related Questions
- → Trigger a click with jQuery using link_to of rails 4
- → Adding html data attribute to simple_forms input
- → How to remove parameters from the root URL if it does I18n
- → passing parameters to rails back end from an ajax call
- → Blocking ?page= in robots.txt
- → react js and rails Updating state on a component with active record relationship
- → Kaminari How to process routes as javascript
- → State not passed into prop
- → Cannot read property 'modalIsOpen' of undefined
- → Objects not valid issue
- → How to map API params to model
- → Consuming webhooks shopify-api
- → How to add ScriptTag on shopify_api gem?
Ad