I had to do this i would find a way to refer to the active controller,
in this case SiteController, and execute my "rails" methods on that object.
Or even do some ugly meta-programming stuff so in your tags "self" refers to
that controller object.
There must be an instance or class variable that you can access that
gives you a reference to that SiteController instance. Do something like
"puts self.inspect" in your tag to see your "environment" and search for
something useful.
/AITOR
On Nov 15, 2007 3:39 PM, Marc des Garets <[EMAIL PROTECTED]> wrote:
> I just add something to my previous message:
>
> Today I have to do this to call the session method of rails (or any
> other rails method):
> ActionController::SessionManagement::ClassMethods.session
>
> I want to have to do:
> session
>
> without writing the ActionController::SessionManagement::ClassMethods or
> doing an include ActionController::SessionManagement::ClassMethods
>
>
> Marc
>
>
> Marc des Garets wrote:
> > I think a piece of code will explain better what I want to do:
> >
> > Here is my solr_tags.rb:
> >
> > module SolrTags
> > include Radiant::Taggable
> > include Flare::ActionControllerExtensions::InstanceMethods
> > include ActionController::SessionManagement::ClassMethods
> >
> > ...
> >
> > tag 'solr:facet_list' do |tag|
> > @flare = flare_before
> > @flare.facet_fields.each do |field|
> > %{#{facet_label(field)}}
> > end
> > end
> >
> > end
> >
> > The flare_before function in lib/flare/controller_extensions.rb
> >
> > def flare_before
> > # TODO: allow source of context to be configurable.
> > session[:flare_context] ||= Flare::Context.new(SOLR_CONFIG)
> >
> > @flare = session[:flare_context]
> >
> > return @flare
> > end
> >
> > The method session is part of rails, I can call it thanks to include
> > ActionController::SessionManagement::ClassMethods.
> >
> > Now I have this error message:
> > undefined method `write_inheritable_array'
> >
> > This method is called by the method session of rails.
> >
> > What I want to do is that I don't have to add include
> > ActionController::SessionManagement::ClassMethods and that when I use a
> > rails method, this method knows about others rails method.
> >
> > In short, I want to have access to every rails method.
> >
> >
> > Marc
> >
> >
> > Sean Cribbs wrote:
> >
> >> Marc,
> >>
> >> By default, Radius tags are rendered within a Page that is called from
> >> the SiteController, which has the session turned off. You might be
> >> better off using cookies, but you would only be able to read them
> unless
> >> you can come up with some scheme that decides what cookies to send
> based
> >> on the page. Including that module doesn't accomplish what you want.
> >> Could you give us a little more detail about what you want to do?
> >>
> >> Sean
> >>
> >> Marc des Garets wrote:
> >>
> >>
> >>> Hi all,
> >>>
> >>> I'm pretty new in radiant and in ruby on rails but I'm making an
> >>> extension for radiant and I have some questions I'm pretty sure you'll
> >>> be able to answer:
> >>>
> >>> I'm creating my tags for my extension in app/models/solr_tags.rb
> >>>
> >>> I'm using the method session of the
> >>> ActionController::SessionManagement::ClassMethods class of rails but
> to
> >>> use this session method I had to add this in my solr_tags.rb file:
> >>>
> >>> include ActionController::SessionManagement::ClassMethods
> >>>
> >>> After that I can call the method session in my
> >>> lib/flare/controller_extensions.rb that is in a function I'm calling
> >>> from my solr_tags.rb file.
> >>>
> >>> But now, I have this error: undefined method `write_inheritable_array'
> >>> that I could solve doing an other include of a rails class but I was
> >>> wondering if there is an other way to get all these rails method
> without
> >>> adding an include each time I need one rails method. Furthermore, it's
> >>> the method session that is using write_inheritable_array so it should
> be
> >>> fine. I think I have some misconfiguration somewhere. Can you help?
> >>>
> >>> Hope I was clear enough, tell me if not and thank you in advance for
> >>> your help.
> >>>
> >>>
> >>> Marc
> >>>
> >>> _______________________________________________
> >>> Radiant mailing list
> >>> Post: [email protected]
> >>> Search: http://radiantcms.org/mailing-list/search/
> >>> Site: http://lists.radiantcms.org/mailman/listinfo/radiant
> >>>
> >>>
> >>>
> >>>
> >> _______________________________________________
> >> Radiant mailing list
> >> Post: [email protected]
> >> Search: http://radiantcms.org/mailing-list/search/
> >> Site: http://lists.radiantcms.org/mailman/listinfo/radiant
> >>
> >>
> >
> > _______________________________________________
> > Radiant mailing list
> > Post: [email protected]
> > Search: http://radiantcms.org/mailing-list/search/
> > Site: http://lists.radiantcms.org/mailman/listinfo/radiant
> >
>
> _______________________________________________
> Radiant mailing list
> Post: [email protected]
> Search: http://radiantcms.org/mailing-list/search/
> Site: http://lists.radiantcms.org/mailman/listinfo/radiant
>
_______________________________________________
Radiant mailing list
Post: [email protected]
Search: http://radiantcms.org/mailing-list/search/
Site: http://lists.radiantcms.org/mailman/listinfo/radiant