rails框架配置,Rails上手笔记

rails框架私下认可有四个形式development(开发),production(上线),test(测试)

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

有机会再试1试Rails了,只是原先接触的是2,现在注定成为了4,就像以往的设置比原来会快些。。

参照原著: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

本着于安装了揽胜VM

好歹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的有的本子反常,不可能得逞在rhel陆.四上得逞安装。由此,小编找到了三个较新的能够行使的本子柒.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

安装中华VVM能够用句

安装SportageVM能够用句

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安装的是rhel陆.4本子。确定保障在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

就如那正是眼下的风行版本

宛如这正是当下的新星版本

下载一键式安装包:

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

官方推荐用二.一.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)

复制代码 代码如下:

rails框架配置,Rails上手笔记。复制代码 代码如下:

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
  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
  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服务(19二.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

美高梅开户网址 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 ⑤.3 升级注意事项
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

美高梅开户网址 2

复制代码 代码如下:

复制代码 代码如下:

$rails server

$rails server

那样的话打开 就可以见到,Rails的欢迎界面Welcome
aboard,有点类似于Django-CMS的腾讯开创者马化腾~~

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

美高梅开户网址 3

美高梅开户网址 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二.04 Server 上安装配置 Ruby on Rails
    应用
  • Windows下Ruby on
    Rails开发条件设置配备图像和文字化教育程
  • CentOS七下搭建ruby on
    rails开发条件
  • Ruby on
    Rails下的图像处理入门教程
  • 多少个加速Ruby on
    Rails的编制程序技巧
  • Ruby on rails安装后去掉DL is deprecated,please use
    Fiddle警告音讯的措施【测试可用】

Rails 4 安装 针对于安装了OdysseyVM 复制代码…

发表评论

电子邮件地址不会被公开。 必填项已用*标注

网站地图xml地图