ActionController::RoutingError (No route matches [GET] "/"):
贴出 config/routes.rb 文件看看
很赞同 +1
求解!!
访问速度很慢,楼主找一下原因吧
<%= link_to user_album_photos_path(current_user, album) do %>
<%= image_tag(album.photos.first.image_url(:littlephoto)) if album.photos.count > 0 %>
<% end %>
试试这样
#6 楼 @leonkaiyu 是呀,好恶心 #8 楼 @zgm
我也是新人,帮顶
哦,明白了,原来不是 HTML5 的东西呀,怪不得看着那么奇怪,现在明白了
很喜欢你的观点,也很喜欢小团队
#1 楼 @ywencn #6 楼 @woaigithub #9 楼 @cantin 问题解决了,虽然不知道问题出在哪里了 解决方法 开始时 likeable 字段是 string 后来换成了 text 代码也跟着改了
def likeable
@topic = Topic.last
@topicarr = @topic.likeable.to_s.split
@topic.likeable = @topic.likeable.to_s + request.remote_ip.to_s + ' '
if @topic.save
render :text => @topic.likeable.split.length
else
render :text => @topic.errors
end
end
#7 楼 @woaigithub
@topic.likeable << request.remote_ip.to_s + ' '
这一行代码 就是更新字段
1.9.3p125 :016 > t = Topic.last
Topic Load (6.5ms) SELECT `topics`.* FROM `topics` ORDER BY `topics`.`id` DESC LIMIT 1
=> #<Topic id: 1, body: "<span style=\"color:#333333;font-size:14px;backgroun...", likeable: "127.0.0.1 127.0.0.1 ", unlikeable: "", timeint: 201211237, created_at: "2012-11-23 05:02:23", updated_at: "2012-11-23 05:24:57">
1.9.3p125 :017 > t.likeable << "127.0.0.2" + " "
=> "127.0.0.1 127.0.0.1 127.0.0.2 "
1.9.3p125 :018 > t.likeable
=> "127.0.0.1 127.0.0.1 127.0.0.2 "
1.9.3p125 :019 > t.save
(0.2ms) BEGIN
(0.3ms) COMMIT
=> true
1.9.3p125 :020 > Topic.last.likeable
Topic Load (15.8ms) SELECT `topics`.* FROM `topics` ORDER BY `topics`.`id` DESC LIMIT 1
=> "127.0.0.1 127.0.0.1 "
1.9.3p125 :021 >
在 console 里面也是无法保存成功??
1.9.3p125 :016 > t = Topic.last
Topic Load (6.5ms) SELECT `topics`.* FROM `topics` ORDER BY `topics`.`id` DESC LIMIT 1
=> #<Topic id: 1, body: "<span style=\"color:#333333;font-size:14px;backgroun...", likeable: "127.0.0.1 127.0.0.1 ", unlikeable: "", timeint: 201211237, created_at: "2012-11-23 05:02:23", updated_at: "2012-11-23 05:24:57">
1.9.3p125 :017 > t.likeable << "127.0.0.2" + " "
=> "127.0.0.1 127.0.0.1 127.0.0.2 "
1.9.3p125 :018 > t.likeable
=> "127.0.0.1 127.0.0.1 127.0.0.2 "
1.9.3p125 :019 > t.save
(0.2ms) BEGIN
(0.3ms) COMMIT
=> true
1.9.3p125 :020 > Topic.last.likeable
Topic Load (15.8ms) SELECT `topics`.* FROM `topics` ORDER BY `topics`.`id` DESC LIMIT 1
=> "127.0.0.1 127.0.0.1 "
1.9.3p125 :021 >
在 console 里面也是无法保存成功??
#1 楼 @ywencn 数据库里没有插入这条记录 @topic.likeable 没有变化,看 log 信息好像也没有插入这条记录??
#1 楼 @ywencn 没有输出错误 数据库还是没插入成功 不过 log 有一条错误
Started GET "/topics/likeable" for 127.0.0.1 at 2012-11-23 14:07:52 +0800
Processing by TopicsController#likeable as HTML
Topic Load (3.2ms) SELECT `topics`.* FROM `topics` ORDER BY `topics`.`id` DESC LIMIT 1
(2.6ms) BEGIN
(1.4ms) COMMIT
Rendered text template (0.0ms)
Completed 200 OK in 11ms (Views: 0.7ms | ActiveRecord: 7.2ms)
[2012-11-23 14:07:52] WARN Could not determine content-length of response body. Set content-length of the response or set Response#chunked = true
RubyConfChina 福利好多呀
辛苦了,中文课程对新人友好一些,不过貌似大家不亢奋
#8 楼 @lgn21st #7 楼 @aabbcc456aa 我要平反,我是不想给组织者添麻烦才决定的。组织者那么不容易,不应该把精力浪费在这种杂事上。
#5 楼 @lgn21st #4 楼 @aabbcc456aa 好吧,那我就要了 我的邮箱 [email protected]