Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
skidooer
Aug 6, 2001

Heffer posted:

Is there an api for the map object and what functions I can call on it?
You can call whatever you want. Whatever method name you chose will be used to generate the named route methods. For example: map.foo 'a/long/path/to/foo/:id' will create foo_path, foo_url, etc. that you can then use in your app like: <%= link_to 'Foo', foo_path(@foo) %> or redirect_to foo_url(@foo).

The special cases are map.resources, which is explained here, and map.connect which works the same as the named routes above, but doesn't define the helper methods.

Heffer posted:

Ruby has terrible API docs.
routes.rb itself should tell you everything you need to know. But yeah, I find it's easier to just jump into the source. It's a pretty easy read.

skidooer fucked around with this message at 22:46 on Dec 28, 2007

Adbot
ADBOT LOVES YOU

Heffer
May 1, 2003

skidooer posted:

You can call whatever you want. Whatever method name you chose will be used to generate the named route methods. For example: map.foo 'a/long/path/to/foo/:id' will create foo_path, foo_url, etc. that you can then use in your app like: <%= link_to 'Foo', foo_path(@foo) %> or redirect_to foo_url(@foo).

The special cases are map.resources, which is explained here, and map.connect which works the same as the named routes above, but doesn't define the helper methods.
I've figured out named paths so far, and thats well and good. How do I figure out what map.resources automatically creates? It doesnt seem to be spelled out what actions it looks for or what paths it creates.

For instance in those docs it shows these actions: new create show edit update destroy. In my scaffold generated controller, it also maps an index action.

Where do I find the options for the map.resource command? I can see from the examples there are some options like :collection :member :controller :path_prefix and :name_prefix.

quote:

routes.rb itself should tell you everything you need to know. But yeah, I find it's easier to just jump into the source. It's a pretty easy read.

routes.rb gives about 10 sample statements, but it's not everything I need to know. Looking at the source may help, but its not a legitimate replacement for proper documentation. And it looks as though the majority of documentation is auto generated from the source code comments, which is lacking.

Also, it appears that the /action_controller/routing.rb has the class RouteSet which is what map is. I found this only by searching around for it.

Unfortunately, /action_controller/routing.rb does not have any specifications for the .resource method because it actually comes from an entirely different module. /action_controller/resources.rb opens up the RouteSet class and inserts some functionality on its own.

code:
class ActionController::Routing::RouteSet::Mapper
  include ActionController::Resources
end
What, exactly, should I do in future cases to figure this out?

skidooer
Aug 6, 2001

Heffer posted:

It doesnt seem to be spelled out what actions it looks for or what paths it creates.
Actually it does, in the API docs, at the aforementioned link. It's quite detailed and seems to answer all of your questions.

Hop Pocket
Sep 23, 2003

I seem to have broken something :P I upgraded ruby to 1.8.6 on the Solaris instance our site is deployed on:

code:
./configure --prefix=/opt/csw
make
sudo make install
Running ruby -v gives me 1.8.6, as expected. Things still work, except for migrations. On the production server:

code:
site.com: ~/web/rails/current $ rake RAILS_ENV=production  db:migrate
(in /home/site.com/web/rails/releases/20071228132919)
/opt/csw//lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/ ... 
              connection_adapters/mysql_adapter.rb:333: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i386-solaris2.11]

Abort (core dumped)
site.com: ~/web/rails/current $ ll
Unfortunately, I don't know how to deal with coredumps. The place where it is segfaulting in mysql_adapter.rb is:

code:
        execute("SHOW KEYS FROM #{table_name}", name).each do |row| .... end
So it seems that it is taking issue with the SQL command. However, the rest of the rails install works perfectly, including the normal database interaction. Any ideas on how to fix this?

ikari
May 17, 2003

Yeah, pretty much.

Hop Pocket posted:

code:
site.com: ~/web/rails/current $ rake RAILS_ENV=production  db:migrate
(in /home/site.com/web/rails/releases/20071228132919)
/opt/csw//lib/ruby/gems/1.8/gems/activerecord-1.15.5/lib/active_record/ ... 
              connection_adapters/mysql_adapter.rb:333: [BUG] Segmentation fault
ruby 1.8.6 (2007-09-24) [i386-solaris2.11]

Abort (core dumped)
site.com: ~/web/rails/current $ ll
Unfortunately, I don't know how to deal with coredumps. The place where it is segfaulting in mysql_adapter.rb is:

code:
        execute("SHOW KEYS FROM #{table_name}", name).each do |row| .... end
