小编Rya*_*its的帖子

rails 4,link_to在jquery时不使用destroy动作,需要jquery_ujs

为什么在application.js文件中需要jquery后,destroy动作是不兼容的?如何在不忽视jquery的情况下让destroy操作再次工作?

发布索引视图:

h1 Blog
- @posts.each do |post|
 h2 = link_to post.title, post
 p = post.content
 p = link_to 'Edit', edit_post_path(post)
 p = link_to 'Delete', post, data: {confirm: "Are you sure?"}, method: :delete
 br

p = link_to 'Add a new post', new_post_path
Run Code Online (Sandbox Code Playgroud)

在帖子控制器中销毁动作:

def destroy
 @post = Post.find params[:id]
 @post.destroy

 redirect_to posts_path, :notice => "Your post has been deleted"
end
Run Code Online (Sandbox Code Playgroud)

application.js中:

= require jquery
= require jquery_ujs
//= require turbolinks
//= require_tree
Run Code Online (Sandbox Code Playgroud)

一旦我评论这两个,毁灭行动再次起作用.没有评论,删除链接只会触发节目动作...你的想法?

javascript ruby jquery ruby-on-rails ruby-on-rails-4

6
推荐指数
1
解决办法
4427
查看次数

使用 zsh 在终端中启动 sublime text 3

我最近购买了一台新的 MacBook,我正在尝试重新配置我的系统。

该应用程序位于 Applications 文件夹中,名为“Sublime Text.app”

我已经通过我在网上找到的其他建议将 sublime.plugin.zsh 文件编辑为“Sublime Text 3.app”以及“Sublime Text.app”,但在以下任一方面都没有运气:

elif  [[ $('uname') == 'Darwin' ]]; then
local _sublime_darwin_paths > /dev/null 2>&1
_sublime_darwin_paths=(
    "/usr/local/bin/subl"
    "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
    "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
    "/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
    "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
    "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
    "$HOME/Applications/Sublime Text 3.app/Contents/SharedSupport/bin/subl"
)

for _sublime_path in $_sublime_darwin_paths; do
    if [[ -a $_sublime_path ]]; then
        alias subl="'$_sublime_path'"
        alias st=subl
        break
    fi
done
fi

alias stt='st .'
Run Code Online (Sandbox Code Playgroud)

我仍然得到

zsh: command not found: st
Run Code Online (Sandbox Code Playgroud)

我只是不知道下一步要去哪里

command-line zsh sublimetext3 sublime-text-plugin

3
推荐指数
2
解决办法
7178
查看次数