|
Disclaimer: Very new to RoR. I've been building a small project recently and have been using migrations to build my database since apparently it's the best way to do it (?) and I'm trying to get used to The Rails Way. I realized that a migration I just created to change a field was pretty stupid so I wanted to roll back to the version beforehand. Of course, being the idiot that I am I just had to write this code... code:
|
# ¿ Sep 24, 2007 06:24 |
|
|
# ¿ May 6, 2024 23:36 |
|
Hammertime posted:Oh, and assuming this is a pre-production system. Don't bother creating separate migration files for an alter column. It's easier to migrate back to version 0, change the table declaration to include the column, and rake it back to the latest version. Before you actually push the system live, the practice is to group all the migration files together into a single file (not including sample/starting data if you have any). Ideally there's a migration file for each version of the system that gets pushed into production, having separate migration files for development is just a temporary measure. Okay, I'll probably just futz around with it to get it back to normal, since this is only development, not production. jonnii posted:What was the column before hand? Were you just adding the constraint? I changed it from :date to :datetime and added the default value. Neither were necessary. Grob posted:This can actually be dangerous unless you are the only person working on the project. If multiple people are checking out your source, going back and editing earlier revisions is sure to ruin their day Just a warning for the new guys. Duly noted. This is currently just a personal project without source control but I'd like to add another developer or two and SVN if this ever sees the light of day.
|
# ¿ Sep 24, 2007 18:09 |
|
Is either one of acts_as_searchable or acts_as_ferret inherently better than the other?
|
# ¿ Nov 17, 2007 07:00 |
|
Embarrassingly retarded question... I can't believe I can't figure out the answer to this on my own. Imagine I've got something like the following:code:
code:
|
# ¿ Nov 19, 2007 14:51 |
|
Why didn't I think of that? I tried @posts.length and @posts.count. Thanks.
|
# ¿ Nov 19, 2007 15:46 |
|
Grob posted:Actually @posts.length should work too. @posts.size is equivalent, so I'm not sure why that failed! Hmm, so it does, guess I forgot what I tried. It all seems so obvious now.
|
# ¿ Nov 19, 2007 16:03 |
|
I've got a controller set up like this:code:
|
# ¿ Nov 25, 2007 15:40 |
|
Thanks for the advice guys. Wouldn't you know it though, there was actually a really easy way of doing it. I was unaware you could just append arbitrary parameters to a redirect_to so all I did was made it redirect_to :action => "method2", :temp => true and checked params[:temp] in method2.
|
# ¿ Nov 25, 2007 16:42 |
|
What would be the sanest way to add a "global" variable accessible by all controllers/views in an app? At the moment I've just got a method in the application helper that returns the variable but I was wondering if there was a more "rails" way to do this.
|
# ¿ Dec 5, 2007 09:17 |
|
Just a constant, nothing fancy.
|
# ¿ Dec 5, 2007 19:53 |
|
Can anyone tell me why this WON'T loving INCREMENT?code:
|
# ¿ Dec 7, 2007 10:03 |
|
Hammertime posted:Based on the API source, I believe it's expecting the name(or maybe the symbol) of the attribute. Motherfucker. Thanks a lot.
|
# ¿ Dec 7, 2007 10:35 |
|
How do I check my app's compatability with Rails 2? I was under the impression that 1.2.6 would show deprecation warnings, however, uhh... where does it show them? I can't find anything in the development.log or in the command line server output.
|
# ¿ Dec 27, 2007 05:18 |
|
I thought stuff that has been moved to plugins (pagination, some javascript helpers which I'm using) would show deprecation warnings. They're certainly noted as such in the documentation.
|
# ¿ Dec 27, 2007 07:46 |
|
So it looks like the acts_as_taggable gem is broken in Rails 2 due to the push_with_attributes method being shitcanned. What's the quickest way I can get tagging support back without loving with my app too much? I looked at acts_as_taggable_on_steroids but it hasn't been updated in two months and based on the comments on that page it may be pretty buggy. All I want is a gem/plugin that's updated regularly and works with Rails 2. gently caress, I was so close to having my app all moved over.
|
# ¿ Dec 30, 2007 08:51 |
|
atastypie posted:You could use acts_as_taggable_on which offers the same features as on_steroids and the ability to add tags based on the model (like User) and contexts (like Interests, Bookmarks, etc.). If you don't want to use contexts, you can set it to :tags and it will basically be a drop in replacement for on_steroids. Okay, say I go with this. How do I... finagle it in to my app? I've got a migration that created the old structure for tags, but what's the best way to pretend that never existed? I think this goes to show how little I really understand migrations. It's my understanding that it's meant to demonstrate a series of steps that represent the state of the database schema. But what happens when you want to, say, roll the app out and freeze the schema? Is there a way you can roll all your migrations in to one and then start writing new migrations? Or what if you need to make large scale changes like I do? Is my only option to write a migration which directly reverses a previous migration? I guess this doesn't make a whole lot of sense to me now because I'm the sole dev of this app but I guess how I can see it would make an environment with several devs easier.
|
# ¿ Jan 2, 2008 15:22 |
|
M-M-M-Mega question post. Is there an easy way to test ActionMailer or am I going to have to wait until this hits the production server? For the record, I'm developing on a Mac OS X and apparently I have /usr/sbin/sendmail available. I tried following http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer but mongrel made the complaint "environment.rb:47: uninitialized constant ActionMailer (NameError)" when I tried to stick some of the config stuff in there. I'm running Rails 2.0.2 and imagine this has something to do with it. On the plus side, the development.log showed the email being "sent" and everything looked fine. Is there any application level logger plugins floating around? Basically, all I want to do is log when a few select actions are hit for dealing with user problems. Would I be better off just rolling my own? Next question... What would be my best hosting choice at the moment? I'm really tossing up between Media Temple or a VPS. Both have their pros and cons. MT takes a lot of the hassle out of management and the price for the base level grid service seems reasonable for the space and bandwidth. On the other hand, it only comes with a 64 MB Rails "container" which, from my understanding, would result in some pretty crap performance. To up this to 256 MB costs an additional $25/month which ends up making it a fairly expensive $45 a month (for a project I'm funding out of my own pocket). If I go with a VPS I'm assuming I have to do all the management for myself, and quite frankly, I know nothing about tuning a Rails server. On the other hand, I could probably get a better deal in terms of resources from one of these. Help, goons!
|
# ¿ Jan 5, 2008 11:04 |
|
Austria posted:Slicehost They look pretty good price-wise, but sparse feature-wise (I guess there's a pretty obvious correlation there). I'll definitely keep them in mind.
|
# ¿ Jan 5, 2008 12:16 |
|
Austria posted:What features are you looking for? Yeah, I guess I'm stuck in the days where I ran everything through WHM/cPanel, which was 5 to 6 years ago (seriously, I haven't considered hosting since then). I'm supposed to be a professional these days so I guess I should suck it up and act like it. Sorry, moment of introspection. quote:Also, ignore most hosts' disk and bandwidth allowance. Almost all of them oversell, including (mt). I legitimately can't in this case. I need the host to be able to deliver on their bandwidth promises. I'm going to be pushing files up to 100 MB back to customers, and if I can't, for whatever reason, I lose money.
|
# ¿ Jan 5, 2008 14:44 |
|
Anyone have any more rails host recommendations?
|
# ¿ Jan 11, 2008 05:56 |
|
Okay, so I've just "deployed" my first application, an I thought I'd share some of the things I've learned. 1) Slicehost seems pretty reasonable so far. No initial set up issues and I've only had to reimage once so far. The guides are mostly useful too. 2) I need a better way to deploy. I'm guessing SVN + Capistrano are the way to go about this. The way I just did it was to literally copy across my entire application directory, and I ran in to the following problems:
3) Fresh environments reveal deficiencies in my code. Anyone have any other advice they can offer?
|
# ¿ Jan 15, 2008 08:04 |
|
I guess it's not going as entirely smoothly as I hoped. For some reason, the live app is working differently to the app on my dev machine. This is absolutely baffling to me since I'm using the same version of Rails and MySQL on both. Is there any logical reason for this? I think I'm going to follow jonnii's advice because I'm getting too frustrated looking at this today, so I'll re-image tomorrow and try Nginx and Capistrano.
|
# ¿ Jan 15, 2008 10:20 |
|
jonnii posted:what kind of differences? why not try running your app locally in production mode. Just did this because I can't let it go and get to bed. Part of the live app is ignoring that a field is defined as :boolean (which treated as a TINYINT(1) in MySQL). If you print it it'll just show 0 or 1, where on the dev app it'll show a nice false or true. I've also got a method to toggle it, which looks like this: code:
What confuses me most is I've used the boolean type in another place as a very similar way, and this works fine on the live server. There's absolutely no differences in the code or DB structure these things are using - the live one is generated from the dev one.
|
# ¿ Jan 15, 2008 17:07 |
|
jonnii posted:are you using the same version of mysql? Yes, 5.0.45 on both.
|
# ¿ Jan 16, 2008 03:49 |
|
I've encountered a bit of a problem with sending out emails to multiple recipients (a mailing list, not spam). Basically, from what I've read it can be done two ways. #1 code:
code:
Is there any way to get the advantages of both?
|
# ¿ Feb 9, 2008 05:05 |
|
|
# ¿ May 6, 2024 23:36 |
|
I know Hobo is mentioned in the first few posts but has anyone done anything with it since? I thought I'd have a go at rewriting an existing Rails app with it to add some functionality (users and permissions) and to fix some problems with the old app. The problem I'm facing now is there's, as far as I can see, no documentation whatsoever for recent iterations of DRYML. Does anyone know if there is any reference at all?
|
# ¿ Feb 15, 2008 10:51 |