gently caress that HTML poo poo, Haml is where it's at.quote:The most basic element of Haml is a shorthand for creating HTML tags: There's a shitload more, including this as prepending a document with the XHTML 1.1 Doctype: code:
|
|
# ¿ Aug 9, 2007 01:10 |
|
|
# ¿ Apr 29, 2024 07:25 |
leedo posted:...and replace it with another lovely templating language Okay, outside, right now, let's go I'm seriously addicted to Haml and Sass. It's almost as fast as ERB, looks beautiful, saves me typing (except for element attributes, but that's trivial), and is easier to read. Sass is genius - variables in CSS should have existed from the beginning. In any event, here are some other things I'm in love with: http://glu.ttono.us/articles/2006/12/19/tormenting-your-tests-with-heckle - Heckle - This testing utility mutilates your code to see if it will still pass its tests. If it does, there may be something you're not testing completely. It breaks on some things (like any code that sends conditions to the DB), but otherwise is awesome to watch. http://chneukirchen.org/blog/archive/2007/01/announcing-test-spec-0-3-a-bdd-interface-for-test-unit.html - test/spec Beautiful, simple-language tests. code:
code:
|
|
# ¿ Aug 9, 2007 01:41 |
enki42 posted:What the gently caress? This seems like a lovely and backwards way of doing things. Is it impossible to do any sort of static analysis in Ruby to get actual coverage instead of changing poo poo and waiting for it to break? You mean code coverage? Like rcov? And regarding Haml - you can use all HTML elements. Using semantically incorrect divs is the fault of the programmer.
|
|
# ¿ Aug 9, 2007 02:25 |
Mr. Wynand posted:Yes Rails is all sorts of <3 and puppies, but there are more then a few things about it that make you want to run up a wall in anger when you have to deal with them. You know what's fun? Migrating a database that halfway through used a plugin that isn't installed anymore.
|
|
# ¿ Aug 10, 2007 21:30 |
This isn't a Rails question, but a Ruby question. There's some code I want to use in a project, stuff I got off of RubyForge but didn't come in a gem or anything. What's the 'proper' way to put it in a project of mine? I'd imagine stuffing it all in a 'lib/', pushing that directory onto my load path, and requiring them would work - but what if those projects update? Just replace the files in lib?
|
|
# ¿ Aug 22, 2007 00:35 |
In C# I have the '??' operator, which when used like 'a ?? b', returns a unless it is a null object, in which case it returns b. Is there anything like that in Ruby? EDIT: Wow, ignore that. I was retarded. My original question still stands. HIERARCHY OF WEEDZ fucked around with this message at 00:27 on Aug 29, 2007 |
|
# ¿ Aug 28, 2007 23:55 |
freeb0rn posted:The or operator (||) in Ruby can work like this. Should have thought of that. Also, holy crap Hobo is a huge framework. The stack traces are twice as long and I haven't even started *coding* yet. I think this may be too much magic for what I'm trying to do.
|
|
# ¿ Aug 29, 2007 15:19 |
What's a good way to figure out which submit button on a form was clicked if all of them have the same name?
|
|
# ¿ Sep 1, 2007 05:33 |
I'm trying out Aptana+RadRails for a project, and I'm curious. autotest works fine when saving the actual models/views/controllers, but won't activate if I save a test file. Is there any way to get autotest to run a file in /test/ when it gets saved?
|
|
# ¿ Sep 3, 2007 22:06 |
And another question - how the hell do you deploy to a subdomain? I've tried installing Typo to blog.mysite.com. So I'd have something like ~/sites/blog.mysite.com/public symlinked to ~/public_html/blog and a subdomain created which points to that directory. First I had to figure out the trailing slash problem (the difference between mysite.com/blog/ and mysite.com/blog) but now that that's working, going to blog.mysite.com doesn't work at all. There's got to be a way to fix this without resorting to site-specific routing stuff, right?
|
|
# ¿ Sep 5, 2007 15:13 |
Grob posted:Chiming in to say that I'm quite experienced with Ruby and Rails after working with it full time for the last year, so I'll gladly answer any questions anyone might have. My host (Site5) is using Apache, but I'm not sure how much control I have over it. EDIT: Yeah, I can only edit .htaccesses. HIERARCHY OF WEEDZ fucked around with this message at 16:22 on Sep 5, 2007 |
|
# ¿ Sep 5, 2007 16:09 |
How would one deploy a common library to all sites on a server? I ask the question this way because I'm coming from ASP.NET, where if we updated something in a global utilities library, we could just copy the DLL to separate projects, or even better, import it server-wide. I'm guessing it has something to do with plugins and maybe using capistrano to update the plugins for each site in a special deployment, but beyond that I wouldn't have any ideas.
|
|
# ¿ Sep 7, 2007 19:14 |
Ambition is getting more awesome:quote:Ambition has gone from generating generic SQL to respecting your database of choice (as long as it’s MySQL or PostgreSQL). [...] And because Postgres supports case insensitive regular expressions, so do we: And some vague benchmarks: code:
|
|
# ¿ Sep 12, 2007 13:52 |
I am extremely slowly picking my way through deployment with Capistrano, and I've already hit a snag. The (really shittily sparse) manual tells you to create a Capfile for a project with `capify ~/project`. What I don't understand is, this creates a config/deploy.rb file in your project. But - Capistrano is supposed to be getting the latest project from Subversion. How come the deploy.rb is linked to a checkout of the pristine code? I'm sorry if I'm being difficult to understand - it just seems like there's a disconnect there. If you have a deployment system that's looking to checkout your code from source control and place it on a server, how come it's not completely removed from the code?
|
|
# ¿ Oct 2, 2007 02:39 |
Yossarian22 posted:You theoretically dont need to commit your deploy.rb file to your repo to get it to work. Cap deploy reads off your local copy so whatever is in your local deploy.rb file is what gets executed. Right. But what I'm asking is why is there a deploy.rb file at all? Why aren't the deployment instructions completely independent of whether or not there's a copy of the source code checked out?
|
|
# ¿ Oct 2, 2007 18:46 |
Grob posted:The way Capistrano works is that it tunnels through SSH and executes a series of instructions on a remote machine. It needs to be run FROM somewhere, usually on a development machine that has a copy of the source locally. What I'm trying to say is, why can't we have something along the lines of a deployments directory, that has deploy.rb's and subdirectories for all the applications we can deploy, which is completely unrelated to any local checked out copies of the source? For example, code:
|
|
# ¿ Oct 2, 2007 19:10 |
I have a rake task that is supposed to download and extract a '.zip' file. I'm running system commands, so something likecode:
Someone I spoke to suggested a permissions error, but I doubt I would get this message if it were a permissions error: quote:End-of-central-directory signature not found. Either this file is not Of course, that last line is also bullshit, since that's exactly where the archive is.
|
|
# ¿ Nov 1, 2007 01:51 |
Sharrow posted:
God, I cannot wait to start playing around with Rails 2.0. I just have to make it through finals week first This blog post from the Ruby on Rails blog shows a lot of the work that's been pushed into the newest release, and it all sounds really exciting.
|
|
# ¿ Dec 7, 2007 14:59 |
I'm trying to use curl to get a better feel for this REST stuff, but any action I attempt raises an InvalidAuthenticityToken exception. I imagine I need to have some kind of session ID, but I don't know how I'd generate that from curl. Any ideas?
|
|
# ¿ Dec 23, 2007 02:44 |
SpaceNinja posted:This may seem like a stupid question, but how do I correctly configure database.yml? I am giving RoR development under Windows a shot, and previously I recall that the only bit of configuration I had to do was set my password to access MySQL. Now all I get is this as the default: Call rails with '-d mysql' now. I think this is a bug, because just calling rails says that mysql is the default database, but we're ending up with a sqlite configuration.
|
|
# ¿ Dec 23, 2007 20:55 |
Thoom posted:Not a bug, it's the new default, mainly because it's easier to set up. Also, sqlite3 is installed by default on Mac OS X, which a whole lot of rails developers use. Then there's a bug in the documentation: code:
|
|
# ¿ Dec 23, 2007 23:59 |
Hop Pocket posted:ferret Here's a question. No matter what gems and plugins I install, script/ferret_server never shows up for me. Instead I have to use vendor/plugins/acts_as_ferret/ferret_server. Where did that executable come from for you?
|
|
# ¿ Jan 8, 2008 18:16 |
Okay, Site5 loving sucks. What's the latest round of suggestions for a Rails/Ruby framework friendly host -- and what's the score on hosting providers picking up on Phusion Passenger aka mod_rails? Damnit going to have to move all my sites again grumble grumble
|
|
# ¿ Jun 25, 2008 19:09 |
Okay, so since apparently no one is actually deploying Rails projects, I have another question Say we have a User model, and a Recipe model, and Recipe belongs_to a User. If I want to retrieve the number of recipes a user has, I can do something like Recipe.count( :conditions => [ 'recipe_user = ?', user_id], :include => :user), but what if I wanted to cache that number, so it wasn't calculated every time I had a list of thousands of users? Should I just add another table column and run a rake task every 30 minutes or so that re-calculates and UPDATEs that column for the Users table? Or is there a more sensible way of dealing with this? EDIT: Oh hey, counter_cache. Hooray! See here for details if you have the same question: http://railscasts.com/episodes/23
|
|
# ¿ Jun 29, 2008 17:19 |
Grob posted:No, some of us have Rails projects in production. Forumwarz, my MMO, is deployed on a dedicated host. Well, that's the thing. I don't have *any* projects because I don't trust myself to do deployments, and I don't do any deployments because I don't have sufficient hosting, and I don't feel it's necessary to pay out the rear end for hosting on projects that for all intents and purposes aren't valid public projects, but just me playing around with the framework. So it's a conundrum.
|
|
# ¿ Jun 30, 2008 15:13 |
jonnii posted:Capistrano makes deployment pretty easy. In my case I have an nginx frontend proxying to thin instances. I use god to keep the memory usage in check and backgroundrb running. That's what I've heard, but I haven't had a chance to actually try it. That's what I'm asking. Where are people deploying their projects? Their one-off, unimportant stuff? I'm not shelling out 400 dollars a month for an Engine Yard slice. I'm still in college, you know?
|
|
# ¿ Jun 30, 2008 15:54 |
Oooh, a VM image is a good idea. But Slicehost is looking pretty tempting. I don't want to just run Rails apps, since I'm a Merb and Camping guy, too. I have a feeling I'll get plenty of mileage out of a VPN.
|
|
# ¿ Jun 30, 2008 16:42 |
I'm trying to throw OpenID at Sinatra, and goddamn is it annoying. The documentation comes with no examples -- which I half feel is an appropriate way to approach the subject, since it's important to understand all of the steps you're going through -- but on top of that, the library is written in a Ruby-esque way... or even at all sometimes.code:
|
|
# ¿ Jul 31, 2008 15:01 |
So what's the buzz on Sequel? It looks really awesome but I don't hear any news about people using it in any projects.
|
|
# ¿ Aug 6, 2008 02:57 |
Pardot posted:I think datamapper is drawing most of the non-active record users. Of course, non-ar isn't exclusive, but sequel really seems like the 3rd party candidate. That's bizarre; I've never found DataMapper to be that great, and the new syntax they've introduced for most of their instantisation stuff bugs the hell out of me. In addition, while the community is helpful, their documentation is really sparse. Ah well. Maybe I'll write about using both in a project soon.
|
|
# ¿ Aug 6, 2008 14:43 |
bitprophet posted:What do you mean by "completing"? And I don't think I've ever seen an Apache reload or restart take longer than perhaps five seconds; are you saying it takes Passenger 30 seconds to actually spool up its Ruby processes? Based on my experience, this is essentially accurate. It also takes about 30 seconds to hit a site after something like 2 minutes of no one accessing it. Phusion Passenger is absurdly slow and no amount of tinkering with the configuration seems to be able to ameliorate it.
|
|
# ¿ Nov 19, 2008 16:25 |
bitprophet posted:What kind of site are you running with it? The one I've been updating (which isn't terribly efficient either, and is Rails 1.2-based) loads pretty quickly after e.g. /etc/init.d/apache2 restart. Rack-based Sinatra. No more than 300 lines of code, and nothing to warrant the spool-up times that I was getting. I switched to Lighttpd proxying out to Thin and now site loading is near instantaneous.
|
|
# ¿ Nov 20, 2008 16:26 |
Is anyone using edge Rails and the latest featureset that Rails provides consistently? I stopped using Rails about a year ago and focused on microframeworks like Sinatra, and I'm wondering if there's anything really amazing that I'm missing that the switch to Rails may be worth it again. Any awesome plugins, etc...
|
|
# ¿ Jan 10, 2009 13:46 |
NotShadowStar posted:The Rails team is doing a big bug smash push this weekend. Lots of help needed! I can't wait to see the results of this. I love it when good software gets better in leaps and bounds because of the community's passion. Wish I had the chops to contribute.
|
|
# ¿ Jul 31, 2009 23:12 |
What's the cleanest way to represent this idea? I have a model, and different links to different actions on different controllers related to that model. It's not very RESTful, I'm afraid, but that's not the priority of the project; however it means I can't use the nice automagic RESTful URL helpers There are two conditions, an initial condition and a secondary condition. So if the initial condition is true, I don't want to return a link at all. If the initial condition is false, and the secondary condition is true, then I want to return a hyperlink with text "Create Foo" and a link to FoosController#new. If the initial condition is false, and the secondary condition is false, then I want to return a hyperlink with text "Edit Foo" and a link to FoosController#edit. Right now I have something like this in the model: code:
|
|
# ¿ Sep 22, 2009 17:20 |
I know it violates MVC, that's why I was asking. All I'm trying to do is have a list of links, each one with subtly different logic for when they should show up on a page. I finally decided upon this in the view, which I can tear out into a partial if it turns out it needs to be duplicated:code:
|
|
# ¿ Sep 22, 2009 19:52 |
My example wasn't perfectly analogous. It would be to create a new Foo based on the condition of an existing Bar.
|
|
# ¿ Sep 23, 2009 14:27 |
|
|
# ¿ Apr 29, 2024 07:25 |
bitprophet posted:Oh good, screencasts. Uhh, if you had gone to any of the Railscasts pages, you would see that every one has a complete transcript located on ASCIIcasts: http://asciicasts.com/episodes/209-introducing-devise
|
|
# ¿ Jan 21, 2011 14:38 |