我试图从postgres数据库中提取行,我可以将它们拉出来但是当我尝试随机时,我会在随机附近得到一个语法错误.
错误
PG::Error: ERROR: syntax error at or near "rand"
LINE 1: ... "hashtags".* FROM "hashtags" ORDER BY tweet_id rand LIMIT...
^
: SELECT "hashtags".* FROM "hashtags" ORDER BY tweet_id rand LIMIT 4
Run Code Online (Sandbox Code Playgroud)
把它拉出来的代码
<div id="hashtags">
<% Hashtag.order("tweet_id desc").limit(4).each do |hashtag| %>
<blockquote><%= hashtag.content %></blockquote>
<div class="from">— @<%= hashtag.screen_name %></div>
<% end %>
</div>
Run Code Online (Sandbox Code Playgroud) 所以我在删除使用New-Item创建的SymbolicLinks时遇到问题
New-Item -ItemType SymbolicLink -Path C:\SPI -Target "C:\Users\Chino\Dropbox (Reserve Membership)\"
Run Code Online (Sandbox Code Playgroud)
我需要删除它,因为它有错误的-Target应该是
New-Item -ItemType SymbolicLink -Path C:\SPI -Target "C:\Users\Chino\Dropbox (Reserve Membership)\SPI"
Run Code Online (Sandbox Code Playgroud)
如果A.我可以轻松删除该路径并重新分配目标或更新目标.
有一些问题得到Nokogiri及其文档的正确设置有点粗略开始.
我正在尝试解析XML文件:http://www.kongregate.com/games_for_your_site.xml
它返回游戏内的多个游戏,每个游戏都有一个标题,desc等....
<gameset>
<game>
<id>160342</id>
<title>Tricky Rick</title>
<thumbnail>
http://cdn3.kongregate.com/game_icons/0042/7180/KONG_icon250x200_site.png?21656-op
</thumbnail>
<launch_date>2012-12-12</launch_date>
<category>Puzzle</category>
<flash_file>
http://external.kongregate-games.com/gamez/0016/0342/live/embeddable_160342.swf
</flash_file>
<width>640</width>
<height>480</height>
<url>
http://www.kongregate.com/games/tAMAS_Games/tricky-rick
</url>
<description>
Help Rick to collect all the stolen fuel to refuel his spaceship and fly away from the planet. Use hammer, bombs, jetpack and other useful stuff to solve puzzles!
</description>
<instructions>
WASD \ Arrow Keys – move; S \ Down Arrow – take\release an object; CNTRL – interaction with objects: throw, hammer strike, invisibility mode; …
Run Code Online (Sandbox Code Playgroud) 我试图after_find
在我的模型中使用回调,我在尝试让它实际更新它在after_find
方法中找到的行时遇到了问题。它抛出一个无方法错误
错误
Completed 500 Internal Server Error in 299ms
ActionView::Template::Error (undefined method `+' for nil:NilClass):
1: <div id="hashtags" class="twitter-hashtag-voting-block-v1">
2: <% @random_hashtag_pull.each do |hashtag| %>
3: <div class="span4 twitter-spans-v1" id="<%= hashtag.id %>">
4: <div id="tweet-block-v1" class="hashtag-tweet-database-container">
5: <div class="tweet-block-border-v1">
app/models/hashtag.rb:46:in `update_view_count'
app/views/shared/_vote_tweets.html.erb:2:in `_app_views_shared__vote_tweets_html_erb__2738953379660121418_70243350609340'
app/views/hashtags/create.js.erb:2:in `_app_views_hashtags_create_js_erb___1440072038737667206_70243345272440'
app/controllers/hashtags_controller.rb:23:in `create'
Run Code Online (Sandbox Code Playgroud)
标签控制器
class HashtagsController < ApplicationController
def home
end
def vote
@random_hashtags = Hashtag.order("RANDOM()").limit(4)
end
def show
end
def index
end
def create
Hashtag.pull_hashtag(params[:hashtag])
@random_hashtag_pull = Hashtag.random_hashtags_pull
respond_to do |format| …
Run Code Online (Sandbox Code Playgroud)