|
shopvac4christ posted:gently caress that HTML poo poo, Haml is where it's at. Haml is awesome. We use it at my company and it's just great. I wish we could use sass too, but our designers need to make changes to the css often and don't understand it
|
# ¿ Aug 11, 2007 07:14 |
|
|
# ¿ May 4, 2024 01:55 |
|
Space Kimchi posted:Also a lot of the AJAX stuff is nice but good lord is it black magic. Start with using the rjs templates and what not. Then start to actually learn Javascript and Prototype. I'm on the second step currently, and while I might not be the best javascript guy, I know what's going on and it doesn't feel like black magic anymore. And if you ever are wondering why something works the way it does in rails, start reading the rails source code. It's not that scary, I promise.
|
# ¿ Aug 30, 2007 02:32 |
|
Space Kimchi posted:Oh god MVC I don't think making it a helper is the right thing to do. This either wants to be its own class which would live in app/models (if you wanted to be all restful about it) or a class in lib.
|
# ¿ Aug 30, 2007 11:30 |
|
How about some sort of digest (md5 or sha2 or whatever) of their email address and some random salt you store with the address?
|
# ¿ Oct 31, 2007 06:57 |
|
Trabisnikof posted:That's what I use for a similar requirement. If you're worried even in the slightest, just store a new random salt for each email address. That would prevent any sort of rainbow tables and isn't hard to do at all.
|
# ¿ Nov 10, 2007 05:16 |
|
Trabisnikof posted:Actually, that is a good idea. Although, isn't that still weak to Rainbow Tables, just each hash requires a new lookup? I may not have my concept of Rainbow Tables right though. No, they would have to make a new rainbow table for each salt, which makes the whole reason to make a rainbow table worthless.
|
# ¿ Nov 10, 2007 08:48 |
|
Also keep in mind that even when you get this working, it's really not the best way of going about it. Every time they click the show/hide button, they are being sent to the server to get the 1 line of javascript to do the show or hide. This should be done as an inline js function, allong the lines of:code:
Pardot fucked around with this message at 21:25 on Nov 18, 2007 |
# ¿ Nov 18, 2007 21:22 |
|
zigb posted:Apache/FastCGI/RoR Is there a reason you're not using mongrel?
|
# ¿ Nov 20, 2007 14:59 |
|
poemdexter posted:I'm still new to both Ruby and the Rails gem. I would really recommend using edge rails over gem rails. You get to take advantage of all of the new improvements and such. And rails 2 is due out soon anyway. My favorite way to do it is to check the trunk out into your own repo using piston. It's a lot nicer than svn externals.
|
# ¿ Dec 4, 2007 09:43 |
|
MrSaturn posted:classic_pagination Instead of that, which was taken out for a reason, give this on a try will_paginate: http://errtheblog.com/posts/47-i-will-paginate http://errtheblog.com/posts/56-im-paginating-again just do piston import svn co svn://errtheblog.com/svn/plugins/will_paginate vendor/plugins and try it out. If you don't like it then go back to classic. Piston, assuming that you're keeping your stuff in a svn repo. edit: here's a screencast on it: http://railscasts.com/episodes/51 Pardot fucked around with this message at 07:49 on Dec 24, 2007 |
# ¿ Dec 23, 2007 08:06 |
|
Keep in mind that 1.9 is a development release, not intended for production. Check out Ruby 1.9 right for you? On the issue of VMs, there are a few alternate ruby VMs being worked on http://rubini.us/ - talk at rubyconf http://jruby.codehaus.org/ http://www.ironruby.net/ They're all a little rough around the edges, from what I hear. I admittedly haven't tried any of them. However, rubinius seems the coolest, as it tries to be written in ruby itself as much as possible.
|
# ¿ Dec 26, 2007 08:20 |
|
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 |
|
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 |
|
I've used acts_as_solr before. What's the difference between ferret ad acts_as_solr? They both use lucene if I'm not mistaken.MrSaturn posted:horay =/ code:
edit: They don't let you install gems? Pardot fucked around with this message at 06:38 on Jan 9, 2008 |
# ¿ Jan 8, 2008 22:02 |
|
There was mention of Active Couch, which is an active record wrapper for couchdb on the rails envy podcast today. I haven't used it myself, but it could be worth looking at.
|
# ¿ Jan 31, 2008 04:29 |
|
Registration for railsconf just opened up the other day. http://www.railsconf.com/quote:The content this year will also take a step up in terms of experience required for many sessions. Less “I’m just getting started, how does it work?” and more “I’ve been doing this for a while, how can I become better?”.
|
# ¿ Jan 31, 2008 16:31 |
|
For those of you who rSpec, is there a good way to set expectations on #initialize? I was doing this, but it seems dirty:code:
evildoer posted:Is there a method to move up just one directory in Ruby? I'm not sure what exactly you want to do, but look at FileUtils maybe? Also if you're using ruby to do command line stuff, you should look at making Rakefiles.
|
# ¿ Feb 25, 2008 00:53 |
|
Oh, I like that idea. I'll have to keep that in mind. My class actually is an importer that uses some api. I was setting up an api connection in initialize, but I've since refactored it so that there's a method that makes the api connection only if there isn't already one. Then each method that needs a connection calls ensure_connection. It also works well because I can stub that method so it doesn't actually go out and make the connection.
|
# ¿ Feb 25, 2008 01:58 |
|
Hop Pocket posted:Hooray for hourly backups Are you not using source control?
|
# ¿ Mar 6, 2008 10:38 |
|
In case some of you missed this, there's a new version of rubygems, 1.1.0, out. It's supposed to be much faster at indexing, but I haven't had a chance to test it out yet. Just run sudo gem update --system to get it. http://blog.segment7.net/articles/2008/03/29/rubygems-1-1-0
|
# ¿ Mar 29, 2008 19:33 |
|
Hop Pocket posted:I'm on leopard, and I had to run You know, I read some blog comment that someone else had to do this too, but I just did clean install of leopard on my macbook and the regular gem update --system worked fine. That was using the ruby that came with it, not macports or anything. I wonder what causes the difference.
|
# ¿ Mar 30, 2008 09:10 |
|
The new timestamp migrations in edge rails is cool and solves the problem of two people checking migrations with the same number (though you should update your copy before checking in and notice this anyway ). It might solve my biggest issue with migrations, too but I'm not sure -- I'd have to try it out. It's when you branch for a release and continue working on trunk, and then have to fix something on your branch right away that involves a migration. What I've done before with that is to flatten the migrations down to a single migration before the branch, then skip several numbers for the next trunk migration. Ugly. The other awesome edge rails thing is the gem dependancies. You specify what gems you need in environment.rb rake gems:install - installs all the gems your app needs rake gems:unpack - vendors all the gems
|
# ¿ Apr 3, 2008 20:35 |
|
You don't need to use counter variables anymore, or define arrays, or use while loops or for loops anymore now that you've entered the magical world of ruby! Here's a quick refactoring of your code. I don't really like how you were using regexes to generate the account name, but I didn't want to figure out a different way to do it. http://pastie.org/185316 I put it in as a picture for the syntax highlighting, to see how I'd like it. I think it works well for short-to-medium length stuff like this.
|
# ¿ Apr 23, 2008 07:04 |
|
Sewer Adventure posted:Is session data stored in the cookie by default? Is that why there is a 4kb limit? Yes and yes. Cookie based sessions were made the default in revision 6184 back in February 2007. r6184 posted:Introduce a cookie-based session store as the Rails default. Sessions typically contain at most a user_id and flash message; both fit within the 4K cookie size limit. A secure hash is included with the cookie to ensure data integrity (a user cannot alter his user_id without knowing the secret key included in the hash). If you have more than 4K of session data or don't want your data to be visible to the user, pick another session store. Cookie-based sessions are dramatically faster than the alternatives. What are you doing that needs more that 4k for the session? Typically you shouldn't store entire objects in the session. Rather, store the id, and then do Model.find session[:whatever].
|
# ¿ Apr 24, 2008 09:15 |
|
You may also want to take a look at the Complex Rails Forms series at railscasts. http://railscasts.com/episodes/73 http://railscasts.com/episodes/74 http://railscasts.com/episodes/75
|
# ¿ May 2, 2008 06:46 |
|
dustgun posted:This is more of a general ruby question, but how the hell do I unpack a utf8 string in ruby 1.8 and get it so that \xC2\xAE actually shows up as ® in the output? I've never really done this stuff, and feel sort of lost googling around. This may work for you: code:
Pardot fucked around with this message at 01:32 on May 26, 2008 |
# ¿ May 26, 2008 01:30 |
|
Anyone going to be at railsconf?
|
# ¿ May 28, 2008 15:28 |
|
Cylon Dinner Party posted:Thanks! You came through where my google fu failed. Please accept my apologies, if the Rails thread is not meant to double as Ruby Stupid Questions. I mentioned this in the merb thread too, but I think a general ruby megathread would be better. I'm sure the tread would be just like this one, mostly rails but some random ruby stuff. Maybe we should just get the name of this thread changed.
|
# ¿ Jun 4, 2008 02:00 |
|
unleash the unicorn posted:So I've been playing around with Ruby lately, did all the Lucky Stiff stuff and so on, and now that that's been going great I was wondering whether it's possible to make something I created with Shoes into a "real" .exe-File. I could be wrong, but I don't think you can do that with something like shoes. I think the best you can do is do something in jruby and package that into bytecode. I haven't looked into any of this myself, but I think there is at least one jruby UI thing. This is all just vague recollections from my rss feeds, though.
|
# ¿ Jun 17, 2008 22:08 |
|
Oh no! It all works fine on iMacs at work – no spec failures or this out of memory stuff, but my poor old macbook just can't handle it. Probably an issue with my ruby or something, but who knows. It's kinda funny just how bad it broke.
|
# ¿ Jul 4, 2008 08:03 |
|
I don't think that's all of the specs, because it blew up. There are a few old tests too that are slowly being moved into tests. On the dev machines, the tests+specs take about 5-6 minutes I think. That defiantly needs to be sped up. There are also about 15 min worth of selenium tests, but usually you just let the ci box run those, except for the ones you know you're hitting. The ci box is an old mac mini, and poor thing takes like 50 min to run through the specs, tests, selenium, and javascript tests. Why so many? It's a very large and complicated app. We have something like 10k lines of code and 35k of tests, though I don't think rake stats counts some of the stuff. Some could argue that it's overkill, but it just happens that way because of BDD.
|
# ¿ Jul 4, 2008 20:04 |
|
Mr. Wynand in the linked post posted:One thing that (IMO) causes a lot of confusion (in a general sense) is how .errors[:whatever] can sometimes return an array of strings, and sometimes just the string. NOTHING ELSE EVER DOES THIS IN RUBY. EVER Spot on. I hope this gets merged in. I came across a thing with AR's sql generation that I may write a patch for. I wasn't sure it'd be worth it, but if you say there'll be blowjobs, than it just might be!
|
# ¿ Jul 9, 2008 08:24 |
|
Tziko posted:Just a heads-up: Rails-doc 2.0 was released today. The update includes multiple improvements, including documentation for the different versions of Rails. Hopefully it'll shape up to be the php.net of Rails... Hooray, I asked them for hi res icons to use with Fluid, and they did http://rails-doc.org/about
|
# ¿ Jul 18, 2008 18:46 |
|
bitprophet posted:Does Ruby have a pretty-print module of any kind? yes code:
Pardot fucked around with this message at 02:12 on Jul 21, 2008 |
# ¿ Jul 21, 2008 02:04 |
|
Nolgthorn posted:Making plugins is hard, would something this complex be better as a generator? Would that be any easier or more useful than having it as a plugin? Having plugins that have views and stuff is hard in rails. There is something called plugin engines that do that, but it got some hate in 2006 from dhh, and I'm not sure what the current state of the project is. Generators could work, it really depends on how complex what you're adding is going to be. It seems like it would be a pain. Merb has something called --- This has more or less become the ruby megathread. What do people think of getting the title renamed? Pardot fucked around with this message at 04:27 on Jul 24, 2008 |
# ¿ Jul 23, 2008 00:06 |
|
Yeah, I never promsied it'd be pretty Keep us updated on what you decide.Carabus posted:Wow thanks, I wasn't expecting that. And it's easy to follow. http://www.ruby-doc.org/core/classes/Enumerable.html – Learn all the stuff enumerable buys you. This mixin has all of my favorite ruby methods, by far.
|
# ¿ Jul 23, 2008 07:13 |
|
B1axident posted:Not sure if this is the best place to ask, but I can't search for a Merb thread! There was actually a merb thread a while back, but this thread is fine. The main site is at http://merbivore.com/ and that gives you instructions on getting it. If you'd rather go edge than gem merb, you want to pull from wycats branch. Merb is a bit different, in that the only thing you actually need is core. You'll want to get more and some plugins, but you don't need them, necessarily. A good site for learning that came up recently is http://merbunity.com/. The irc channel is good too. There are a few people using merb here, so this thread could probably answer some questions. Also check out datamapper.
|
# ¿ Jul 26, 2008 19:16 |
|
What you're going for is a named route. Try map.login '/login', :controller => 'users', :action => 'login' However having a login method on UsersController isn't RESTful. It's common to have a sessions controller, and new gives a login form, create makes a session (logs in), and destroy logs out. --- edit: We had a really weird problem yesterday. We upgraded rails to 2.1 and rspec to 1.1.4. There are 3 tables that have plural names and plural models, and so the fixture files are plural too. Now any spec that had fixtures :all, rails would go looking for all of the classes based on the fixture file names to load them. It couldn't find these three because of the break in the naming convention. There is set_fixture_class on Test::Unit::TestCase which the rspec example inherit from, but this happens before that comes up. The problem is that we have a huge number of specs, and to run a full suite, it would look for these 3 classes, 18 times per file, causing it to just print stack traces to the log for almost 2 minutes before running the specs. The specs ran fine, because the fixtures in question are just empty files to get rails to clear those tables in integration tests (which is a whole other reason why fixtures suck...). The solution? Dependencies.loaded << "#{RAILS_ROOT}/class_name_without_an_s" in spec_helper to trick rails into thinking that it was already loaded, and that it didn't need to go looking for the nonexistent file. Pardot fucked around with this message at 19:26 on Aug 2, 2008 |
# ¿ Aug 2, 2008 19:16 |
|
wunderbread384 posted:It's stupid, but one of the many downsides to Rails being "opinionated software" is when their opinion is wrong. You have to admit though, that there are also a ton of benefits to opinionated code. Like not having pages and pages of configuration files and getting methods thrown in because you name things a certain way, and so on.
|
# ¿ Aug 5, 2008 05:31 |
|
|
# ¿ May 4, 2024 01:55 |
|
Panic! at the Fist Jab posted: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. 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.
|
# ¿ Aug 6, 2008 04:40 |