Re: [Rails] Variable scope in rails controller

2015-12-03 Thread Colin Law
On 3 December 2015 at 15:58, Sai Ch wrote: > Hi, > > I would like to know variable scope for variable accessibility in all > rails controller methods. > > for example, I had done like below. > > class app_controller > > def set_vaule > @var = "12gfjdl" > end > > def actions1 > need display @var

[Rails] Variable scope in rails controller

2015-12-03 Thread Sai Ch
Hi, I would like to know variable scope for variable accessibility in all rails controller methods. for example, I had done like below. class app_controller def set_vaule @var = "12gfjdl" end def actions1 need display @var here end def action2 here also need @var value end end note: I ha

Re: [Rails] Variable scope in rails controller

2015-11-26 Thread Colin Law
On 26 November 2015 at 05:23, Sai Ch wrote: > Hi, > > I need to access one variable in entire controller i.e it is accessible > to all actions in controller. > > I had tried with session and class variable but for example > > def create >document_id = get_document >@@document_id = sessio

[Rails] Variable scope in rails controller

2015-11-26 Thread Sai Ch
Hi, I need to access one variable in entire controller i.e it is accessible to all actions in controller. I had tried with session and class variable but for example def create document_id = get_document @@document_id = session[:document_id] = document_id end def validate if docume