The MigrateWar Rails plugin makes it easy to create database schema on deployment machines when you deploy via JRuby/War Files. This is especially helpful on Windows machines, where you cannot use Capistrano easily.
Capistrano is a powerful deployment tool that is considered ’state of the practice’ by anyone deploying Rails applications to Unixy type systems. But what about if you need some of that same Capistrano fu on a windows server. Can it be done? In my case I really needed a way to build my
database schema on the deployment target as soon as the application was deployed (cap deploy with migrations basically). This isnt such an
easy thing to do as I found. I was going to deploy via JRuby/Goldspike in a War file format (the standard java deployment package), so I dusted off my arcane Java knowledge and came up with a solution to load the schema.rb file as soon as the war file loads. Read on for details.
(more…)
posted by mhagedorn at 10:32 am
I just posted this to craigslist:
I am web developer who specializes in Ruby on Rails contracts and works remotely from my home office. Currently looking for new projects, I’m open to conversations about new contract possibilities. My company is Silverchair Solutions, an agile web development consultancy. I have over 13 years of web development experience
and two and a half years of Rails experience. Recently some of my work was published in the Advanced Rails Recipes book (Pragmatic Programmers - see the wizard chapter!). I am a former Oracle DBA and am very comfortable designing databases as well as configuring linux/mac os servers in support of my web applications.
To learn more about me, view my Linkedin profile here:
Working with Rails Profile
If you have a project that you think I may be able to help you with, please send me an email with a short description of what it is you need done and we will chat!
Thanks,
Mike
posted by mhagedorn at 7:51 pm
Ok its been awhile since this occurred, but I would be remiss if I didn’t mention that I have been included as one of the authors of the Pragmatic Studio’s Advanced Rails Recipes Book. I contributed a chapter on creating Wizards. You can check it out here. Basically I leveraged actsasstate_machine to pull this off. Check it out!
posted by mhagedorn at 8:35 am
I have an OpenId, I have found it useful. But frankly its just another thing that I have to remember. Somthing that I can’t forget is my website url. What if you could set up some kind of cool forwarding that allows me to use my website url as my OpenID? Well… you can. Actually if you just have a blog and not a full blown website, this will work too.
Add some entries to the head section of the index page of your website
`<link rel="openid.server" href="http://www.myopenid.com/server" />
<link rel="openid.delegate" href="http://your.real.openid.com/" />'
Where, the openid.server is the url of your provider, and the openid.delegate is your real openid identity.
This trick will work with any resource you have access to on the internet, i.e. anything where you could add information to the head portion of your index page. Many thanks to Duncan Davidson for this tip
posted by mhagedorn at 8:22 am
For those of us who live in the rails world, fantastic tools like Capistrano have made deployment drop-dead simple. And since I do some Cocoa work I found myself wanting some of that same capistrano-esqe love in my Cocoa deployments. The Sparkle framework handles most of this for you, but in its vanilla implementation requires you to hand code some descriptor files and this seemed problematic to me. So I have cooked up an Xcode based recipe which allows me to do push button deploys and let Sparkle handle the updating part.
(more…)
posted by mhagedorn at 10:40 am
Lately I have been using the wonderful acts_as_state_machine plugin for lots of cool stuff in my rails applications. The problem that I have run into though, is visualizing the state transitions that I have created. Typically, when I first learned about state machines back in Electrical Engineering days, we drew cool diagrams with bubbles to represent the states and arrows to show the state transitions (a.k.a state transition diagrams). I have found these to be very helpful. But I wanted to a way to automatically create these.
(more…)
posted by mhagedorn at 4:31 pm
Ok I know there are a million ways to do this “by hand”, but if you have a .mac membership this is for free basically… automatic remote access to your machines on the internet via your .Mac account. If you look carefully under the .Mac settings for Leopard, there is a “Back To My Mac” option. This basically wraps up all of the things like dyndns, etc into one easy to use package. Its really cool! Now I just need to have two machines running Leopard. I wonder if I can hack Tiger to use this?
posted by mhagedorn at 9:26 am
Upon loading up the new release of OSX 10.5 (Leopard), I was very frustrated to find that Growl notifications no longer work when using
Autotest. Apparently growlnotify, the command line app which makes the magic happen, isn’t compatible. Read on to see how I got this work
(more…)
posted by mhagedorn at 9:06 am
Found an interesting gotcha while trying out some of the new “User Interface in a Can” frameworks. If you use the new hasmany :through style declaration (rather than the old way hasandbelongsto_many)
for modeling your many to many relationships in ActiveRecord, then that relationship cannot be editable in these frameworks. What happens is that a relationship
is inferred, but since that relationship is read-only, a gui is generated which cannot edit that relationship. Which in non-geek speak means WORTHLESS.
Since I was on a tight time budget on a project, I had to do something, so I am in the process of converting back to HABTM, which both frameworks
happily use. I haven’t had a moment to grok why this is. But something about the existence of the :through class messes up introspecting the relationships.
I am hoping this isn’t too much of a limitation, because I like overall the GUI’s that are produced. Furthermore in my work at least I haven’t had to utilize
the power of a full-fledged join model in the middle, so I am hoping that this wont mess me up too much.
Has anyone else run into this?
posted by mhagedorn at 9:34 am
You know how people always tell you “once you know how this works, you can break the rules when you need”. I had to apply this maxim recently.
I had a situation where I needed to create new records on a form (so they would display as lineitems), but needed to defer validating these items until later. (In my case it was time sheet entries, but it doesnt really matter.) I struggled with how to do this until I stumbled on these two gems of knowledge. (which I probably should have remembered anyway)
ActiveRecord#save(false)
you can force active record to save and ignore validation errors
ActiveRecord#update_attribute
This does the same thing as above, but on a per attribute basis
Very handy. And yes.. I know that this is “breaking the rules” because I am skipping validation. But in this particular case.. it makes sense
posted by mhagedorn at 11:29 am