rails框架暗许有多少个格局development(开发),production(上线),test(测试)

有机会再试壹试Rails了,只是原先接触的是2,以后注定成为了肆,就如今后的装置比原先会快些。。

有空子再试一试Rails了,只是原先接触的是二,今后决定成为了肆,就像是今后的装置比原先会快些。。

参考原版的书文:http://www.linuxidc.com/Linux/2014-08/105137.htm

Development

 config.cache_classes =
false 每便请求都会再一次加载,修改代码之后能够一向利用。

 config.consider_all_requests_local =
true 在地点测试的时候能够来得全数的荒谬。

 config.action_controller.perform_caching =
false 

 config.action_mailer.raise_delivery_errors =
false 若是寄信退步,是不是要丢出区别。提出足以改成 true。

 config.active_support.deprecation =
:log 随着 Rails
版本的升级换代,假使有方法会在此后的版本中移除,deprecation
会提示您怎么着因应。那里的 :log 表示会记录到 log 档案中。

 

Rails 4 安装

Rails 4 安装

1 关于gitlab7

Production 模式

 config.cache_classes =
true 与花费条件分化,把数量保存在内存中,速度更加快

 config.action_controller.perform_caching =
true 不一致于 development,假使在 production
环境出现分化错误,不会呈现程式 call stack 信息,而是回传 public/500.html
页面。

 config.serve_static_assets =
false “X-Sendfile”
是网页服务器提供的意义,能够让下载档案的动作完全国委员会派给网页服务器,Rails
送出 X-Sendfile 标头后就毋需再佔住财富。

 config.force_ssl =
true 是不是限制全站必须SSL才能使用。 

 config.logger =
ActiveSupport::TaggedLogging.new(SyslogLogger.new) 能够转换掉
Rails 内建的 Logger,例如换来使用 syslog
的 SyslogLogger。

 config.cache_store =
:mem_cache_store 设定区别的快取储存库,暗中同意是
:memory_store,相当于每一种 Rails process
各自用内部存款和储蓄器存放。产业界最常用的则是 memcached 内存快取服务器

 config.action_controller.asset_host =
“” 暗许的静态档案地方是近年来主机的
public 目录,你能够由此修改 asset_host
变更地方。例如你的静态档案放在不相同台机器或 CDN(Content delivery network)
上。

 

本着于安装了哈弗VM

本着于安装了中华VVM

无论怎样gitlab是个好东西,可是极难安装和安插。bitnami(

Test 模式

 config.action_dispatch.show_exceptions =
false 不一致于 development 或 production
碰着例外会捕捉例外后,给浏览器显示出 call stack trace 或 public/500.html
画面,在 test 形式就不处理,让不相同直接报错。

 config.action_mailer.delivery_method =
:test 测试形式下不会真正去寄送email

 config.active_support.deprecation =
:stderr 让 deprecation 新闻会直接显示到视窗之中

 

复制代码 代码如下:

复制代码 代码如下:

率先,bitmami的某个本子有标题,无法成功在rhel6.4上得逞安装。由此,小编找到了一个较新的可以运用的版本七.8.壹(响应式页面):

gem install rails

gem install rails

ftp://pepstack.com/pub/tarball/bitnami-gitlab-7.8.1-0-linux-x64-installer.run

从不的话应当这么:

尚未的话应当那样:

(小编的ftp不会平昔提供,请想要的赶紧下载)

复制代码 代码如下:

复制代码 代码如下:

那么,最终安装好的成效正是(点击可访问,第一回访问大概会比较慢,需要较新本子的firefox或chrome,IE未测试):

sudo gem install rails

sudo gem install rails

设置KoleosVM能够用句

设置景逸SUVVM能够用句

2 须求描述

复制代码 代码如下:

复制代码 代码如下:

好了,先把须要陈述一下,若是读者的需求与本身不一样,笔者不能。假诺小编有壹台web主机(小编那边是pepstack.com),作者在主机后边创立虚拟机(vm-gitlab),在vm-gitlab上设置gitlab七,然后经过配备web主机上的ngnix,能够通过下边包车型的士url访问到笔者的gitlab:

curl -L | bash -s stable

curl -L | bash -s stable

**查看rails版本

**查看rails版本

创设虚拟机vm-gitlab的进程不细说了,假设你接纳实体机也是均等的。vm-gitlab安装的是rhel6.肆版本。确定保证在vm内部可以访问外部主机和internet(如ping
www.baidu.com)。

**

**

3 安装gitlab

复制代码 代码如下:

复制代码 代码如下:

ssh 到vm-gitlab:

rails -v
Rails 4.0.3

rails -v
Rails 4.0.3

# ssh root@vm-gitlab

犹如那正是眼下的最新版本

就好像那正是眼前的新型版本

下载1键式安装包:

Ruby版本

Ruby版本

# wget
ftp://pepstack.com/pub/tarball/bitnami-gitlab-7.8.1-0-linux-x64-installer.run

复制代码 代码如下:

复制代码 代码如下:

安装:

We recommend Ruby 2.1.0 for use with Rails. We stopped supporting Ruby
1.8.x after Rails 3.2. Ruby 1.9.2+ will be supported until Rails 5.

We recommend Ruby 2.1.0 for use with Rails. We stopped supporting Ruby
1.8.x after Rails 3.2. Ruby 1.9.2+ will be supported until Rails 5.

# chmod a+x bitnami-gitlab-7.8.1-0-linux-x64-installer.run

法定推荐用2.1.0. 相当于最新版本

法定推荐用2.壹.0. 也正是流行版本

# ./bitnami-gitlab-7.8.1-0-linux-x64-installer.run

安装SQLite

安装SQLite

设置进程中会提醒:

就好像那就是诸如Django、Rails那类对于轻量级网址的数据库供给。

犹如那就是比如说Django、Rails那类对于轻量级网址的数据库要求。


如果是mac os

如果是mac os

Welcome to the Bitnami Gitlab Stack Setup Wizard.

复制代码 代码如下:

复制代码 代码如下:


brew install sqlite3

brew install sqlite3

Select the components you want to install; clear the components you do
not want
to install. Click Next when you are ready to continue.

其余可以看事态设置,如openSUSE

别的可以看意况设置,如openSUSE

GitLab : Y (Cannot be edited)

复制代码 代码如下:

复制代码 代码如下:

GitLab CI [Y/n] :Y

sudo zypper install sqlite3

sudo zypper install sqlite3

Is the selection above correct? [Y/n]: Y

Rails 4 Hello,World

Rails 4 Hello,World


能够直接用rails生成

能够一贯用rails生成

Installation folder

复制代码 代码如下:

复制代码 代码如下:

Please, choose a folder to install Bitnami Gitlab Stack

$rails new hello

$rails new hello

Select a folder [/opt/gitlab-7.8.1-0]:

于是就有了

于是就有了


复制代码 代码如下:

复制代码 代码如下:

Create Admin account

  create
  create  README.rdoc
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  create  app/assets/javascripts/application.js
  create  app/assets/stylesheets/application.css
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  app/views/layouts/application.html.erb
  create  app/assets/images/.keep
  create  app/mailers/.keep
  create  app/models/.keep
  create  app/controllers/concerns/.keep
  create  app/models/concerns/.keep
  create  bin
  create  bin/bundle
  create  bin/rails
  create  bin/rake
  create  config
  create  config/routes.rb
  create  config/application.rb
  create  config/environment.rb
  create  config/environments
  create  config/environments/development.rb
  create  config/environments/production.rb
  create  config/environments/test.rb
  create  config/initializers
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/filter_parameter_logging.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/secret_token.rb
  create  config/initializers/session_store.rb
  create  config/initializers/wrap_parameters.rb
  create  config/locales
  create  config/locales/en.yml
  create  config/boot.rb
  create  config/database.yml
  create  db
  create  db/seeds.rb
  create  lib
  create  lib/tasks
  create  lib/tasks/.keep
  create  lib/assets
  create  lib/assets/.keep
【金沙注册送58】安装使用全经过,rails框架配置。  create  log
  create  log/.keep
  create  public
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/favicon.ico
  create  public/robots.txt
  create  test/fixtures
  create  test/fixtures/.keep
  create  test/controllers
  create  test/controllers/.keep
  create  test/mailers
  create  test/mailers/.keep
  create  test/models
  create  test/models/.keep
  create  test/helpers
  create  test/helpers/.keep
  create  test/integration
  create  test/integration/.keep
  create  test/test_helper.rb
  create  tmp/cache
  create  tmp/cache/assets
  create  vendor/assets/javascripts
  create  vendor/assets/javascripts/.keep
  create  vendor/assets/stylesheets
  create  vendor/assets/stylesheets/.keep
run  bundle install

  create
  create  README.rdoc
  create  Rakefile
  create  config.ru
  create  .gitignore
  create  Gemfile
  create  app
  create  app/assets/javascripts/application.js
  create  app/assets/stylesheets/application.css
  create  app/controllers/application_controller.rb
  create  app/helpers/application_helper.rb
  create  app/views/layouts/application.html.erb
  create  app/assets/images/.keep
  create  app/mailers/.keep
  create  app/models/.keep
  create  app/controllers/concerns/.keep
  create  app/models/concerns/.keep
  create  bin
  create  bin/bundle
  create  bin/rails
  create  bin/rake
  create  config
  create  config/routes.rb
  create  config/application.rb
  create  config/environment.rb
  create  config/environments
  create  config/environments/development.rb
  create  config/environments/production.rb
  create  config/environments/test.rb
  create  config/initializers
  create  config/initializers/backtrace_silencers.rb
  create  config/initializers/filter_parameter_logging.rb
  create  config/initializers/inflections.rb
  create  config/initializers/mime_types.rb
  create  config/initializers/secret_token.rb
  create  config/initializers/session_store.rb
  create  config/initializers/wrap_parameters.rb
  create  config/locales
  create  config/locales/en.yml
  create  config/boot.rb
  create  config/database.yml
  create  db
  create  db/seeds.rb
  create  lib
  create  lib/tasks
  create  lib/tasks/.keep
  create  lib/assets
  create  lib/assets/.keep
金沙注册送58,  create  log
  create  log/.keep
  create  public
  create  public/404.html
  create  public/422.html
  create  public/500.html
  create  public/favicon.ico
  create  public/robots.txt
  create  test/fixtures
  create  test/fixtures/.keep
  create  test/controllers
  create  test/controllers/.keep
  create  test/mailers
  create  test/mailers/.keep
  create  test/models
  create  test/models/.keep
  create  test/helpers
  create  test/helpers/.keep
  create  test/integration
  create  test/integration/.keep
  create  test/test_helper.rb
  create  tmp/cache
  create  tmp/cache/assets
  create  vendor/assets/javascripts
  create  vendor/assets/javascripts/.keep
  create  vendor/assets/stylesheets
  create  vendor/assets/stylesheets/.keep
run  bundle install

Bitnami Gitlab Stack admin user creation

进而会设置包依赖

随之会设置包注重

Email Address [user@example.com]: cheungmine@qq.com

复制代码 代码如下:

复制代码 代码如下:

Login [user]: master (此处是你登录gitlab用的用户名)

  Fetching gem metadata from ……….
  Fetching additional metadata from ..
  Resolving dependencies…
  Using rake (10.3.1)
  Using i18n (0.6.9)
  Using minitest (4.7.5)
  Using multi_json (1.9.2)
  Using thread_safe (0.3.3)
  Using tzinfo (0.3.39)
  Using activesupport (4.0.3)
  Using builder (3.1.4)
  Using erubis (2.7.0)
  Using rack (1.5.2)
  Using rack-test (0.6.2)
  Using actionpack (4.0.3)
  Using mime-types (1.25.1)
  Using polyglot (0.3.4)
  Using treetop (1.4.15)
  Using mail (2.5.4)
  Using actionmailer (4.0.3)
  Using activemodel (4.0.3)
  Using activerecord-deprecated_finders (1.0.3)
  Using arel (4.0.2)
  Using activerecord (4.0.3)
  Using bundler (1.5.3)
  Using coffee-script-source (1.7.0)
  Using execjs (2.0.2)
  Using coffee-script (2.2.0)
  Using thor (0.19.1)
  Using railties (4.0.3)
  Using coffee-rails (4.0.1)
  Using hike (1.2.3)
  Using jbuilder (1.5.3)
  Using jquery-rails (3.1.0)
  Using json (1.8.1)
  Using tilt (1.4.1)
  Using sprockets (2.11.0)
  Using sprockets-rails (2.0.1)
  Using rails (4.0.3)
  Using rdoc (4.1.1)
  Using sass (3.2.19)
  Using sass-rails (4.0.3)
  Using sdoc (0.4.0)
  Using sqlite3 (1.3.9)
  Using turbolinks (2.2.2)
  Using uglifier (2.5.0)
  Your bundle is complete!
  Use `bundle show [gemname]` to see where a bundled gem is
installed.

  Fetching gem metadata from ……….
  Fetching additional metadata from ..
  Resolving dependencies…
  Using rake (10.3.1)
  Using i18n (0.6.9)
  Using minitest (4.7.5)
  Using multi_json (1.9.2)
  Using thread_safe (0.3.3)
  Using tzinfo (0.3.39)
  Using activesupport (4.0.3)
  Using builder (3.1.4)
  Using erubis (2.7.0)
  Using rack (1.5.2)
  Using rack-test (0.6.2)
  Using actionpack (4.0.3)
  Using mime-types (1.25.1)
  Using polyglot (0.3.4)
  Using treetop (1.4.15)
  Using mail (2.5.4)
  Using actionmailer (4.0.3)
  Using activemodel (4.0.3)
  Using activerecord-deprecated_finders (1.0.3)
  Using arel (4.0.2)
  Using activerecord (4.0.3)
  Using bundler (1.5.3)
  Using coffee-script-source (1.7.0)
  Using execjs (2.0.2)
  Using coffee-script (2.2.0)
  Using thor (0.19.1)
  Using railties (4.0.3)
  Using coffee-rails (4.0.1)
  Using hike (1.2.3)
  Using jbuilder (1.5.3)
  Using jquery-rails (3.1.0)
  Using json (1.8.1)
  Using tilt (1.4.1)
  Using sprockets (2.11.0)
  Using sprockets-rails (2.0.1)
  Using rails (4.0.3)
  Using rdoc (4.1.1)
  Using sass (3.2.19)
  Using sass-rails (4.0.3)
  Using sdoc (0.4.0)
  Using sqlite3 (1.3.9)
  Using turbolinks (2.2.2)
  Using uglifier (2.5.0)
  Your bundle is complete!
  Use `bundle show [gemname]` to see where a bundled gem is
installed.

Password : (输入你登录gitlab时要用的密码)

运行Rails

运行Rails

Please confirm your password :  (输入你登录gitlab时要用的密码)

Hostname that will be used to create internal URLs. If this value is
incorrect,
you may be unable to access your Gitlab installation from other
computers. It is
advisable to use a Domain instead of an IP address for compatibility
with
different browsers.

Domain [127.0.0.1]:

Do you want to configure mail support? [y/N]: Y


Configure SMTP Settings

This is required so your application can send notifications via email.

Default email provider:

[1] GMail
[2] Custom
Please choose an option [1] : 2


Configure SMTP Settings

This data is stored in the application configuration files and may be
visible to
others. For this reason, it is recommended that you do not use your
personal
account credentials.

Username []: cheungmine@qq.com

Password : (输入你的QQ密码)
Re-enter : (输入你的QQ密码)
SMTP Host []: smtp.qq.com

SMTP Port []: 25

Secure connection

[1] None
[2] SSL
[3] TLS
Please choose an option [3] :


Setup is now ready to begin installing Bitnami Gitlab Stack on your
computer.

Do you want to continue? [Y/n]: Y


Please wait while Setup installs Bitnami Gitlab Stack on your computer.

 Installing
 0% ______________ 50% ______________ 100%
 #########################################


Setup has finished installing Bitnami Gitlab Stack on your computer.

Info: To access the Bitnami Gitlab Stack, go to
from your browser.
Press [Enter] to continue:

4 配置gitlab
配备进一步要小心。下边多少个布局文件要用到:

/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/environments/production.rb
/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/initializers/smtp_settings.rb
/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/config/gitlab.yml
/opt/gitlab-7.8.1-0/apps/gitlab/conf/httpd-app.conf
/opt/gitlab-7.8.1-0/apps/gitlab/gitlab-shell/config.yml

上面逐一表达:

4.1 production.rb

……
  # config.action_mailer.delivery_method = :sendmail
  # Defaults to:
  # # config.action_mailer.sendmail_settings = {
  # #  location: ‘/usr/sbin/sendmail’,
  # #  arguments: ‘-i -t’
  # # }
  config.action_mailer.perform_deliveries = true
  config.action_mailer.raise_delivery_errors = true
  config.action_mailer.delivery_method = :smtp
  config.action_mailer.smtp_settings = {
    :address => “smtp.qq.com”,
    :port => “25”,
    :domain => “qq.com”,
    :authentication => :plain,
    :user_name => “cheungmine@qq.com”,
    :password => “********”,
    :enable_starttls_auto => true
  }

  config.eager_load = true
  config.assets.js_compressor = :uglifier

  config.allow_concurrency = false
……

4.2 smtp_settings.rb
# cp smtp_settings.rb.sample smtp_settings.rb

# To enable smtp email delivery for your GitLab instance do the
following:
# 1. Rename smtp_settings.rb.sample to smtp_settings.rb
# 2. Edit settings inside this file
# 3. Restart GitLab instance
#
if Rails.env.production?
  Gitlab::Application.config.action_mailer.delivery_method = :smtp

  ActionMailer::Base.smtp_settings = {
    address: “smtp.qq.com”,
    port: 25,
    user_name: “cheungmine@qq.com”,
    password: “********”,
    domain: “qq.com”,
    authentication: :login,
    enable_starttls_auto: true,
    openssl_verify_mode: ‘none’
  }
end

4.3 gitlab.yml

# # # # # # # # # # # # # # # # # #
# GitLab application config file  #
# # # # # # # # # # # # # # # # # #
#
# How to use:
# 1. Copy file as gitlab.yml
# 2. Update gitlab -> host with your fully qualified domain name
# 3. Update gitlab -> email_from
# 4. If you installed Git from source, change git -> bin_path to
/usr/local/bin/git
# 5. Review this configuration file for other settings you may want to
adjust

production: &base
  #
  # 1. GitLab app settings
  # ==========================

  ## GitLab settings
  gitlab:
    ## Web server settings (note: host is the FQDN, do not include
http://)
    host: pepstack.com
    port: 80                # Set to 443 if using HTTPS, see
installation.md#using-https for additional HTTPS configuration
details
    https: false            # Set to true if using HTTPS, see
installation.md#using-https for additional HTTPS configuration details

    # Uncommment this line below if your ssh host is different from
HTTP/HTTPS one
    # (you’d obviously need to replace ssh.host_example.com with your
own host).
    # Otherwise, ssh host will be set to the `host:` value above
    # ssh_host: ssh.host_example.com

    # WARNING: See config/application.rb under “Relative url support”
for the list of
    # other files that need to be changed for relative url support
    relative_url_root: /gitlab

    # Uncomment and customize if you can’t use the default user to run
GitLab (default: ‘git’)
    # user: git

    ## Date & Time settings
    # Uncomment and customize if you want to change the default time
zone of GitLab application.
    # To see all available zones, run `bundle exec rake time:zones:all
RAILS_ENV=production`
    # time_zone: ‘UTC’

    ## Email settings
    # Uncomment and set to false if you need to disable email sending
from GitLab (default: true)
    # email_enabled: true
    # Email address used in the “From” field in mails sent by GitLab
    email_from: cheungmine@qq.com
    support_email: cheungmine@qq.com

    # Email server smtp settings are in
config/initializers/smtp_settings.rb.sample

    # default_can_create_group: false  # default: true
    # username_changing_enabled: false # default: true – User can
change her username/namespace
    ## Default theme
    ##  BASIC  = 1
    ##  MARS  = 2
    ##  MODERN = 3
    ##  GRAY  = 4
    ##  COLOR  = 5
    # default_theme: 2 # default: 2
……

地点文件改动之处在于:

host: pepstack.com
relative_url_root: /gitlab
email_from: cheungmine@qq.com
support_email: cheungmine@qq.com

上边包车型大巴布置是因为要把gitlab置于nginx前边使用:

4.4 httpd-app.conf

<Directory “/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/public”>
    Options -MultiViews
    AllowOverride All
    <IfVersion < 2.3 >
        Order allow,deny
        Allow from all
    </IfVersion>
    <IfVersion >= 2.3>
        Require all granted
    </IfVersion>

    SetEnv RAILS_RELATIVE_URL_ROOT “/gitlab”

    PassengerEnabled on
    PassengerAppRoot “/opt/gitlab-7.8.1-0/apps/gitlab/htdocs/”
    <IfModule pagespeed_module>
        ModPagespeedDisallow “*”
    </IfModule>
    PassengerUser git
    PassengerGroup git
    SetEnv MAGIC
“/opt/gitlab-7.8.1-0/ruby/lib/ruby/gems/2.0.0/gems/charlock_holmes-0.6.9.4/ext/charlock_holmes/src/file-5.08/magic/magic.mgc”
    SetEnv PATH “/opt/gitlab-7.8.1-0/python/bin:${PATH}”

</Directory>
PassengerPreStart

区别之处在于:

SetEnv RAILS_RELATIVE_URL_ROOT “/gitlab”
PassengerPreStart

4.5 config.yml


gitlab_url:

如此那般大家访问gitlab正是遵守上边包车型客车地址:

5 主机nginx配置

地方的布置都以在vm-gitlab上拓展的,注意打开80:http端口。下边要给主机nginx增添陈设,配置文件:

/etc/nginx/conf.d/redmine.conf

内容如下(作者还要还提供了redmine服务):

# 指向内网redmine的web服务(1玖贰.16八.12贰.贰一:80)
#
upstream redmine {
    server 192.168.122.21:80;
}

upstream gitlab {
    server 192.168.122.20:80;
}

server {
    server_name pepstack.com;

    # /var/log/nginx 本地目录必须存在
    access_log  /var/log/nginx/redmine_access.log;
    error_log  /var/log/nginx/redmine_error.log;

    location /redmine {
        try_files $uri @red;      # @red 名字是私下的
    }

    location /gitlab {
        try_files $uri @git;
    }

    location @red {
        proxy_set_header  Host            $host;
        proxy_set_header  X-Real_IP        $remote_addr;
        proxy_set_header  X-Forwarded-For 
$proxy_add_x_forwarded_for;

        proxy_read_timeout    300;
        proxy_connect_timeout  300;
        proxy_redirect        off;

        proxy_pass ;  # 指向 upstream redmine
    }

    location @git {
        proxy_set_header  Host            $host;
        proxy_set_header  X-Real_IP        $remote_addr;
        proxy_set_header  X-Forwarded-For 
$proxy_add_x_forwarded_for;

        proxy_read_timeout    300;
        proxy_connect_timeout  300;
        proxy_redirect        off;

        proxy_pass ;  # 指向 upstream gitlab
    }
}

即注释掉:include /etc/nginx/sites-enabled/*;

6 运行服务

劳苦功高告成,在主机运行nginx:

$ sudo nginx -s reload

在vm-gitlab启动gitlab:

# cd /opt/gitlab-7.8.1-0/

# ./ctlscript.sh restart

金沙注册送58 1

CentOS源码安装GitLab汉化版 
http://www.linuxidc.com/Linux/2015-10/124648.htm

在 Ubuntu 12.04 上安装
GitLab
http://www.linuxidc.com/Linux/2012-12/75249.htm

GitLab 伍.三 升级注意事项
http://www.linuxidc.com/Linux/2013-06/86473.htm

在 CentOS 上配置 GitLab (自托管的Git项目仓库)
http://www.linuxidc.com/Linux/2013-06/85754.htm

在RHEL6/CentOS6/ScientificLinux6上安装GitLab 6.0.2
http://www.linuxidc.com/Linux/2014-03/97831.htm

CentOS 陆.5安装GitLab教程及有关难题消除
http://www.linuxidc.com/Linux/2014-05/101526.htm

GitLab
的详尽介绍
:请点那里
GitLab
的下载地址
:请点那里

正文永久更新链接地址:http://www.linuxidc.com/Linux/2015-11/124919.htm

金沙注册送58 2

复制代码 代码如下:

复制代码 代码如下:

$rails server

$rails server

那样的话打开 就能够看出,Rails的欢迎界面Welcome
aboard,有点类似于Django-CMS的腾讯开创者马化腾~~

那样的话打开 就足以观察,Rails的欢迎界面Welcome
aboard,有点类似于Django-CMS的中国首富马化腾~~

金沙注册送58 3

金沙注册送58 4

创建controller

创建controller

如官方指南所说

如官方指南所说

执行命令:

执行命令:

复制代码 代码如下:

复制代码 代码如下:

$rails generate controller welcome index

$rails generate controller welcome index

就会成立下边那个文件:

就会创立上边那几个文件:

复制代码 代码如下:

复制代码 代码如下:

  create  app/controllers/welcome_controller.rb
   route  get “welcome/index”
  invoke  erb
  create    app/views/welcome
  create    app/views/welcome/index.html.erb
  invoke  test_unit
  create    test/controllers/welcome_controller_test.rb
  invoke  helper
  create    app/helpers/welcome_helper.rb
  invoke    test_unit
  create      test/helpers/welcome_helper_test.rb
  invoke  assets
  invoke    coffee
  create      app/assets/javascripts/welcome.js.coffee
  invoke    scss
  create      app/assets/stylesheets/welcome.css.scss

  create  app/controllers/welcome_controller.rb
   route  get “welcome/index”
  invoke  erb
  create    app/views/welcome
  create    app/views/welcome/index.html.erb
  invoke  test_unit
  create    test/controllers/welcome_controller_test.rb
  invoke  helper
  create    app/helpers/welcome_helper.rb
  invoke    test_unit
  create      test/helpers/welcome_helper_test.rb
  invoke  assets
  invoke    coffee
  create      app/assets/javascripts/welcome.js.coffee
  invoke    scss
  create      app/assets/stylesheets/welcome.css.scss

在config/routes.rb添加暗中同意页面

在config/routes.rb添加暗中认可页面

复制代码 代码如下:

复制代码 代码如下:

root ‘welcome#index’

root ‘welcome#index’

再运行

再运行

复制代码 代码如下:

复制代码 代码如下:

rails server

rails server

就会冒出

就会并发

复制代码 代码如下:

复制代码 代码如下:

Welcome#index

Welcome#index

Find me in app/views/welcome/index.html.erb

Find me in app/views/welcome/index.html.erb

一体来得急速,很突然。

万事来得火速,很突然。

你或然感兴趣的篇章:

  • 敏捷安装Ruby on
    Rails的鲜明指南
  • win柒安装ruby on
    rails开发条件
  • 在 Ubuntu 1二.0肆 Server 上设置配备 Ruby on Rails
    应用
  • Windows下Ruby on
    Rails开发条件设置配备图文化教育程
  • CentOS7下搭建ruby on
    rails开发环境
  • Ruby on
    Rails下的图像处理入门教程
  • 多少个加速Ruby on
    Rails的编制程序技巧
  • Ruby on rails安装后去掉DL is deprecated,please use
    Fiddle警告音讯的办法【测试可用】

Rails 四 安装 针对于安装了卡宴VM 复制代码…

相关文章

网站地图xml地图