How come 'current_spree_user' is available in the views, while it is not an instance variable - spree

I'm using Solidus/Spree.
Normally when you use variables from the controller, you use instance variables that start with an #.
In my views, I have seen the use of current_spree_user which is not an instance variable, but it does work. I don't see this local variable 'current_spree_user' being assigned somewhere in my view.
Anybody knows how it is possible that current_spree_user is an valid variable within a view?

It's not an controller instance variable, but controller helper method :
https://github.com/spree/spree_auth_devise/blob/master/lib/spree/authentication_helpers.rb

Related

Can I create my own variable which should work like built in variable in Informatica

I want to create my own variable and want to set my default value which should work like a built in variable in Informatica. I want to use created variable in my all workflow.
Is it possible any way ?
Thanks
You can use the same parameter file across all of your mappings (there is syntax to separate out bits which are for specific sections and those which are universal by way of the scope) see following link https://network.informatica.com/thread/27560

initiate a variable dynamically to work in all session on workflow

I am developing an Informaticajob with multiple sessions in one workflow. I need to assign a variable ##AAR with following code
IIF(get_date_part(sysdate,'mm') <= 7, get_date_part(add_to_date(sysdate,'YY',-2),'YY'), get_date_part(add_to_date(sysdate,'YY',-1),'YY')
)
I am not sure how to get about it, I was thinking on creating a session that assigns the variable, then passes it to the workflow.
This session should be the first session to run in the workflow. but I don't know how to create a session that is not a mapping.
What could I do to get this done?
First, you define the variables in your workflow (Workflows -> Edit -> Variables) so the workflow knows about the variables.
Then, as first Task in your workflow, you take an "Assignment" instead of a session. That's the icon that looks like a calculator.
In the assignment, you can assign values to your variables.
Please note that the variables need to be names "$$..." not "##..."

Locking a ColdFusion Application Variable that points to instance of an object

I'm running my applications on CF 9. I created a CFC to concentrate my cookie handling instead of all the tags strewn about. It is simple. It has two attributes (name, value), and has 5 methods (setCookie, deleteCookie, verifyCookie, clearAllCookies, and init).
Since I wanted this method to be available throughout the application, I put this code in the onApplicationStart method of my application.cfc file:
application.oCookie = createObject("com.mycookie").init();
When I need to set a cookie in any code file I just call it like so:
application.oCookie.name="testCookieName";
application.oCookie.value="testCookieValue";
application.oCookie.setCookie();
My question is: Do I need to put a lock on this code each time I do this? If two separate users were to be on pages accessing this code at the same exact instant, can I end up with mixed up cookie values being set?
To make your oCookie thread-safe, it has to be a singleton (with no state) that only acts as a thin layer to the <cfcookie> or the cookie scope.
Therefore you should design your com.mycookie so that it accepts application.oCookie.setCookie(name, value) instead. And make sure you var-scope everything and don't store anything in the variables scope of mycookie.
And I don't think you need to use cflock.
If you haven't already, you may want to checkout WireBox.

CMS Made Simple - Set Variable to be Available across Templates

Is it possible to create a custom variable in CMS Made Simple that could be set in one template and then this value would be available in another template for the same site?
Edit:
I forgot to add that the template I want to set the variable in is using a different domain, although it is the same site. This means I can't use cookies or session vars.
You can use the smarty assign or capture system:
{assign var="foo" value="bar"}
{capture name="foo"}bar{/capture}
Please note that this depends on the order of the templates are executed. For example, in most scenarios, everything inside is executed before everything inside from the main template.

CakePHP: Override template variables for an view element

I'm using an viewelement inside a view and I need to override a templatevariable which was set in the controller. I pass a key-value-array into the element, but for that key it has no effect. Other variables, which are not defined before I can use inside the element. Is there a trick to do that or do I need another variable for that?
Inside Controller
$this->set('mykey', 'myvalue');
Inside Template
echo $this->element('myelement', array('mykey' => 'anothervalue'));
Any ideas?
I've just tested the setup you've described and the variable set by the second element parameter is used instead of the variable set in the controller. So "myelement" echoes "anothervalue" as is expected.
It could be that element caching is enabled, though you have to specify this as a parameter for the $this->element() call.