so could I use a code like
before_filter do |controller|
controller.god = “Mygod”
end
and used god or @god veriable in layout?
it seems @god ok. but why it’s possible?
and used god or @god veriable in layout?
it seems @god ok. but why it’s possible?
Hi Zhenning G.
From api it says before_filter accepts a block with controller
passed.“The block has access to both the request and response objects
complete with convenience methods for params, session, template, and
assigns”. And in your case ‘god’ an instance variable which may be
declared somewhere with attr_writer or attr_accessor
Sijo K George
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs