There's probably some better way for this, but the following works for me.
I reconcile my BucketWise accounts frequently. I also fairly regularly make minor errors in transactions.
Unfortunately, changing an already reconciled AcountItem whacks the statement reference from the object. We end up with leftover transactions in the reconciliation windows.
Solution:
Find the relevant statement.
s = Statement.find(...)
Find the relevant account item.
a = AccountItem.find_by_amount_and_statement_id(-1234, nil)
Set the statement for the account item and save
a.statement = s
a.save
done!
Wednesday, February 3, 2010
Sunday, September 6, 2009
BucketWise + Heroku => Profit!
I've been working with Jamis Buck's BucketWise and enjoying the control I exercise over my spending. But... I started with a local installation and it was good, but not so shareable. So... I tried installing at DreamHost, but things were not so compatible. Finally, I was messing with Heroku and found interesting info about how to install BucketWise there.
It seems that BucketWise uses git external references to pull in its plugin dependencies. Heroku uses git to manage applications, as in doing a git push (or similar) to deploy an application from a local repository to its Heroku location. Unfortunately, Heroku doesn't handle the external references. and leaves the plugins out of the deploy.
I found a fork by Tony Eichelberger (http://github.com/watkyn) that pulls out the git externals stuff and includes the plugins directly in the repository. doing a git clone from there and doing the Heroku setup stuff in the clone directory results in a working Heroku app.
There's a bit of a problem setting up the application once it's running. Heroku doesn't seem to support interactive Rake commands so I got into the Heroku console and directly created a new user and subscription to use.
BTW, I haven't tried it but the plugin changes here probably make the system work in DreamHost.
It seems that BucketWise uses git external references to pull in its plugin dependencies. Heroku uses git to manage applications, as in doing a git push (or similar) to deploy an application from a local repository to its Heroku location. Unfortunately, Heroku doesn't handle the external references. and leaves the plugins out of the deploy.
I found a fork by Tony Eichelberger (http://github.com/watkyn) that pulls out the git externals stuff and includes the plugins directly in the repository. doing a git clone from there and doing the Heroku setup stuff in the clone directory results in a working Heroku app.
There's a bit of a problem setting up the application once it's running. Heroku doesn't seem to support interactive Rake commands so I got into the Heroku console and directly created a new user and subscription to use.
- Clone the repository
git clone git://github.com/watkyn/bucketwise.git bucketwise
- Create the Heroku app
heroku create my-bucketwise-app
git push heroku
heroku rake db:schema:load - Setup BucketWise
heroku console
>> user = User.create({:name => 'Full Name', :email => 'email@server.com', :user_name => 'username', :password => 'FancyPass234'})
>> sub = Subscription.create(:owner => user)
>> user.subscriptions << sub - Login & Profit!
BTW, I haven't tried it but the plugin changes here probably make the system work in DreamHost.
Thursday, August 27, 2009
autotest and rails 2.x => NOP
One of the recent rails upgrades killed off autotest for me. My next door neighbor in training at RubyConf suggested the autotest-rails gem. It did the trick and got me running again.
Sunday, August 23, 2009
imgur - Totally simple image hosting
Go to imgur
Choose an image to upload and press 'Continue'
Once uploaded, have links to the original image plus small and large thumbnails. Choose the size you want and copy the proper text for your type of link to paste somewhere.
How simple can it be?
Images are kept for three months after last viewing.
Choose an image to upload and press 'Continue'
Once uploaded, have links to the original image plus small and large thumbnails. Choose the size you want and copy the proper text for your type of link to paste somewhere.
How simple can it be?
Images are kept for three months after last viewing.
Sunday, August 2, 2009
Necessary bits to make Control.Tabs work
When making Control.Tabs ( http://livepipe.net/control/tabs ) work, it is necessary to put the "new Control.tabs('classname');" javascript at the bottom of the page. The header just doesn't cut it.
Turn off auto-dating for ActiveRecord in tests
Fixtures have one nice characteristic. setting updated_at and created_at in them overrides what ActiveRecord would normally record. When using Factories (like factory_girl), want to have a way to turn the auto-dating off and on.
Michał Szajbe at Code Tunes provides this useful tidbit.
Add a small bit of code to test_helper.rb inside TestCase
Michał Szajbe at Code Tunes provides this useful tidbit.
Add a small bit of code to test_helper.rb inside TestCase
def without_timestamping_of(*klasses)After that, just wrap Factory calls in without_timestamping_of to turn off dating.
if block_given?
klasses.delete_if { |klass| !klass.record_timestamps }
klasses.each { |klass| klass.record_timestamps = false }
begin
yield
ensure
klasses.each { |klass| klass.record_timestamps = true }
end
end
end
without_timestamping_of Article, Comment, User doSimple and very useful. Many thanks again to Michał Szajbe at Code Tunes
Factory(:article, :created_at => 1.week.ago, :updated_at => 1.week.ago)
Factory(:comment, :created_at => 1.day.ago)
Factory(:user, :updated_at => 5.hours.ago)
end
How to tell if a ruby variable is already set.
Use the 'defined?' command to determine if a variable has already been set in a ruby script.
e.g. alpha = 'A' unless (defined?(alpha))
set the value of alpha to be 'A' unless it's already set. Yes, there are other shorter ways to do this particular. But, the example is still relevant.
e.g. alpha = 'A' unless (defined?(alpha))
set the value of alpha to be 'A' unless it's already set. Yes, there are other shorter ways to do this particular. But, the example is still relevant.
Subscribe to:
Posts (Atom)