typedef void (*r_callback)();
void remote_c(r_callback pfoo)
{
pfoo();
remote(pfoo);
}
void call() {
printf("c call\n");
}
void main() {
remote_c(call);
}
- klass = 'c3'
- if condition1?
- klass = 'c1'
- elsif condition2?
- klass = 'c2'
%div{class: klass}
%div
Этот див вставлен в другой
kill -USR2 `cat tmp/pids/unicorn.pid`
namespace :unicorn do
pid_path = "#{release_path}/tmp/pids"
unicorn_pid = "#{pid_path}/unicorn.pid"
def run_unicorn
execute "#{fetch(:bundle_binstubs)}/unicorn", "-c #{release_path}/config/unicorn.rb -D -E #{fetch(:stage)}"
end
desc 'Start unicorn'
task :start do
on roles(:app) do
run_unicorn
end
end
desc 'Stop unicorn'
task :stop do
on roles(:app) do
if test "[ -f #{unicorn_pid} ]"
execute :kill, "-QUIT `cat #{unicorn_pid}`"
end
end
end
desc 'Force stop unicorn (kill -9)'
task :force_stop do
on roles(:app) do
if test "[ -f #{unicorn_pid} ]"
execute :kill, "-9 `cat #{unicorn_pid}`"
execute :rm, unicorn_pid
end
end
end
desc 'Restart unicorn'
task :restart do
on roles(:app) do
if test "[ -f #{unicorn_pid} ]"
execute :kill, "-USR2 `cat #{unicorn_pid}`"
else
run_unicorn
end
end
end
end
locale = params[:locale].to_sym
locale = nil unless I18n.available_locales.include?(locale)
cookies.permanent[:locale] = locale
current_user.update(language: locale )
class Ability
include CanCan::Ability
def initialize(user)
user ||= User.new
if user.admin?
can :manage, :all
elsif user.moderator?
can :manage, Post, Comment
elsif user.client?
can :create, Post
can [:update, :destroy], Comment, user_id: user.id
else
cannot :create, Post
can :read, :all
end
end
end