- 博客(6)
- 收藏
- 关注
原创 [网站建设]网页中插入音频
IE浏览器支持 embed,js中用name控制播放停止等 <embed name="music" src="C:\\Windows\\media\\Alarm01.wav" width="480" height="400" align="middle" autostart="true" hidden="true" loop="false&quo
2019-02-20 22:33:23 662
原创 [ruby on rails]用户注册登录
Helper定义方法 module SessionsHelper def log_in(user) session[:user_id]=user.id end def current_user @current_user ||= User.find_by(id: session[:user_id]) end def logged_...
2019-02-12 17:17:31 267
原创 [ruby on rails]使用cancancan
class Ability include CanCan::Ability def initialize(user) user ||= User.new can [:read, :home, :history, :show_cameras], :all if user.role == 'root' can :manage, :all elsif...
2019-02-12 17:10:02 336
原创 [网站建设]跳转到新页面后刷新一次
<script> if (location.href.indexOf("#reloaded") == -1) { location.href = location.href + "#reloaded"; location.reload(); } </script>
2019-02-12 17:07:28 1710
原创 [ruby on rails]flash结合bootstrap的使用
在view中使用,可以直接放在application.html.erb中 &lt;% flash.each do |message_type,message| %&gt; &lt;%= message %&gt; &lt;% end %&gt; 在controller中 flash[:danger]='xxxxxxx‘, flash[:success]=‘xxxxxxx’ ...
2019-02-03 22:08:41 310 1
原创 [ruby on rails]添加网站title
在application.html.erb中:&amp;lt;%= yield(:title) %&amp;gt; 在view中:&amp;lt;% provide (:title, ‘XXXXX’) %&amp;gt;
2019-02-03 21:59:23 812
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人