upgrade a rails app from rails 2 to rails 3
Just a few notes on a recent upgrade with a rails project that was fairly young thus did not have a lot of issues moving to rails 3.
Just a few notes on a recent upgrade with a rails project that was fairly young thus did not have a lot of issues moving to rails 3.
I ran into some problems upgrading devise from 1.0.x to 1.3.x. to use passwords besides bcrypt you have to made 2 changes: in config/initializers/devise.rb config.encryptor = :sha1 (for devise 1.0.x compatibility) in User model (or whatever model calls devise) call devise with both :database_authenticatable and :encryptable you can tell you have issues with this if you see …
Continue reading ‘problems upgrading devise in an rails 2 to rails 3 migration’ »
Using to_f has the problem of returning 0.0 for invalid strings. So for a project I needed to know if a string was a valid float or not and came across this helpful page: ruby on rails – Determine if a string is a valid float value – Stack Overflow. My favorite option was this: …
I found myself looking through the code for activerecord-sqlserver-adapter and noticed a new mode called “dblib”. It turns out this mode can be used when using the tiny_tds gem along with FreeTDS to avoid using ODBC altogether. I decided to try it out on a project and have found it to work very well so far. The …
Continue reading ‘Accessing MS SQL Server from Rails without ODBC’ »
Despite ample documentation to the contrary I was surprised to learn that by default ruby matches w to all unicode characters. This lead to some strange results in one of my apps where unicode quotes were present and matching w. I found the solution is to use /w+/n to specify the n kcode rather than …
Continue reading ‘Ruby regexp surprise: w is not equivalent to [0-9A-Za-z_]’ »
I ran into an error when trying to save an object in flash between Rails actions. I’m still not sure why marshal data too short happened as the session storage is mysql using the text type which should be 64kb. I can’t imagine the object taking more size than that but it would be worth …
I’ve begun using devise for authentication for my various Ruby on Rails applications. It is based on warden which seems a sensible choice. There is also a fairly large community and active development. Devise plays nice with authorization libraries such as CanCan and can be integrated with OmniAuth for oauth/oauth2 authentication. I’ve run into a …
Continue reading ‘Working with devise for Rails authentication’ »
I’ve looked for a list of field names to not use that I can hand off to the db folks on projects but so far I cannot find one. I guess I’ll just start documenting the ones I know of to be problematic.
So in Rails 3 xss is protection is built in. This is good. In fact, I’ve wanted to see this since I first start coding rails in the 1.x days. I have not started any Rails 3 projects yet but I have been playing with enabling this on a Rails 2.3.8 project by using erubis …
It’s been a frustrating night trying to figure out how accepts_nested_attributes_for, autosave, dirtyness, and Rails versions all fit together. Going to try and summarize my findings and hopefully I’ll get it right. accepts_nested_attributes_for turns on autosave autosave will cause any loaded associations to be saved when save for the parent object is called the key …
Continue reading ‘Learned a lot about nested attributes and Rails’ »