Nginx在Mavericks上工作正常,现在我升级到Yosemite后显示 nginx命令未找到,我尝试用brew install nginx安装nginx并显示错误
Error: You must brew link pcre before nginx can be installed
并brew link pcre
显示
Linking /usr/local/Cellar/pcre/8.35... Error: No such file or directory - /usr/local/Cellar/pcre/8.34/share/doc/pcre
Run Code Online (Sandbox Code Playgroud)
它试图链接8.34.我重新安装仍然是相同的,我如何解决它?
我是angularjs的新手,我在访问控制器中的指令属性时遇到困难.
指示
<rating max-stars="5" url="url.json"></rating>
app.directive('rating', [function () {
return {
restrict: 'E',
scope: {
maxStars: '=',
url: '@'
},
link: function (scope, iElement, iAttrs) {
console.log(iAttrs.url); //works
}
Run Code Online (Sandbox Code Playgroud)
调节器
app.controller('ratingController', ['$scope', '$attrs' , '$http','$routeParams',function ($scope,$attrs,$http,$routeParams) {
console.log($attrs.url); //shows undefined
}]);
Run Code Online (Sandbox Code Playgroud)
如何访问控制器中的url属性?
我正在尝试部署rails应用程序,但它坚持错误
DEBUG[1a70ba92] Command: cd /home/deploy/myapp/releases/20140615090226 && ( PATH=$HOME/.rbenv /shims:$HOME/.rbenv/bin:$PATH RBENV_ROOT=~/.rbenv RBENV_VERSION=2.1.2 ~/.rbenv/bin/rbenv exec bundle install --binstubs /home/deploy/myapp/shared/bin --path /home/deploy/myapp/shared/bundle --without development test --deployment --quiet )
DEBUG[1a70ba92] rbenv: bundle: command not found
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing on host xxx.xxx.xxx.xx: bundle exit status: 127
bundle stdout: Nothing written
bundle stderr: rbenv: bundle: command not found
Run Code Online (Sandbox Code Playgroud)
deploy.rb
# config valid only for Capistrano 3.1
lock '3.1.0'
set :application, 'myapp'
set :repo_url, 'git@bitbucket.org:username/myapp.git'
# Default branch is :master
# ask :branch, proc …
Run Code Online (Sandbox Code Playgroud) 我正在尝试拆分使用文本字段输入的日期。我想要它在一个数组中。
在 html 文件中
<%= text_field_tag :checkoutdate, params[:checkoutdate],:placeholder => 'Select Date', :class=>'form-control datepicker input-lg',:required=>true,"ng-model" => "checkoutdate"%>
<p class='bg-danger' ng-show="isInvalidDate()">Check-out date cannot be lesser than check-in date</p>
Run Code Online (Sandbox Code Playgroud)
在控制器 js 文件中
App.controller('validationController',['$scope', function($scope){
$scope.isInvalidDate = function(){
var checkin = $scope.checkindate.split('-');
var checkout = $scope.checkoutdate.split('-');
if($scope.checkin[0]>$scope.checkout[0] || $scope.checkin[1]>$scope.checkout[1]){
return true;
}
}
Run Code Online (Sandbox Code Playgroud)
我在控制台中收到错误
Cannot read property 'split' of undefined
我究竟做错了什么?
这是我第一个部署到heroku以外的服务器的rails应用程序.我已成功将我的rails应用程序部署到digitalocean.当我在浏览器中键入ipaddress时,会显示主页.但当我尝试重定向到其他控制器,如xxx.xxx.xxx.xx/users/sign_in
它显示404 Not Found
.此外,没有任何图像出现.
在/ etc/nginx的/启用的站点 - /默认
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
server_name mydomain.com;
passenger_enabled on;
rails_env production;
root /home/deploy/myapp/current/public;
# redirect server error pages to the static page /50x.html
error_page 500 502 503 504 /50x.html;
location = / {
passenger_enabled on; <-added this line for home page to show up
}
location = /users/sign_in {
passenger_enabled on; <-added this line for sign_in view to show up
}
}
Run Code Online (Sandbox Code Playgroud)
我不知道我错过了什么.我是否必须添加passenger_enabled on; …
我正在尝试使用 :method => :delete 删除记录,但它改为调用 GET 。它重定向到 show 并显示 404 not found。但如果我返回并刷新,该记录实际上被删除了。
<% @photos.each do |photo| %>
<div class='photogallery'>
<%= link_to image_tag(photo.image_url(:thumb)) if photo.image? %>
<div class="name"><%= photo.caption %></div>
<div class="actions">
<%= link_to "edit", edit_admins_photogallery_path(photo) %> |
<%= link_to "remove",admins_photogallery_path(photo), :method => 'delete',:confirm => 'Are you sure?' %> |
</div>
</div>
<% end %>
Run Code Online (Sandbox Code Playgroud)
应用程序.js
//= require jquery
//= require jquery_ujs
//= require jquery-fileupload/basic
//= require jquery-fileupload/vendor/tmpl
//= require dataTables/jquery.dataTables
//= require bootstrap
//= require bootstrap-select
//= require jquery.timepicker
//= …
Run Code Online (Sandbox Code Playgroud) 我在尝试将 Rails 应用程序部署到生产环境时看到此错误
SSHKit::Runner::ExecuteError: Exception while executing on host xxx.xxx.xxx.xx: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
NoMethodError: undefined method `fetch' for "QLite version 3.x":String
Run Code Online (Sandbox Code Playgroud)
这个错误是由 th 命令调用的
Command: cd /home/deploy/myapp/releases/20140616034148 && ( RAILS_ENV=production ~/.rvm/bin/rvm default do bundle exec rake assets:precompile )
Run Code Online (Sandbox Code Playgroud)
文件
# Load DSL and Setup Up Stages
require 'capistrano/setup'
# Includes default deployment tasks
require 'capistrano/deploy'
require 'capistrano/bundler'
require 'capistrano/rails'
require 'capistrano/rvm'
set :rvm_ruby_version, '2.1.2'
require 'capistrano/rails/assets'
require 'capistrano/rails/migrations'
Run Code Online (Sandbox Code Playgroud)
部署文件
lock '3.1.0' …
Run Code Online (Sandbox Code Playgroud) 我有一个前端和管理部分。有3个角色super_admin,admin,user。使用super_admin或admin登录时,我应该能够访问/ admin /名称空间,该名称空间正在运行。但是,当我以用户身份登录时,我应该无法访问/ admin /名称空间,它应该重定向404页或索引页。我正在使用cancan限制对控制器的访问。
namespace :admin do
// admin routes
end
//Devise for user model
devise_for :users
//Role model
class Role < ActiveRecord::Base
has_many :users
end
//User model
class User < ActiveRecord::Base
belongs_to :role
end
//Role table columns
id name
1 super_admin
2 admin
3 user
Run Code Online (Sandbox Code Playgroud)
当我以用户角色登录并转到/ admin /路径时,它将重定向到admin部分。如何仅在用户角色的路由中限制它?
nginx ×4
ruby ×3
angularjs ×2
capistrano ×2
javascript ×2
homebrew ×1
macos ×1
osx-yosemite ×1
passenger ×1