show_message 0.0.2 → 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/README.md
CHANGED
@@ -25,7 +25,8 @@ Add this code where you want your error messages to be shown.
|
|
25
25
|
<%= show_message %>
|
26
26
|
```
|
27
27
|
|
28
|
-
Set a message in your controller.
|
28
|
+
Set a message in your controller. You can use :error, :success, :myCoolMessage or :whatever. You get the point.
|
29
|
+
The only thing you should not use is and "_". Read on to see why.
|
29
30
|
|
30
31
|
```ruby
|
31
32
|
class MyController
|
@@ -37,8 +38,30 @@ class MyController
|
|
37
38
|
end
|
38
39
|
```
|
39
40
|
|
41
|
+
Now, when using remote forms I came across the issue where I would have multiple show_message helpers on the same page.
|
42
|
+
This led to some issues so I added the ability to set an id on show_message
|
43
|
+
|
44
|
+
```erb
|
45
|
+
<%= show_message(id: :create_object) %>
|
46
|
+
```
|
47
|
+
|
48
|
+
There is a slight twist to setting the flash now. I use an "_" to find what I call "scoped" messages.
|
49
|
+
|
50
|
+
```ruby
|
51
|
+
class MyController
|
52
|
+
|
53
|
+
def test_function
|
54
|
+
flash[:error_create_object] = "Some Error Message"
|
55
|
+
end
|
56
|
+
|
57
|
+
end
|
58
|
+
```
|
59
|
+
|
40
60
|
## Contributing
|
41
61
|
|
62
|
+
If anyone has any suggestions on a better way to do the "scoped" messages or anything for that matter,
|
63
|
+
feel free to submit a pull request.
|
64
|
+
|
42
65
|
1. Fork it
|
43
66
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
44
67
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
data/lib/show_message/version.rb
CHANGED