before_filter running out of order, working fine in dev and staging env. but not working on qa env





.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty{ height:90px;width:728px;box-sizing:border-box;
}







0
















We have following filters in controller:




  before_action :authenticate_api_request!, except: [:reply_messages]
before_action :community_uuid
before_action :is_user_blocked?, only: [:create, :like, :dislike, :flag, :reply_message]
before_action :user_confirmed_email?, only: [:create]
before_action :get_message, only: [:like, :dislike, :flag, :remove, :get_message_json, :reply_message, :reply_messages]
before_action :get_reply_message, only: [:reply_message]
before_action :get_group, only: [:create]
before_action :is_blocked_from_group?, only: [:create, :like, :dislike, :reply_message]


and order in which they are executed is:



user_confirmed_email?
get_message
get_reply_message
authenticate_api_request!
community_uuid
is_user_blocked?
get_group
is_blocked_from_group?


The problem here is authenticate_api_request!, community_uuid and is_user_blocked? is called after user_confirmed_email?.



Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code.










share|improve this question

























  • What is your question?

    – Aleksei Matiushkin
    Nov 22 '18 at 15:18






  • 1





    Possible duplicate of How can I specify the order that before_filters are executed?

    – John Baker
    Nov 22 '18 at 16:01











  • There is no duplication of filter "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

    – HarsHarI
    Nov 25 '18 at 6:32


















0
















We have following filters in controller:




  before_action :authenticate_api_request!, except: [:reply_messages]
before_action :community_uuid
before_action :is_user_blocked?, only: [:create, :like, :dislike, :flag, :reply_message]
before_action :user_confirmed_email?, only: [:create]
before_action :get_message, only: [:like, :dislike, :flag, :remove, :get_message_json, :reply_message, :reply_messages]
before_action :get_reply_message, only: [:reply_message]
before_action :get_group, only: [:create]
before_action :is_blocked_from_group?, only: [:create, :like, :dislike, :reply_message]


and order in which they are executed is:



user_confirmed_email?
get_message
get_reply_message
authenticate_api_request!
community_uuid
is_user_blocked?
get_group
is_blocked_from_group?


The problem here is authenticate_api_request!, community_uuid and is_user_blocked? is called after user_confirmed_email?.



Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code.










share|improve this question

























  • What is your question?

    – Aleksei Matiushkin
    Nov 22 '18 at 15:18






  • 1





    Possible duplicate of How can I specify the order that before_filters are executed?

    – John Baker
    Nov 22 '18 at 16:01











  • There is no duplication of filter "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

    – HarsHarI
    Nov 25 '18 at 6:32














0












0








0









We have following filters in controller:




  before_action :authenticate_api_request!, except: [:reply_messages]
before_action :community_uuid
before_action :is_user_blocked?, only: [:create, :like, :dislike, :flag, :reply_message]
before_action :user_confirmed_email?, only: [:create]
before_action :get_message, only: [:like, :dislike, :flag, :remove, :get_message_json, :reply_message, :reply_messages]
before_action :get_reply_message, only: [:reply_message]
before_action :get_group, only: [:create]
before_action :is_blocked_from_group?, only: [:create, :like, :dislike, :reply_message]


and order in which they are executed is:



user_confirmed_email?
get_message
get_reply_message
authenticate_api_request!
community_uuid
is_user_blocked?
get_group
is_blocked_from_group?


The problem here is authenticate_api_request!, community_uuid and is_user_blocked? is called after user_confirmed_email?.



Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code.










share|improve this question

















We have following filters in controller:




  before_action :authenticate_api_request!, except: [:reply_messages]
before_action :community_uuid
before_action :is_user_blocked?, only: [:create, :like, :dislike, :flag, :reply_message]
before_action :user_confirmed_email?, only: [:create]
before_action :get_message, only: [:like, :dislike, :flag, :remove, :get_message_json, :reply_message, :reply_messages]
before_action :get_reply_message, only: [:reply_message]
before_action :get_group, only: [:create]
before_action :is_blocked_from_group?, only: [:create, :like, :dislike, :reply_message]


and order in which they are executed is:



user_confirmed_email?
get_message
get_reply_message
authenticate_api_request!
community_uuid
is_user_blocked?
get_group
is_blocked_from_group?


The problem here is authenticate_api_request!, community_uuid and is_user_blocked? is called after user_confirmed_email?.



Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code.







ruby-on-rails ruby ruby-on-rails-3






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 6:31







HarsHarI

















asked Nov 22 '18 at 14:44









HarsHarIHarsHarI

812411




812411













  • What is your question?

    – Aleksei Matiushkin
    Nov 22 '18 at 15:18






  • 1





    Possible duplicate of How can I specify the order that before_filters are executed?

    – John Baker
    Nov 22 '18 at 16:01











  • There is no duplication of filter "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

    – HarsHarI
    Nov 25 '18 at 6:32



















  • What is your question?

    – Aleksei Matiushkin
    Nov 22 '18 at 15:18






  • 1





    Possible duplicate of How can I specify the order that before_filters are executed?

    – John Baker
    Nov 22 '18 at 16:01











  • There is no duplication of filter "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

    – HarsHarI
    Nov 25 '18 at 6:32

















What is your question?

– Aleksei Matiushkin
Nov 22 '18 at 15:18





What is your question?

– Aleksei Matiushkin
Nov 22 '18 at 15:18




1




1





Possible duplicate of How can I specify the order that before_filters are executed?

– John Baker
Nov 22 '18 at 16:01





Possible duplicate of How can I specify the order that before_filters are executed?

– John Baker
Nov 22 '18 at 16:01













