Giter Club home page Giter Club logo

Comments (9)

ajb avatar ajb commented on September 3, 2024

Hmm, I'm looking at our one app that uses Fortitude, and it looks like
we're just calling flash as you would in ERB. Does that not work?

On Thu, Jul 23, 2015 at 10:14 AM, Jeff Dickey [email protected]
wrote:

Erector's Rails integration, IIRC, gave you a controller accessor that
you could call #flash on to retrieve flash messages. I've been stumped
for a full day on how to access flash messages inside a Fortitude page
widget. What am I missing?


Reply to this email directly or view it on GitHub
#29.

Adam Becker
(951) 9-BECKER
@AdamJacobBecker

from fortitude.

jdickey avatar jdickey commented on September 3, 2024

Odd… I just read where extra_assigns is documented after having it not catch my eye the first n times I read through the doc. Flash works if you set extra_assigns to :use.

Adding a note to the paragraph starting out

extra_assigns :use says "if passed assignments...

would probably be a Good Thing; something on the order of

extra_assigns :use says "if passed assignments that I haven't needed, make them available anyway, instead of ignoring them. This also pulls in features such as Rails' flash messages that aren't (generally thought of as, at least) instance variables on the controller itself."

Thanks for the quick reply; feel free to close. :)

from fortitude.

jdickey avatar jdickey commented on September 3, 2024

Actually, I notice that setting implicit_shared_variable_access to true will have the same effect; can you describe why one would be chosen over the other for something like this?

from fortitude.

ajb avatar ajb commented on September 3, 2024

Oh, I'm not a collaborator on this repo, just an early user. I'm sure @ageweke will chime in when he's back from his trip.

from fortitude.

jdickey avatar jdickey commented on September 3, 2024

ah, cool; many thanks indeed.

EDIT 2015/07/232 23:45 SGT (GMT+8): Now I really do Feel like a blithering idiot that should not be allowed near sharp edges; the now-I-see-it-now-I-don't experience with #flash comes from whether I'm running in an integration test (where Rails is fully loaded) or a MiniTest unit test (where it obviously isn't). I have got to stop working 100+-hour weeks. Thanks again, @ajb and all. :meep:

from fortitude.

ageweke avatar ageweke commented on September 3, 2024

@jdickey — I'm back from my hike, and taking a look into this. Thanks for the edit. I've never used MiniTest before. If you write a MiniTest unit test, and use ERb (as opposed to Fortitude), does flash work?

My goal is to make Fortitude behave identically to ERb in this sort of situation. Also, extra_assigns :use is really intended as a workaround for old, messy views; it carries a performance penalty out of necessity, and makes it easier to make mistakes. I don't want people to have to turn it on unless they have a lot of really grungy views that make it nearly impossible to reasonably write needs declarations for them.

from fortitude.

ageweke avatar ageweke commented on September 3, 2024

(Reopening this until I make sure I've got any issues here absolutely nailed.)

from fortitude.

ageweke avatar ageweke commented on September 3, 2024

I’m pretty convinced, after looking back over this, that it’s basically the same issue as #34: it’s all about the testing environment. You can’t just .new.html a Fortitude widget in any arbitrary test (whether MiniTest or RSpec or anything else) and have it have access to Rails integration (variables, helpers, etc.), any more than you can just use the raw ERb library to evaluate a .html.erb file and have it have access to Rails integration either. It’s all about the controllers. There’s a very long comment I left on #34 that hopefully makes it all crystal-clear (or even more muddy ;) )…

from fortitude.

jdickey avatar jdickey commented on September 3, 2024

Agreed, and thanks again for the discussion on #34.

from fortitude.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.