<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
  <channel>
    <title>paul1113 (刘超)</title>
    <link>https://ruby-china.org/paul1113</link>
    <description/>
    <language>en-us</language>
    <item>
      <title>Spree 项目中邮件不能发送的问题</title>
      <description>&lt;p&gt;测试邮件错误：530 5.7.0 Must issue a STARTTLS command first. e108sm52535614qge.15 - gsmtp 
配置信息写在 config/environments/development.rb
config.action_mailer.delivery_method = :sendmail
 config.action_mailer.delivery_method = :smtp
 config.action_mailer.smtp_settings = {
     address:              'smtp.gmail.com',
     port:                 587,
     domain:               'gmail.com',
     user_name:            'xxx',
     password:             'xxx',
     authentication:       'plain',
     enable_starttls_auto: true  }
config.action_mailer.raise_delivery_errors = true
config.action_mailer.perform_deliveries = true
config.action_mailer.default_options = {from: 'donokamark@gmail.com'}
&lt;img src="https://l.ruby-china.com/photo/2015/af947944910746d60899499b036ce227.png" title="" alt=""&gt;
这个错误今天 google 很久还是没解决所以来这里请教大家，打扰了！&lt;/p&gt;</description>
      <author>paul1113</author>
      <pubDate>Tue, 06 Jan 2015 14:11:22 +0800</pubDate>
      <link>https://ruby-china.org/topics/23572</link>
      <guid>https://ruby-china.org/topics/23572</guid>
    </item>
    <item>
      <title>《rails 指南》谁买过</title>
      <description>&lt;p&gt;买过《rails 指南》的说说看法，这本书里用的 rails 和 ruby 版本是最新的吗？另外翻译的是整套 rails guides 吗？完整吗？
在线等。。。。。。。。。。。。。。&lt;/p&gt;</description>
      <author>paul1113</author>
      <pubDate>Thu, 10 Apr 2014 16:15:44 +0800</pubDate>
      <link>https://ruby-china.org/topics/18526</link>
      <guid>https://ruby-china.org/topics/18526</guid>
    </item>
    <item>
      <title>路由表的问题？</title>
      <description>&lt;p&gt;liuchao@liuchao:~/rails_projects/sample_app$ rails s
=&amp;gt; Booting WEBrick
=&amp;gt; Rails 4.1.0.beta1 application starting in development on &lt;a href="http://0.0.0.0:3000" rel="nofollow" target="_blank"&gt;http://0.0.0.0:3000&lt;/a&gt;
=&amp;gt; Run &lt;code&gt;rails server -h&lt;/code&gt; for more startup options
=&amp;gt; Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=&amp;gt; Ctrl-C to shutdown server
Exiting
/home/liuchao/.rvm/gems/ruby-2.1.0/gems/actionpack-4.1.0.beta1/lib/action_dispatch/routing/mapper.rb:238:in `default_controller_and_action': Missing :action key on routes definition, please check your routes. (ArgumentError)
以上是我启动服务器时候的报错，以下是我的 route.rb
SampleApp::Application.routes.draw do&lt;/p&gt;

&lt;p&gt;get "/users/new"
get "/no_test_framework" &lt;/p&gt;

&lt;p&gt;root to: 'static_pages#home'
match '/signup', to: 'users#new', via: 'get' 
match '/help', to: 'static_pages#help', via: 'get' 
match '/about', to: 'static_pages#about', via: 'get'
match '/contact', to: 'static_pages#contact', via: 'get'&lt;/p&gt;

&lt;p&gt;# The priority is based upon order of creation: first created -&amp;gt; highest priority.
  # See how all your routes lay out with "rake routes".&lt;/p&gt;

&lt;p&gt;# You can have the root of your site routed with "root"
  # root 'static_pages#home'&lt;/p&gt;

&lt;p&gt;# Example of regular route:
  #   get 'products/:id' =&amp;gt; 'catalog#view'&lt;/p&gt;

&lt;p&gt;# Example of named route that can be invoked with purchase_url(id: product.id)
  #   get 'products/:id/purchase' =&amp;gt; 'catalog#purchase', as: :purchase&lt;/p&gt;

&lt;p&gt;# Example resource route (maps HTTP verbs to controller actions automatically):
  #   resources :products&lt;/p&gt;

&lt;p&gt;# Example resource route with options:
  #   resources :products do
  #     member do
  #       get 'short'
  #       post 'toggle'
  #     end
  #
  #     collection do
  #       get 'sold'
  #     end
  #   end&lt;/p&gt;

&lt;p&gt;# Example resource route with sub-resources:
  #   resources :products do
  #     resources :comments, :sales
  #     resource :seller
  #   end&lt;/p&gt;

&lt;p&gt;# Example resource route with more complex sub-resources:
  #   resources :products do
  #     resources :comments
  #     resources :sales do
  #       get 'recent', on: :collection
  #     end
  #   end&lt;/p&gt;

&lt;p&gt;# Example resource route with concerns:
  #   concern :toggleable do
  #     post 'toggle'
  #   end
  #   resources :posts, concerns: :toggleable
  #   resources :photos, concerns: :toggleable&lt;/p&gt;

&lt;p&gt;# Example resource route within a namespace:
  #   namespace :admin do
  #     # Directs /admin/products/* to Admin::ProductsController
  #     # (app/controllers/admin/products_controller.rb)
  #     resources :products
  #   end
end&lt;/p&gt;</description>
      <author>paul1113</author>
      <pubDate>Mon, 17 Mar 2014 13:10:53 +0800</pubDate>
      <link>https://ruby-china.org/topics/17935</link>
      <guid>https://ruby-china.org/topics/17935</guid>
    </item>
    <item>
      <title>编写 rails 模型文件的报错</title>
      <description>&lt;p&gt;书 ruby for rails（2007 年出版）
ruby script/generate model work
报错：
ruby: No such file or directory -- script/generate (LoadError)
把命令改为：rails generate model work
报错：~/ruby/R4Rmusic$ rails generate model work
/home/liuchao/.rvm/gems/ruby-2.1.0/gems/railties-4.1.0.beta1/lib/rails/application/configuration.rb:103:in `rescue in database_configuration': YAML syntax error occurred while parsing /home/liuchao/ruby/R4Rmusic/config/database.yml. Please note that YAML must be consistently indented using spaces. Tabs are not allowed. Error: (): could not find expected ':' while scanning a simple key at line 3 column 1 (RuntimeError)&lt;/p&gt;</description>
      <author>paul1113</author>
      <pubDate>Fri, 28 Feb 2014 12:23:12 +0800</pubDate>
      <link>https://ruby-china.org/topics/17563</link>
      <guid>https://ruby-china.org/topics/17563</guid>
    </item>
    <item>
      <title>有条件查询数据库代码错误</title>
      <description>&lt;p&gt;#encoding=UTF-8