There is no duplication of filter "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

– HarsHarI
Nov 25 '18 at 6:32





There is no duplication of filter "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

– HarsHarI
Nov 25 '18 at 6:32












1 Answer
1






active

oldest

votes


















0














Check Filter Chain Ordering and this other answer.



You have to specify :prepend_before_filter so that your filters are executed on the beginning of the chain.



Notice that :prepend_before_action is an alias of :prepend_before_filter, prepend_before_action.



I haven't tried it myself but you might write something like:



  before_action :user_confirmed_email?, only: [:create]
before_action :get_message, only: [:like, :dislike, :flag, :remove, :get_message_json, :reply_message, :reply_messages]
before_action :get_reply_message, only: [:reply_message]
before_action :get_group, only: [:create]
before_action :is_blocked_from_group?, only: [:create, :like, :dislike, :reply_message]
prepend_before_action :is_user_blocked?, only: [:create, :like, :dislike, :flag, :reply_message]
prepend_before_action :community_uuid
prepend_before_action :authenticate_api_request!, except: [:reply_messages]





share|improve this answer
























  • We don't need this due to "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

    – HarsHarI
    Nov 25 '18 at 6:33












Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433353%2fbefore-filter-running-out-of-order-working-fine-in-dev-and-staging-env-but-not%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














Check Filter Chain Ordering and this other answer.



You have to specify :prepend_before_filter so that your filters are executed on the beginning of the chain.



Notice that :prepend_before_action is an alias of :prepend_before_filter, prepend_before_action.



I haven't tried it myself but you might write something like:



  before_action :user_confirmed_email?, only: [:create]
before_action :get_message, only: [:like, :dislike, :flag, :remove, :get_message_json, :reply_message, :reply_messages]
before_action :get_reply_message, only: [:reply_message]
before_action :get_group, only: [:create]
before_action :is_blocked_from_group?, only: [:create, :like, :dislike, :reply_message]
prepend_before_action :is_user_blocked?, only: [:create, :like, :dislike, :flag, :reply_message]
prepend_before_action :community_uuid
prepend_before_action :authenticate_api_request!, except: [:reply_messages]





share|improve this answer
























  • We don't need this due to "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

    – HarsHarI
    Nov 25 '18 at 6:33
















0














Check Filter Chain Ordering and this other answer.



You have to specify :prepend_before_filter so that your filters are executed on the beginning of the chain.



Notice that :prepend_before_action is an alias of :prepend_before_filter, prepend_before_action.



I haven't tried it myself but you might write something like:



  before_action :user_confirmed_email?, only: [:create]
before_action :get_message, only: [:like, :dislike, :flag, :remove, :get_message_json, :reply_message, :reply_messages]
before_action :get_reply_message, only: [:reply_message]
before_action :get_group, only: [:create]
before_action :is_blocked_from_group?, only: [:create, :like, :dislike, :reply_message]
prepend_before_action :is_user_blocked?, only: [:create, :like, :dislike, :flag, :reply_message]
prepend_before_action :community_uuid
prepend_before_action :authenticate_api_request!, except: [:reply_messages]





share|improve this answer
























  • We don't need this due to "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

    – HarsHarI
    Nov 25 '18 at 6:33














0












0








0







Check Filter Chain Ordering and this other answer.



You have to specify :prepend_before_filter so that your filters are executed on the beginning of the chain.



Notice that :prepend_before_action is an alias of :prepend_before_filter, prepend_before_action.



I haven't tried it myself but you might write something like:



  before_action :user_confirmed_email?, only: [:create]
before_action :get_message, only: [:like, :dislike, :flag, :remove, :get_message_json, :reply_message, :reply_messages]
before_action :get_reply_message, only: [:reply_message]
before_action :get_group, only: [:create]
before_action :is_blocked_from_group?, only: [:create, :like, :dislike, :reply_message]
prepend_before_action :is_user_blocked?, only: [:create, :like, :dislike, :flag, :reply_message]
prepend_before_action :community_uuid
prepend_before_action :authenticate_api_request!, except: [:reply_messages]





share|improve this answer













Check Filter Chain Ordering and this other answer.



You have to specify :prepend_before_filter so that your filters are executed on the beginning of the chain.



Notice that :prepend_before_action is an alias of :prepend_before_filter, prepend_before_action.



I haven't tried it myself but you might write something like:



  before_action :user_confirmed_email?, only: [:create]
before_action :get_message, only: [:like, :dislike, :flag, :remove, :get_message_json, :reply_message, :reply_messages]
before_action :get_reply_message, only: [:reply_message]
before_action :get_group, only: [:create]
before_action :is_blocked_from_group?, only: [:create, :like, :dislike, :reply_message]
prepend_before_action :is_user_blocked?, only: [:create, :like, :dislike, :flag, :reply_message]
prepend_before_action :community_uuid
prepend_before_action :authenticate_api_request!, except: [:reply_messages]






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 15:25









byrdEmmanuelbyrdEmmanuel

866318




866318













  • We don't need this due to "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

    – HarsHarI
    Nov 25 '18 at 6:33



















  • We don't need this due to "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

    – HarsHarI
    Nov 25 '18 at 6:33

















We don't need this due to "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

– HarsHarI
Nov 25 '18 at 6:33





We don't need this due to "Its working properly in dev and staging environment but not working same code on qa server, didn't get why this happen even replicate same code."

– HarsHarI
Nov 25 '18 at 6:33




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53433353%2fbefore-filter-running-out-of-order-working-fine-in-dev-and-staging-env-but-not%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Hercules Kyvelos

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud