Currently I am learning to create a Shopify custom app. I am working on metafields. A metafield can be created by
@metafield = ShopifyAPI::Metafield.new()
In form view, I use
<%= bootstrap_form_for @metafield do |f| %>
<% end %>
The form requires me to define shopify_api_metafields_path
etc.
Is there a way to define prefix shopify_api
to my routes resources :metafields
without adding ShopifyApi::
module to my controller?
2
Answers
I come up with solution by defining a model
Metafield
which inherit fromShopifyAPI::Metafield
and then, I define@metafield = Metafield.new
instead of@metafield = ShopifyAPI::Metafield.new
By this way, it will be easier to manage later and it allow us to synchronize data table as well.
You could try:
Which will give you: