|
Heffer posted:Is there an api for the map object and what functions I can call on it? 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. skidooer fucked around with this message at 22:46 on Dec 28, 2007 |
# ? Dec 28, 2007 22:35 |
|
|
# ? May 15, 2024 03:26 |
|
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). 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:
|
# ? Dec 28, 2007 23:38 |
|
Heffer posted:It doesnt seem to be spelled out what actions it looks for or what paths it creates.
|
# ? Dec 29, 2007 00:02 |
|
I seem to have broken something :P I upgraded ruby to 1.8.6 on the Solaris instance our site is deployed on:code:
code:
code:
|
# ? Dec 29, 2007 13:18 |
|
Hop Pocket posted:
Reinstaling the MySQL gem could be worth a shot.
|
# ? Dec 29, 2007 17:50 |
|
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.
|
# ? Dec 29, 2007 20:52 |
|
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 |
|
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. Good idea. I was able to turn the MySQL log on, and found that the commands are executing on the backend. code:
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?
|
# ? Dec 30, 2007 13:43 |
|
SeventySeven posted:What's the quickest way I can get tagging support back without loving with my app too much?
|
# ? Dec 30, 2007 17:47 |
|
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.
|
# ? Dec 30, 2007 18:40 |
|
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:
Hop Pocket fucked around with this message at 19:40 on Dec 30, 2007 |
# ? Dec 30, 2007 19:13 |
|
Hop Pocket posted:ERROR: While executing gem ... (ArgumentError) That doesn't look like a proper path. note the '//' after /opt/csw/
|
# ? Dec 31, 2007 04:39 |
|
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.
|
# ? Dec 31, 2007 14:29 |
|
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.
|
# ? Dec 31, 2007 14:40 |
|
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 |
|
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.
|
# ? Jan 3, 2008 08:10 |
|
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? SeventySeven posted:Or what if you need to make large scale changes like I do? SeventySeven posted:I guess how I can see it would make an environment with several devs easier.
|
# ? Jan 3, 2008 09:26 |
|
Someone pissed in Zed Shaw's cheerios http://www.zedshaw.com/rants/rails_is_a_ghetto.html Fun read
|
# ? Jan 3, 2008 23:25 |
|
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!
|
# ? Jan 3, 2008 23:51 |
|
bmoyles posted:Someone pissed in Zed Shaw's cheerios lord, what the devil is he on about? poor guy, lovely people ruined something that could have done him well, it looks like.
|
# ? Jan 3, 2008 23:56 |
|
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.
|
# ? Jan 4, 2008 03:10 |
|
bmoyles posted:Someone pissed in Zed Shaw's cheerios "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 |
# ? Jan 4, 2008 11:19 |
|
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:
code:
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 |
# ? Jan 4, 2008 14:40 |
|
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.
|
# ? Jan 4, 2008 18:57 |
|
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 |
# ? Jan 4, 2008 20:03 |
|
atastypie posted:Two quick questions: I like ControllerName#Action myself. Like SessionsController#create. It's kind of standard notation for describing an instance method of a class or module.
|
# ? Jan 4, 2008 23:07 |
|
El Cheeseman posted:Apparently just after I posted this code, it started to work fine. 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? 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. 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 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 |
# ? Jan 5, 2008 03:02 |
|
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 |
|
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 |
# ? Jan 5, 2008 11:46 |
|
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 |
|
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).
|
# ? Jan 5, 2008 12:37 |
|
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 |
|
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.
|
# ? Jan 5, 2008 15:18 |
|
SeventySeven posted:Is there an easy way to test ActionMailer or am I going to have to wait until this hits the production server? If you want to actually deliver the message: code:
|
# ? Jan 5, 2008 20:34 |
|
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.
|
# ? Jan 5, 2008 21:48 |
|
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).
|
# ? Jan 5, 2008 22:49 |
|
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 |
# ? Jan 6, 2008 07:44 |
|
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:
code:
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:
code:
Hop Pocket fucked around with this message at 14:08 on Jan 8, 2008 |
# ? Jan 7, 2008 22:45 |
|
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())
|
# ? Jan 8, 2008 14:33 |
|
|
# ? May 15, 2024 03:26 |
|
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.
|
# ? Jan 8, 2008 14:38 |