Hoolala...!! (Everything ok... but my way...)
I put that in ApplicationHelper:
def render_as(par)
# ....... in ApplicationHelper
# Usage:
# Where you had : <%= render :active_scaffold =>
"Demos", :constraints => {:demo => true, :fixed => true}, :label =>
"Demos" %>
# Simply put: <%= render_as :active_scaffold =>
"Demos", :constraints => {:demo => true, :fixed => true}, :label =>
"Demos" %>
# Thus in your view, you simply replace render by render_as
# We need a key to transfer to AS and to store something in the
session...
# Every time we call render_as with the same parameters, we can
use the same key, and like that, we don't have every time a new entry
in the session...
uniq = par.to_s
as_controller = par[:active_scaffold]
par.delete(:active_scaffold)
session["as:"+ uniq] = {:list => par}
# implicit: we just render list...
return render_component :controller => as_controller, :action =>
"table", :params => { :eid => uniq }
# thus we need render_component
end
Up to now, it seems to work... with little change in the original view
code.
Expert advice will still be very appreciated...
Hope it helps in the meantime,
Michel
On 18 mar, 16:21, Michelschr <[email protected]> wrote:
> Next episode... (Passing parameters to Embedded Active Scaffold with
> render_component)
>
> Where I had:
>
> <%= render :active_scaffold => "Demos", :label => "Passed" %>
>
> Now, with Rails 2.3.2 and render_component (see the previous
> messages), if I want to send a new label to AS, I should (maybe there
> are other ways, but this one seems to work...) first create a new
> entry in the session like that:
>
> <% session["as:12345"] = {:list => {:label => "Passed"}} %>
> <%= render_component :controller => "Demos", :action =>
> "table", :params => { :eid => "12345" } %>
>
> For sure, it will be better if "12345" is a unique generated key...
>
> So, it seems that this is a work around...
>
> But it would probably be even better if we had a nice official way to
> do that... Maybe the old syntax and AS doing the right job in the
> background...?
>
> I still would really appreciate the advice of the core Active Scaffold
> specialists...
>
> Thanks in advance,
>
> Michel
>
> On 18 mar, 11:53, Michelschr <[email protected]> wrote:
>
> > Thanks a lot,
>
> > Following your advice I did:
>
> > script/plugin install --force git://github.com/lackac/render_component.git
> > -r rails-edge
>
> > And effectively, Rails started correctly.
>
> > Then I had to change my call: previously I had:
>
> > <%= render :active_scaffold => "Demos", :constraints => {:demo =>
> > true, :fixed => true}, :label => "Demos" %>
>
> > and living that make a lot of garbage... So I change to:
>
> > <%= render_component :controller => "Demos", :action => "table" %>
>
> > I had to change to the "table" action to remove the layout... And like
> > that, it begin to work...
>
> > But, if I try to pass " :label => "Demos" " it doesn't work: AS keep
> > the "config.label = "Demos default" " that is set in the controller...
>
> > Up to now I didn't test with the constraints...
>
> > But we are progressing...
>
> > Can anyone help me further...?
>
> > (for Benjamin: is this approach also not working with jruby...?)
>
> > Tanks in advance for tour answers,
>
> > Michel
>
> > On 18 mar, 09:03, Atastor <[email protected]> wrote:
>
> > > Well..for me its a bit obscure, too. But what *does* work (for me :))
> > > is the edge branch of lackac:
>
> > > script/plugin install --force
> > > git://github.com/lackac/render_component.git
> > > -r rails-edge
>
> > > Regards
> > > Michael
>
> > > On 17 Mrz., 20:30, Michelschr <[email protected]> wrote:
>
> > > > Hello everyone,
>
> > > > The controllers managed with AS are wonderful and it's very nice when
> > > > we can embed them within a page of information. Following the AS wiki,
> > > > we was able to write in your controller something like:
>
> > > > render :active_scaffold => 'entries', :constraints => { :user_id =>
> > > > @user.id }
>
> > > > This mechanism was previously based on render_component which
> > > > disappear in Rails 2.3.2.
>
> > > > What should we do now to have the same behavior? What is the best way?
>
> > > > After reading the discussions in this forum and even testing different
> > > > solutions without success, it is still unclear for me... (different
> > > > render_component plugin branches... render_sibling...?)
>
> > > > I am sure that a lot of people will appreciate a clear explanation
> > > > about this topic.
>
> > > > Thanks in advance,
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"ActiveScaffold : Ruby on Rails plugin" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/activescaffold?hl=en
-~----------~----~----~----~------~----~------~--~---