Open atodorov opened 8 years ago
sounds like a good idea.
I guess just providing the gem with a ruby proc that gets evaluated dynamically should do the job pretty well. Would you mind taking a stab at implementing this?
@jhilden - I don't mind looking into this but I will need some pointers/examples since my Rails/Ruby experience is a bit limited. I need to know what to look for before trying to implement anything.
no problem.
we have a different gem where we allow users to pass in certain configuration options in form of a Proc or lambda (instead of like a integer or string). see https://github.com/railslove/rack-tracker#google-analytics the :user_id
. That way this code will always be executed, when the configuration option is accessed.
when using the configuration option in the code you need to check if it responds to a call
method (which procs/lambdas do), like we are doing here: https://github.com/railslove/rack-tracker/blob/05265a3273944215f58992f34e9ad9dcb08ee5fc/lib/rack/tracker/google_analytics/google_analytics.rb#L57
let me know if you have additional questions.
@jhilden - one more question. How do I change the external_tool_url setting at runtime ? I want to assign a labmda to it in one of the tests, without affecting the rest of them. Otherwise I think I got it working fairly easy,
As far as I can see the
external_tool_url
can't change during runtime, can it ? WebTranslateIt for example uses URLs of the formXXX/en..fr/YYY
. This will stay the same even if I'm viewing the same page in German, supposedly wanting to work on the German translations.How hard would it be to be able to set the external_tool_url depending on what page is being viewed ? I'm OK if this is done in Rails if you can't do it in JavaScript.