So it seems that it is taking issue with the SQL command. However, the rest of the rails install works perfectly, including the normal database interaction. Any ideas on how to fix this?

Reinstaling the MySQL gem could be worth a shot.

Heffer
May 1, 2003

Can you try catching that command as its executed on the mysql server? I forget what the best way is to find the currently executing command from the mysql admin tools.

Then you can make sure that variable value is getting parsed out, and then execute it yourself on the database to make sure it works.

SeventySeven
Jan 18, 2005
I AM A FAGGOT WHO BEGGED EXTREMITY TO CREATE AM ACCOUNT FOR ME. PLEASE PELT ME WITH ASSORTED GOODS.
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. :(

Hop Pocket
Sep 23, 2003

Heffer posted:

Can you try catching that command as its executed on the mysql server? I forget what the best way is to find the currently executing command from the mysql admin tools.

Then you can make sure that variable value is getting parsed out, and then execute it yourself on the database to make sure it works.

Good idea. I was able to turn the MySQL log on, and found that the commands are executing on the backend.

code:
...
3 Query       SHOW KEYS FROM events
3 Query       SHOW FIELDS FROM events_tags
3 Query       SHOW KEYS FROM events_tags
3 Query       SHOW FIELDS FROM images
3 Query       SHOW KEYS FROM images
3 Query       SHOW FIELDS FROM questions
3 Query       SHOW KEYS FROM questions
3 Query       SHOW FIELDS FROM repeat_intervals
3 Query       SHOW KEYS FROM repeat_intervals
Trying this last command in a MySQL prompt seems to work perfectly.

quote:

Reinstaling the MySQL gem could be worth a shot.

I've had problems building just about anything on this Solaris box, so I'm a little nervous.Is there a way to test a gem build without doing a gem remove and then a gem install?

skidooer
Aug 6, 2001

SeventySeven posted:

What's the quickest way I can get tagging support back without loving with my app too much?
Probably switching to a join model, or re-implementing push_with_attributes yourself. Neither method should be all that difficult to make happen.

hmm yes
Dec 2, 2000
College Slice
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.

Hop Pocket
Sep 23, 2003

ikari posted:

Reinstaling the MySQL gem could be worth a shot.

Removing the MySQL gem seemed to fix it. I'll see what I can do about re-installing the MySQL gem.

EDIT. Trying to re-install the MySQL gem did not work well at all..

code:
admin: /opt/csw/lib/ruby/gems/1.8/gems $ sudo gem install mysql -- --with-mysql-dir=/opt/csw/mysql5
Select which gem to install for your platform (i386-solaris2.11)
 1. mysql 2.7.3 (mswin32)
 2. mysql 2.7.1 (mswin32)
 3. mysql 2.7 (ruby)
 4. mysql 2.6 (ruby)
 5. Skip this gem
 6. Cancel installation
> 3
ERROR:  While executing gem ... (ArgumentError)
    install directory "/opt/csw//lib/ruby/gems/1.8/gems/mysql-2.7" not absolute
I made sure the directory did not exist before I tried to install the MySQL gem. Have you guys seen that before?

Hop Pocket fucked around with this message at 19:40 on Dec 30, 2007

Unixmonkey
Jul 3, 2002

Hop Pocket posted:

ERROR: While executing gem ... (ArgumentError)
install directory "/opt/csw//lib/ruby/gems/1.8/gems/mysql-2.7" not absolute

That doesn't look like a proper path. note the '//' after /opt/csw/

Hop Pocket
Sep 23, 2003

Unixmonkey posted:

That doesn't look like a proper path. note the '//' after /opt/csw/

Yeah, but I guess I'm not sure why the // is happening. I figured it was a problem with how I had configured ruby before I built and installed it. I thought that originally I had perhaps specified --prefix=/opt/csw/ and that the trailing slash was responsible fore the // when trying to build the mysql gem. I re-installed ruby then with --prefix=/opt/csw (without the trailing slash) and had the same problem.

Hop Pocket
Sep 23, 2003

Well, I was able to re-install the mysql gem! Using the --exec-prefix option, and specifying the same value as --prefix, seemed to do the trick. However, I'm still segfaulting when trying to run a migration. If I uninstall the mysql gem, the migrations work fine. Thanks for the help so far.

SeventySeven
Jan 18, 2005
I AM A FAGGOT WHO BEGGED EXTREMITY TO CREATE AM ACCOUNT FOR ME. PLEASE PELT ME WITH ASSORTED GOODS.

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? :psyduck: 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.

Pardot
Jul 25, 2001




SeventySeven posted:

migrations

The 'right' way to do to, is what you say. You should write a new migration to undo the stuff you no longer want.

It is possible to flatten them, if you'd like, but you're going to have to clear your database and start from migration 0. This is fine when you're first starting the app, I feel. But as soon as you start having real data you can't do this anymore. You need the migrations to

When you roll out the app, you should make sure it passes all your specs, make a tag, and release from the tag. I'm assuming you use rspec, write tests, and use subversion. Not to get preachy, but you should be testing everything, and using source control. I guess you could use something other than rspec, but it's pretty awesome. As for subversion, it's fairly ubiquitous, but a lot of the cool kids are using git now. I've not used that though, so I don't know if there are still tags and such but I'd assume so.

That said, you should also take a look at auto migrations. It's pretty slick. I haven't had a chance to use it yet, but I probably will for the next app.

skidooer
Aug 6, 2001

SeventySeven posted:

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?
The migrations are rolled into schema.rb. You'll use that (via: rake db:schema:load) to deploy your cold database. From that point forward you'll rely on the migrations to make incremental changes. So yes, if you are undoing a previous change, you still want to write a new migration.

SeventySeven posted:

Or what if you need to make large scale changes like I do?
How often do you really need to make large changes to the schema? :psyduck:

SeventySeven posted:

I guess how I can see it would make an environment with several devs easier.
Migrations work better with just one developer, actually. Although there are some plugins that aim to improve them for multiple developers.

bmoyles
Feb 15, 2002

United Neckbeard Foundation of America
Fun Shoe
Someone pissed in Zed Shaw's cheerios
http://www.zedshaw.com/rants/rails_is_a_ghetto.html
Fun read :)

