RailsCasts Pro episodes are now free!
Learn more or hide this
GitHub User: Anjen1
For anyone who is still having problems with the syntax for the inserted crop_command in cropper.rb, what worked for me (rails 2.3.5, ruby 1.8.7) was
"-crop #{target.crop_w.to_i}x#{target.crop_h.to_i}+#{target.crop_x.to_i}+#{target.crop_y.to_i} "
No additional quote marks
For anyone still supporting a rails 2.3x app, the syntax that works for your migration is
def self.up add_column :users, :tasks_count, :integer, :default => 0
User.reset_column_information User.find(:all).each do |u| User.update_counters u.id, :tasks_count => u.tasks.count end
end
def self.down remove_column :users, :tasks_count end
note the handling of tasks_count in the do loop...
For anyone who is still having problems with the syntax for the inserted crop_command in cropper.rb, what worked for me (rails 2.3.5, ruby 1.8.7) was
No additional quote marks
For anyone still supporting a rails 2.3x app, the syntax that works for your migration is
def self.up
add_column :users, :tasks_count, :integer, :default => 0
end
def self.down
remove_column :users, :tasks_count
end
note the handling of tasks_count in the do loop...