require "mysql" 
dbh=Mysql.real_connect("localhost","root","root","rubytest",) 
class User 
def initialize(id,name,pwd) #构造方法 
&lt;a href="/id" class="user-mention" title="@id"&gt;&lt;i&gt;@&lt;/i&gt;id&lt;/a&gt;=id 
&lt;a href="/name" class="user-mention" title="@name"&gt;&lt;i&gt;@&lt;/i&gt;name&lt;/a&gt;=name 
&lt;a href="/pwd" class="user-mention" title="@pwd"&gt;&lt;i&gt;@&lt;/i&gt;pwd&lt;/a&gt;=pwd 
end 
attr_accessor :id,:name,:pwd 
#修饰可读、可写属性 
end 
class UserDao 
#登录操作 
def login(user,dbh) 
sql="select * from ruby where name ='#{user.name}' and pwd='#{user.id}'" 
res=dbh.query(sql) 
if res.num_rows==0 then 
puts "login fail" 
else 
puts "login success" 
end 
end 
#注册操作 
def register(user,dbh) 
sql="insert into ruby values('#{user.id}','#{user.name}','#{user.pwd}')"
dbh.query(sql) 
if dbh.affected_rows==i then 
puts "register success" 
else 
pus "register fail" 
end 
#按条件查询 
def findAll(dbh,name) 
sql="select * from ruby where name='#{name}'" 
res=dbh.query(sql) 
puts "ID\tNAME\tPWD" 
while item=res.fetch_row 
puts "#{item[0]}\t#{item[1]}\t#{item[2]}" 
end 
end 
end 
begin 
user=User.new(8,'bf001','001') 
#登录用 user=User.new(9,'zs','123') #创建 User 对象 
ud=UserDao.new #创建 UserDao 对象 
#ud.login(user,dbh) 登录操作 
#注册用 ud.register(user,dbh) 
ud.findALL(dbh,'bf001') #查询 
end 
end&lt;/p&gt;

&lt;p&gt;报错：test.rb:49:in &lt;code&gt;&amp;lt;class:UserDao&amp;gt;': undefined local variable or method&lt;/code&gt;dbh' for UserDao:Class (NameError)
    from test.rb:13:in `&lt;/p&gt;'&lt;p&gt;&lt;/p&gt;</description>
      <author>paul1113</author>
      <pubDate>Wed, 19 Feb 2014 15:01:22 +0800</pubDate>
      <link>https://ruby-china.org/topics/17357</link>
      <guid>https://ruby-china.org/topics/17357</guid>
    </item>
  </channel>
</rss>