Sharrow
Aug 20, 2007

So... mediocre.
Jesus Christ. The way he drama-queens on I'm not surprised he doesn't get on with people.

And then the other half of it is whining about companies half-arsing projects trying to make a quick buck off the Rails hype. Hey, what a surprise!

MrSaturn
Sep 8, 2004

Go ahead, laugh. They all laugh at first...

bmoyles posted:

Someone pissed in Zed Shaw's cheerios
http://www.zedshaw.com/rants/rails_is_a_ghetto.html
Fun read :)

lord, what the devil is he on about? poor guy, lovely people ruined something that could have done him well, it looks like.

GroceryBagHead
Nov 28, 2000

Looks to me like Zed Shaw is an rear end in a top hat of massive proportions. Me? Oh, I'm just a nobody. But at least my ego can squeeze through doors.

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense

bmoyles posted:

Someone pissed in Zed Shaw's cheerios
http://www.zedshaw.com/rants/rails_is_a_ghetto.html
Fun read :)

"There’s no work for a smart man in a town full of stupid."

This was my favorite part, I find it very funny. As well I got some good tips on new frameworks out of reading that, one or two frameworks that I want to use.

Thank you.


Edit: A lot of drama was in that read GEEEZ.

Nolgthorn fucked around with this message at 11:23 on Jan 4, 2008

El Cheeseman
May 31, 2004

by Fragmaster
I'm just starting out with Rails and I'm trying to wrap my head around something:

In my views/layouts/displaytext.rthml I have
code:
<div id="sidebar">
    <%= @sidebar_text %>
</div>
And the controller is:
code:
class RegisterController < ApplicationController

        @@sometext      = "Text<br />"
        @@othertext         = "Other text"
        @@moretext       = "More text"


        def index
                @sidebar_text = @@sometext + @@othertext
        end

        def notsometext
                @sidebar_text = @@moretext + @@othertext
        end

        def notmoretext
                @sidebar_text = @@sometext + @@moretext  

end
What I am trying to do is figure out how to make this work.
I can assign change it to @sidebar_text = "a random string here" and it will display fine.
But if I want to be able to write @@sometext, etc once and call them each time.

How do I do this?

edit:

Apparently just after I posted this code, it started to work fine.
Sorry.

El Cheeseman fucked around with this message at 14:47 on Jan 4, 2008

hmm yes
Dec 2, 2000
College Slice
Two quick questions:

What's the correct notation when referring to an action and the controller it came from? Something you would want to use in a changelog, or when talking over IM/Email to another person working on the project.

Does anyone have any book recommendations on getting started in testing, specifically within a rails environment? The two books I have found are 'Foundations Of Rspec' and 'Agile Testing With Ruby And Rails', but I don't know much about either.

smackfu
Jun 7, 2004

So nowadays, what's the best way to do the web side of RoR, on a shared host?

I wrote an app about a year ago that used dispatch.fcgi, and it was stable and I haven't touched it in a year, but Dreamhost said "go dedicated or shut it off" (grrr), so I now I am moving to a diff host and have to think about it again.

Really not looking forward to this.

smackfu fucked around with this message at 20:07 on Jan 4, 2008

ikari
May 17, 2003

Yeah, pretty much.

atastypie posted:

Two quick questions:

What's the correct notation when referring to an action and the controller it came from? Something you would want to use in a changelog, or when talking over IM/Email to another person working on the project.

I like ControllerName#Action myself. Like SessionsController#create. It's kind of standard notation for describing an instance method of a class or module.

Pardot
Jul 25, 2001




El Cheeseman posted:

Apparently just after I posted this code, it started to work fine.
Sorry.

The controller is not at all where you want to have anything to do with presentation stuff, that belongs in the view. You want to look up partials and content_for.

content_for: http://api.rubyonrails.org/classes/ActionView/Helpers/CaptureHelper.html

Your controllers really only should take in params, and use them to pass an object to your view. Read the popular Skinny Controller, Fat Model, even though that's aimed at not putting model stuff in your controller, same goes for view stuff in the controller.

Also stay away from class variables. Not that they don't have their uses, I can't remember the last time I had reason to, and they shouldn't be used for what you're doing.

atastypie posted:

What's the correct notation when referring to an action and the controller it came from?
I use UsersController#index. Same as ikari.

atastypie posted:

Does anyone have any book recommendations on getting started in testing, specifically within a rails environment? The two books I have found are 'Foundations Of Rspec' and 'Agile Testing With Ruby And Rails', but I don't know much about either.
I can't help you with books. David Chelimsky just posted that he contributed to advanced rails recipes, though.
Here is a video from ruby conf with him: http://rubyconf2007.confreaks.com/d3t1p2_rspec.html
And here is another testing video:
http://rubyhoedown2007.confreaks.com/session01.html
I do really like rpsec and even contributed a (very small, pair programmed with someone else) patch to it :)

smackfu posted:

rails shared host
I'm using apisnetworks for my personal stuff now, and they've been the only host I've stayed at for more than one year in the last 8 years or so. Goon run for what it's worth, you can get some discount in the thread in sa-mart. The only problem I had was trying to run mingle on it because it was using a half gig of ram. I have no idea why it takes so much, maybe it has to do with jruby. If you decide to use them, let me know.


edit:

I'm starting to take a closer look at merb and would also like to check out one of the other ORM (datamapper or sequel) at the same time. Has anyone used any of that? Should there be a new thread for this or the general ruby thread?

Pardot fucked around with this message at 06:38 on Jan 5, 2008

SeventySeven
Jan 18, 2005
I AM A FAGGOT WHO BEGGED EXTREMITY TO CREATE AM ACCOUNT FOR ME. PLEASE PELT ME WITH ASSORTED GOODS.
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. :shobon:

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!

Austria
Oct 16, 2006

Go with a VPS.

A slice at Slicehost is cheaper and more flexible than (mt)'s (gs) product. I find that (gs) is a lot of hype. The performance is nothing worth writing home about and has recently had a lot of downtime and instability. Getting a Rails app running on there is annoying too. With Slicehost (or another similar host), you'll be able to get a Rails stack up pretty fast. Slicehost has plenty of documentation and tutorials on doing so. I think that some hosts allow you to install a pre-built image of a Rails stack.

Austria fucked around with this message at 11:49 on Jan 5, 2008

SeventySeven
Jan 18, 2005
I AM A FAGGOT WHO BEGGED EXTREMITY TO CREATE AM ACCOUNT FOR ME. PLEASE PELT ME WITH ASSORTED GOODS.

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.

Austria
Oct 16, 2006

SeventySeven posted:

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.

What features are you looking for?

Their control panel is amongst the nicest I've seen for a VPS. They make it easy to get your system running (you can get a working Rails stack in a matter of minutes), keep it running and get it running after you gently caress up (rescue console, root password recovery, AJAX console, etc).

Also, ignore most hosts' disk and bandwidth allowance. Almost all of them oversell, including (mt).

SeventySeven
Jan 18, 2005
I AM A FAGGOT WHO BEGGED EXTREMITY TO CREATE AM ACCOUNT FOR ME. PLEASE PELT ME WITH ASSORTED GOODS.

Austria posted:

What features are you looking for?

Their control panel is amongst the nicest I've seen for a VPS. They make it easy to get your system running (you can get a working Rails stack in a matter of minutes), keep it running and get it running after you gently caress up (rescue console, root password recovery, AJAX console, etc).

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.

