Skip to content

Instantly share code, notes, and snippets.

validates_presence_of :recurring_end_on, :message=>"cannot go before start date", :if=> Proc.new{|a| (a.recurring_end_on.to_date.to_s < a.recurring_start_on.to_date.to_s) }
Sort all dates with group_by
Controller:
@task_dates = @tasks.group_by {|x| x.due_at }
View:
<%@task_dates.keys.sort.each do |month|%>
<h2><%#=month.strftime('%B')%></h2>
<%for task in @task_dates[month] %>
<%=task.due_at.to_date.to_s(:db)%><br>
$ rake thinking_sphinx:index
Generating Configuration to /var/www/html/myapp/config/development.sphinx.conf
Sphinx 0.9.8.1-release (r1533)
Copyright (c) 2001-2008, Andrew Aksyonoff
using config file '/var/www/html/myapp/config/development.sphinx.conf'...
FATAL: no sources found in config file.
rake aborted!
The following command failed:
indexer --config "/var/www/html/myapp/config/development.sphinx.conf" --all
:javascript
var s1 = new SWFObject('/webcast/player.swf','player','640','480','9');
s1.addParam('allowfullscreen','true');
s1.addParam('quality', 'high');
s1.addParam('allowscriptaccess','always');
s1.addVariable('autoplay','false');
s1.addParam('flashvars','file=<%=videolink%>');
//'file=/webcast/video/t1.flv'
s1.write('preview');
%script{:type=>'text/javascript'}
var s1 = new SWFObject('/webcast/player.swf','player','640','480','9');
s1.addParam('allowfullscreen','true');
s1.addParam('quality', 'high');
s1.addParam('allowscriptaccess','always');
s1.addVariable('autoplay','false');
s1.addParam('flashvars','file=#{videolink}');
=#//'file=/webcast/video/t1.flv'
s1.write('preview');
NoMethodError (undefined method `request_uri' for #<URI::Generic:0xb76489b4 URL:>):
/usr/local/lib/ruby/1.8/net/http.rb:380:in `get_response'
/usr/local/lib/ruby/1.8/net/http.rb:543:in `start'
/usr/local/lib/ruby/1.8/net/http.rb:379:in `get_response'
app/controllers/events_controller.rb:61:in `show'
haml (2.2.6) rails/./lib/sass/plugin/rails.rb:19:in `process'
passenger (2.1.3) lib/phusion_passenger/rack/request_handler.rb:65:in `process_request'
passenger (2.1.3) lib/phusion_passenger/abstract_request_handler.rb:197:in `main_loop'
passenger (2.1.3) lib/phusion_passenger/railz/application_spawner.rb:340:in `start_request_handler'
passenger (2.1.3) lib/phusion_passenger/railz/application_spawner.rb:298:in `handle_spawn_application'
require 'rubygems'
require 'ccsv'
reader=CSV.open(source_file,'r')
header=reader.shift
data=reader.shift
reader.each(source_file) do |row|
puts row[0]
end
#Controller
def index
@quotes = Quote.find(:all)
end
def update
@gg=params[:quote][:price_expires]
end
#Index view
$rake thinking_sphinx:index --trace
(in /var/www/html/training_request)
** Invoke thinking_sphinx:index (first_time)
** Invoke thinking_sphinx:app_env (first_time)
** Execute thinking_sphinx:app_env
** Invoke environment (first_time)
** Execute environment
** Execute thinking_sphinx:index
rake aborted!
$#./script/plugin -v install git://github.com/thoughtbot/paperclip.git
Plugins will be installed using http
git init
git pull --depth 1 git://github.com/thoughtbot/paperclip.git
$#