Skip to content

Instantly share code, notes, and snippets.

11 // element is expected to be a form element and contain a submit and file field
12 function update_form_with_progress_bar(element) {
13 // disable submit button
14 submit_button = element.down("input[type='submit']");
15 submit_button.disable();
16
17 // if file field has a value, display progress bar
18 file_field = element.down("input[type='file']");
19 if ( file_field != '' && file_field != null ) {
20 submit_button.hide();
1 <% content_for :file_upload_javascript do %>
2 <%= javascript_include_tag 'prototype.uploadProgress' %>
3 <script type="text/javascript" charset="utf-8">
4 Event.observe(window, 'load', function() { $('upload').uploadProgress(); });
5 </script>
6 <% end %>
7 <%= file_field(object_name, method, options) %>
8 <div id="progress" class="bar" style="display:none; width: 300px; background:#EEEEE none repeat scroll 0 0; border: 1px soli
9 <div id="progressbar" style="background:#333333 none repeat scroll 0 0; height:24px; width:0px;">test&nbsp;</div>
10 </div>
167 task :start do
168 run "sudo /etc/init.d/apache2 start"
169 backgroundrb.start
170 end
171
172 task :stop do
173 run "sudo /etc/init.d/apache2 stop"
174 backgroundrb.stop
175 end
176
TypeError: wrong argument type nil (expected Data)
/opt/local/lib/ruby/1.8/yaml.rb:387:in @emit'
/opt/local/lib/ruby/1.8/yaml.rb:387:in @quick_emit'
/opt/local/lib/ruby/1.8/yaml/rubytypes.rb:38:in @to_yaml'
/Users/jonathanwallace/rollbook/trunk/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/quoting.rb:31:in @quote'
/Users/jonathanwallace/rollbook/trunk/vendor/rails/activerecord/lib/active_record/connection_adapters/postgresql_adapter.rb:330:in @quote'
/Users/jonathanwallace/rollbook/trunk/vendor/rails/activerecord/lib/active_record/base.rb:2051:in @quote_value'
/Users/jonathanwallace/rollbook/trunk/vendor/rails/activerecord/lib/active_record/base.rb:2042:in @attributes_with_quotes'
/Users/jonathanwallace/rollbook/trunk/vendor/rails/activerecord/lib/active_record/callbacks.rb:309:in @inject'
/Users/jonathanwallace/rollbook/trunk/vendor/rails/activerecord/lib/active_record/base.rb:2040:in @each'
# model code
73 def dtstart_h=(args)
74 begin
75 self.dtstart = Time.zone.parse("#{args[:date]} #{args[:hour]}:#{args[:minute]}")
76 rescue ArgumentError # rescues invalid date format passed to Ruby's date parser
77 self.dtstart = Time.now
78 errors.add('dtstart', "Invalid date format for the start time. Please use 'YYYY-MM-DD HH:MM'.")
79 end
80 end
def save
self.is_account_owner = true # we need to make sure that this user is an account owner
self.authority = "superadmin" # we need to make sure that this user is a super
- return unless self.valid?
- Account.transaction do
- account.save
- account.users << user
- account_credit_card.account_id = account.id
- account_credit_card.save
+ return if not self.valid?
diff --git a/app/models/user.rb b/app/models/user.rb
index 36ac8a2..dba8fcb 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -69,10 +69,14 @@ class User < ActiveRecord::Base
validate_code_nil_or_unique
# if password confirmation is set, make sure it matches password
- if !self.password_confirmation.blank? and self.password != self.password_confirmation
+ if (not self.password.blank? or not self.password_confirmation.blank?) and self.password != self.password_confirmation
45 has_many :events, :dependent => :destroy
46 has_many :event_occurrences, :dependent => :destroy
47 has_many :file_resources, :class_name => "Resource", :conditions => "is_temporary = 'f' and type not in ('ResourceCourse','ResourceLogo','ResourceUserPicture','ResourceCours ePicture','ResourceCertificate')", :dependent => :destroy
48 has_many :forums, :dependent => :destroy
49 has_many :forum_posts, :dependent => :destroy
# error
/Users/jonathanwallace/Documents/projects/rollbook/vendor/rails/activerecord/lib/active_record/associations.rb:1379:in `sanitize_sql': wrong number of arguments (2 for 1) (ArgumentError)
from /Users/jonathanwallace/Documents/projects/rollbook/vendor/rails/activerecord/lib/active_record/associations.rb:1379:in `configure_dependency_for_has_many'
# 'gem install pg' solved this problem for me.
rbadmin@ares current_rollbook % rake --trace db:migrate
(in /var/www/rails/rollbook/releases/20090521133004)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:migrate
** Invoke db:schema:dump (first_time)
** Invoke environment
week = []
@weeks = []
@days.each do |day|
week << day
if week.size == 7
@weeks << week
week = []
end
end