Austria
Oct 16, 2006

SeventySeven posted:

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.

Hosts that oversell cannot guarantee you the bandwidth they advertise. It's usually all in their ToC (you really think they have 1 million TB available for every user?). If you're after storage, I suggest looking into Amazon's S3. Even their EC2 stuff is nice if you're after hosting.

skidooer
Aug 6, 2001

SeventySeven posted:

Is there an easy way to test ActionMailer or am I going to have to wait until this hits the production server?
http://manuals.rubyonrails.com/read/chapter/64

If you want to actually deliver the message:
code:
config.action_mailer.perform_deliveries = true
But personally, for the number of times I want to send the message, I find it's easier to just copy the output from the logs straight into an SMTP session.

Vulture Culture
Jul 14, 2003

I was never enjoying it. I only eat it for the nutrients.

Austria posted:

Hosts that oversell cannot guarantee you the bandwidth they advertise. It's usually all in their ToC (you really think they have 1 million TB available for every user?). If you're after storage, I suggest looking into Amazon's S3. Even their EC2 stuff is nice if you're after hosting.
As long as they abide by the terms of your hosting and don't try to cancel your account for letting you use your allotted bandwidth, though, it's not really an issue. Banks don't really have all the money that's invested in them either.

smackfu
Jun 7, 2004

A quick follow-up: it was really quite easy to get my app running on mongrel instead of FCGI. Biggest problem I had was that my new host didn't have the same version of MySql libraries as the old one (or what I had on my dev box).

nuckingfuts
Apr 21, 2003
I'm currently making a blog. I have created a model called Article, configured the controller and views, and ran the rake db migration. When I try to load /articles in a browser I get:
Routing Error

no route found to match "/articles" with {:method=>:get}

There is an entry in my routes.rb
map.resources :articles, :collection => {:admin => :get}

What should I be looking for to figure out what the hell is going on?

Edit - I figured out what the hell was going on. Before I did all the work with the article things I was messing around with subversion. I had restarted webrick a few times to see if that was the problem before, but I needed to cd out of the directory and cd back in. After restarting webrick again, everything loaded like it should.

nuckingfuts fucked around with this message at 08:20 on Jan 6, 2008

Hop Pocket
Sep 23, 2003

This is a ferret question. I have the ferret_server DRb server up and running, but I'm trying to get it so that I can restart the ferret server through Capistrano whenever I restart the Mongrel processes. Not having a lot of luck with this at the bottom of my deploy.rb:

code:
task :post_deployment do
  run "cd /home/site.com/web/rails/current/ && script/ferret_server -e production stop"
  run "cd /home/site.com/web/rails/current/ && script/ferret_server -e production start"
end

after 'deploy:restart', :post_deployment
After the restart it tries to execute the stop and then start, but fails:

code:
 ** [out :: [email]site.com@site.com[/email]] no such file to load -- /usr/bin/../config/environment
    command finished
So it looks like it's not respecting the current directory. Any ideas on how to get around this? I have to restart the DRb ferret_server each time so that it picks up the new index location.

edit: Crossposted this to the ruby forums because I'm kind of under some pressure to get this thing finished. Sorry if you guys see this post in multiple places

vvv solution

--------------

In order to get this to work, I created a script/restart_ferret.sh script:

code:
#!/bin/sh

cd /home/site.com/web/rails/current
script/ferret_server -e production stop
script/ferret_server -e production start
And in the deploy.rb:

code:
task :post_deployment do
  run "bash -c /home/site.com/web/rails/current/script/restart_ferret.sh"
end
That seems to work.

Hop Pocket fucked around with this message at 14:08 on Jan 8, 2008

MrSaturn
Sep 8, 2004

Go ahead, laugh. They all laugh at first...
Ok, so I made the plunge and bought some hosting on dreamhost. I've moved one of my rails applications over, but I don't know how to tell it to run on the default port for my domain.

Essentially, at the moment you can access it at http://puddl.es:3000 but I just want to be able to get to it from http://puddl.es

how do I do that? I've tried to do ruby script/server -p 80, but that doesn't work (it tells me I have permission denied on Bind())

Adbot
ADBOT LOVES YOU

Austria
Oct 16, 2006

You'll have to read over DreamHost's documentation, but as far as I remember, you're required to use FastCGI in combination with Apache. You'll want to also set up a a cron task to restart the FastCGI processes so that your application actually works. DreamHost is a terrible Rails host.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply