Comments (9)
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.
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.
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.
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.
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.
@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.
(Reopening this until I make sure I've got any issues here absolutely nailed.)
from fortitude.
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.
Agreed, and thanks again for the discussion on #34.
from fortitude.
Related Issues (20)
- Unit testing of widgets without loading entire Rails stack in test environment? HOT 2
- Script to convert to and from HTML/ERb? HOT 3
- :csrf_meta_tags helper unavailable? HOT 1
- Even more forms weirdness, or... HOT 11
- Using #inline_html with a Rails view context HOT 2
- Implicit passing of `needs` variables fails when View class is named the same as the `needs` key HOT 4
- Can't mark HTML attribute values as html_safe HOT 1
- Upgraded to Rails 4.2.5.2 and everything is blowing up HOT 3
- use controller.view_paths to resolve view paths when calculating widget_class_from_file HOT 1
- Status? HOT 8
- alias_method_chain deprecated in Rails 5 HOT 2
- fix Travis build HOT 2
- Release latest code to rubygems HOT 1
- ArgumentError: wrong number of arguments (given 5, expected 4) with ActionView 4.2.6 HOT 2
- Issues when running tests: "uninitialized constant OopRailsServer::RailsServer::Bundler" HOT 1
- Regression: automatic inclusion of Rails helpers breaks implicit route arguments HOT 6
- Fortitude prevents Rails csrf_meta_tags from being rendered in the <head> element HOT 1
- retina_images repo unavailable
- Single arity template handlers are deprecated in Rails 6.0
- Still maintained? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fortitude.