flame flash
1.0.0
火焰閃爍。
# Gemfile
gem 'flame-flash'
# config.ru
require 'flame-flash' # or `Bundler.require`
# _controller.rb
include Flame :: Flash <!-- layout.html.erb -->
<%
%i[ error warning notice ] . each do | type |
flash [ type ] . each do | text |
%>
< p class =" flash <%= type %> " >
<%= text %>
</ p >
<%
end
end
%> class PostsController < Flame :: Controller
def update
flash [ :error ] = "You don't have permissions"
redirect :show
end
def delete
redirect :show , notice : 'Deleted'
end
def move
redirect :index , flash : { success : 'Moved' }
end
def create
flash . now [ :error ] = 'Not enought permissions'
view :new
end
enderrorwarningnotice查看回購後,運行bundle install以安裝依賴項。
然後,運行toys rspec運行測試。
要將此寶石安裝到本地機器上,請運行toys gem install 。
要發布新版本,請運行toys gem release %version% 。在這裡查看它的工作原理。
歡迎在GitHub上進行錯誤報告和拉動請求。
根據MIT許可證的條款,該寶石可作為開源。