|
What's great about Coffescript, and what's wrong with Haml, such that the former is going to be the default in Rails 3.1, while the latter is not?
|
# ¿ Apr 23, 2011 02:27 |
|
|
# ¿ Apr 29, 2024 02:43 |
|
Jeez, if you aren't going to learn to write in multiple languages with confusingly distinct syntaxes implemented in crucially differing standards, why not just make a robot and have the robot write the website?
|
# ¿ Apr 25, 2011 01:25 |
|
It seems like a nice problem to have.
|
# ¿ Jun 18, 2011 07:52 |
|
I don't know about everywhere else, but here in SF, Rails seems like the hottest poo poo ever shat. ("poo poo" not intended as a pejorative)
|
# ¿ Jun 28, 2011 01:28 |
|
I found Pragmatic's Programming Ruby 1.9 to be very good at teaching the language from end-to-end, including gem distribution, project structure (the book taught me /bin and /lib ), which a lot of language books seem to assume the reader to already know. A CS degree is like an Architecture degree: you don't technically need one in order to work on houses....no, wait, that's not right. Okay, being a computer scientist is like being an architect, and being a developer is like being a building contractor: there's a fair amount of overlap between the jobs, and one is more abstract than the other, but they aren't exactly the same thing, and building houses is a business you can join without any specialized schooling at all, as long as you can self-teach and spend plenty of time practicing the craft (hopefully because you enjoy it). Anyway, you can always just read Structure and Interpretation of Computer Programs off MIT's OpenCourseWare site and know more CS-stuff than 90% of developers.
|
# ¿ Jun 28, 2011 04:57 |
|
Any of you fine folks doing something for the Rails 3.1 Hackfest next week?
|
# ¿ Jul 17, 2011 01:46 |
|
8ender posted:Any idea if 3.1 is going to be dramatically different than 3.0? I'm in the same boat and just to see how bad things were I upgraded one of our 2.3.11 apps yesterday and it was oddly painless. I think I changed one or two lines of code but everything just worked. I was kind of expecting apocalyptic app failure across the board but it doesn't look like all that much changed in the core MVC parts of rails. I've heard horror stories, but in direct experience, it seems surprisingly backwards-compatible. I guess my apps just weren't sophisticated enough to break.
|
# ¿ Jul 17, 2011 23:48 |
|
A MIRACLE posted:Doing a project in rails for work. I have all these .ind files in a tmp directory, do those need to be in version control? .ind files as in, InDesign? I'm not familiar with the program, but if it outputs html and css, then those are the files that should definitely be checked in. I'd ask your work if they want to save the project files that way as well. quote:My office uses SVN Should I be using git instead? I'd say yes, but then, I'm an ideologue. Read up on git-svn and choose for yourself.
|
# ¿ Aug 5, 2011 01:01 |
|
Are there any good resources, free or otherwise, on making internal DSLs?
|
# ¿ Aug 22, 2011 02:33 |
|
NotShadowStar posted:we need to know what you're doing. Well, at the risk of being outed as one of those "nerd" people: http://www.github.com/njay/tabletop It's one of those pointlessly ambitious geek proects: make it easier for people to make software tools for or versions of "pen and paper" games by making a DSL for them. Teach Yourself Ruby the Hard and Uncool Way. There's a lot more I want to do, but I thought that a survey of resources about the field might help me make decisions about what sort of things I should want to do.
|
# ¿ Aug 22, 2011 22:14 |
|
BonzoESC posted:Your die language is scrub-tier: That's...really cool. I like how terse it is, but I'm hoping to make something that's as natural-language as I can. The hope is that anyone who makes (or just likes) an RPG could figure out how to describe its rules and procedures with just a commands cheat-sheet and a few minutes thought. For that kind of purpose, I think that "drop_lowest" is kinder than "v". And also I need them to be able to do stuff like "tell me how many dice came up seven or higher, counting tens twice" or "count sets of die values, multiply the size of the largest set by ten, then add the value of the dice in that set" without needing to learn regular expressions. The results object extending Int is an inspired idea. I thought about making a separate results object for a while, but it seemed like there was too much state to track: you only really know when it's stopped being a "roll" and started being a "result" when the player stops interacting with it, so I just piled everything into the Roll class. If there's no good short-cuts to understanding, I will soldier on.
|
# ¿ Aug 23, 2011 06:49 |
|
Yeah, that's basically what I've done so far. BDD 4 lyffe. I guess was hoping there were articles that could give me some tips like "Be sure to consider factor X, which might not occur to you until you've wasted a lot of time doing something dumb!" But all I found was an article explaining how to use instance_eval to avoid "do |o| o.stuff end" syntax. I think I need to bring in some other stakeholders. Maybe I'll be able to harass some folks at PAX into doing a focus group.
|
# ¿ Aug 23, 2011 17:57 |
|
Newbsylberry posted:The tutorial has you write different tests, etc. I am thinking of scrapping that aspect of it completely though. It's been incredibly frustrating getting it all to work. That's a shame. I'm not sure what tutorial you're using, so maybe it's a bad one, but I'm going to go ahead and be dogmatic: writing automated tests, preferably before you write anything else, is one of the most important aspects of web development. It's vital, but it shouldn't be that frustrating: I think something's wrong. quote:The stylesheets issue aside, for a while it was giving me errors incorrectly (like it would say my title wasn't "websitename | title" even though checking the rails server verified that it was), so I had to adjust all the versions I was using in my gem file to get it to pass. Okay, it sounds like you had trouble with a view/integration spec. I'll back off my dogmatism for a second: testing views gets you the worst return for your time investment of all the kinds of testing. I still do it, but I try to not be over-specific. For example, I might test that /projects/1 has a title that contains the project name, using a regex and ".should =~" rather than ".should ==". But that said, I don't know what your gemspec (e: by which of course I mean your gemfile) has to do with page titles. What do you mean by that? quote:Then rake db:migrate wasn't working, because of the version of RSPEC I was using. So it appears that if I'd like to use rake then I won't be able to have accurate testing. Was this the "expected rake 0.9.2" bug, or something else? The rspec-rails gem uses rake extensively, so they definitely do work together. quote:I had an idea for a website a while back and decided to learn how to make it. I think it's a good skill to be able to put on your resume, and I've really enjoyed the process so far. As I get farther and farther along, I realize that to be able to put out a finished product alone I'll need to learn design stuff as well. If I'm going to learn one of the markup and styling languages, which works best with ruby? From what I understand xhtml is the future, would that be best? Well, you'll definitely benefit from understanding html markup, conventions and best practices. But since we're talking about dynamic applications ITT, your real choice is between template languages which generate (x)html. The default Rails templating language is called ERB, and is basically html pages with special dynamic tags that say things like "print the current user here" or "do this next part once for every item in this list" or "only show this next part when the moon is full". HAML is the new hotness in templates (today, at least), so you could look into that, but I recommend that you defer learning fancy new things that you don't absolutely have to. Just thinking of my own experience, it's possible to overwhelm yourself if you try to use every fancy new great thing. "Learning Rails" is a multifarious and continuous process towards a rapidly moving target, so it's fine to give yourself to a series of bite-size goals. quote:one more question: If I skip testing for the tutorial, is there a book/online guide that can help teach me when to use/how to use testing? I'm halfway through Pragmatic's "Rails Test Prescriptions," and I'm liking it. I also highly recommend their "The RSpec Book" (much of which is about Rails). Doc Hawkins fucked around with this message at 00:41 on Nov 9, 2011 |
# ¿ Nov 8, 2011 21:15 |
|
Newbsylberry posted:Luckily I realized I could simply run a spec file with RSPEC and so just because some of my tests aren't giving me accurate results doesn't mean I have to scrap the whole thing. Correct me if I'm misunderstanding the situation: You can alter the version requirements in your gemfile, and then run `bundle install`, and no errors are reported, but some tests are provably false. Alternately, you change the version matchers to something else, and run bundle install again, and the tests start working right, but then you can't run any rake tasks. If that's all accurate, then I would like to see:
This is the paid course at railstutorial.org, right? I am in no way trying to shoo you off, but have you tried to contact the author as well? I hope he'd be able to help you with his own guide... quote:I think the biggest issue is that I am following a guide, and not fully understanding why it's saying to do what it does. ...but this does not bode well for that hope. Rails is a big stack, like I said, but a truly good end-to-end introduction shouldn't leave you at sea. Have you programmed any Ruby separately from Rails? quote:Maybe it's because the book starts with static pages, but the impression I've gotten is that I'll need to know html and css to deal with the aesthetics of the page. It would be nice if I didn't have to worry about it at all. My perspective as a grungy back-end guy is that design is really tough: it's something that some people are born with a talent for, which they hone with years of experience, and when I want my sites to look nice, I need to just hire one of those people.
|
# ¿ Nov 9, 2011 00:08 |
|
You'll want to install RVM first, before rubygems. See if that helps. In an odd coincidence, lately I've been contributing to a set of instructions for that kind of thing. If you have any problems with the Ubuntu section (besides it not giving working urls for the rubygems packages for 8.04 and 8.10), please let me know: we're going to walk a ton of people through this on Friday, and I want to get out in front of any mistakes or unclear bits.
|
# ¿ Nov 16, 2011 23:19 |
|
When you recommend it, what do you list as its advantages?
|
# ¿ Dec 30, 2011 04:18 |
|
Most important question: how do you pronounce it? (I'm partial to "ruh-BENV")
|
# ¿ Dec 30, 2011 04:50 |
|
I'm so there.
|
# ¿ Jan 3, 2012 21:34 |
|
Assuming I'm writing my own tasks, is there anything Rake can do that Thor can't?
|
# ¿ Jan 4, 2012 06:52 |
|
Is there some way to not need code:
|
# ¿ Jan 7, 2012 05:56 |
|
BonzoESC posted:Thor's gemspec declares that it wants its lib added to the load path: https://github.com/wycats/thor/blob/master/thor.gemspec#L21 Yeah, I've got that in mine, too.
|
# ¿ Jan 7, 2012 21:28 |
|
prom candy posted:Do you guys use postgre in production as well or just for development? When people say "use postgres in development," it's short for "use exactly the same environment in development as in production, by the way use postgres."
|
# ¿ Feb 28, 2012 00:30 |
|
I think you are. Unit testing seems relatively popular in Ruby development. Ruby has two unit testing frameworks built into the standard library (well, one and a half), and there's a handful of others that people use. All you have to do as far as dynamism is test behaviors rather than identities: expect a returned object to respond to some methods, rather than have the class MethodResponder or whatever. Also, tell me isn't a real example: quote:use Ruby on Rails on Cake PHP on Gentoo Linux
|
# ¿ Feb 28, 2012 21:08 |
|
Doc Hawkins posted:"use exactly the same environment in development as in production, by the way use postgres."
|
# ¿ Feb 28, 2012 22:08 |
|
Physical posted:MySQL is sweet and no real business is going to use postgres (right)? Please don't troll. Physical posted:Even in my development environment I want it to be as close to production as possible, and that means using the respective database type. I thought this was the norm. It is. That's why we're talking about installing postgres locally. But maybe you misunderstand: you're supposed to choose the database based on what you want to have in production, then install the same one in dev, not the other way around. Doc Hawkins fucked around with this message at 15:53 on Mar 30, 2012 |
# ¿ Mar 30, 2012 15:49 |
|
Physical posted:I'm not trolling. I said (right?) to ask for confirmation but I guess me not knowing everything there is infuriates you to the point that I must be trolling. "Infuriate" is a very strong word. quote:I actually think you misunderstand because that is exactly what I said. Suffice to say, there are reasons to prefer Postgres to MySQL, but if you've never run into or heard of them, then I guess there's no reason to change.
|
# ¿ Mar 30, 2012 17:43 |
|
prom candy posted:If you want a list of methods on an object you can just write <your obj>.methods but it bubbles all the way up to the Object object, so you get a lot of methods that you don't care about. code:
|
# ¿ Apr 3, 2012 17:19 |
|
The question of whether to teach people Rails first and then how to TDD it, or to teach it all at the same time, seems destined to be a perennial one. Today, I'm leaning towards the latter, including acceptance tests of the sort that cucumber is used for, but I don't necessarily recommend cucumber itself: for rails I mostly make request specs using rspec and capybara. And recently I've heard of turnip, an rspec extension that interprets the same Given/When/Then language cucumber does. When I was learning this stuff, I think I got a good start from The Rspec Book (despite the name, covers cucumber, I swear). It hasn't been updated in a while, but (1) if you buy from Pragmatic, you get all future updates for free, and (2) relishapp.com/rspec will catch you up with any changes real quick.
|
# ¿ Aug 30, 2012 04:01 |
|
I think that past a certain scale, it's easier to run an app as a network of independently scalable single-purpose services than a single monolithic Rails project. I also think that maybe twenty companies in the world have projects which have reached that scale.
|
# ¿ Oct 30, 2012 16:46 |
|
I have made a lot of oddly-named app subdirectories in my time, and I have never had to explicitly add them to an autoload config. Maybe that's only for lib/?
|
# ¿ Oct 30, 2012 22:12 |
|
I didn't quit my job quite early enough.
|
# ¿ Nov 2, 2012 04:18 |
|
jetviper21 posted:You can always do a params.inspect to dump out all the params in your view as for local variables are you referring to helper methods or the instance variables you define in your controller actions? For instance variables, try: http://rubydoc.info/stdlib/core/Object#instance_variables-instance_method
|
# ¿ Nov 13, 2012 20:42 |
|
What would keep you from just migrating to something else if you didn't like the price?
|
# ¿ Nov 16, 2012 01:57 |
|
For loops are training wheels for java babies.
|
# ¿ Dec 12, 2012 20:37 |
|
Civil Twilight posted:Don't say that around Zed. As with almost any programming language construct, you don't have to learn everything about how .each works to use it effectively.
|
# ¿ Dec 13, 2012 20:11 |
|
What worked for me was choosing a domain I found interesting and test-driving a library that modeled it. e: me rite gud Doc Hawkins fucked around with this message at 17:32 on Mar 1, 2013 |
# ¿ Mar 1, 2013 09:12 |
|
Build is a method on associations, not on models. It basically calls `Thing.new(thing_haver: thing_haver_instance_on_whose_things_association_we_called_build)`. You might prefer an instance method on the class which holds the association. Ruby code:
Doc Hawkins fucked around with this message at 16:30 on Mar 14, 2013 |
# ¿ Mar 14, 2013 16:25 |
|
Well, there is no method `find_by` in rails, though there are the dynamic finders `find_by_*` for each attribute an AR model has, and `find_by_attributes` which would work with arguments like `(name: name_variable)`. I'm actually not sure if those methods return chainable scopes (probably?), but `where` definitely does, and you can use it to write class methods that can chain, be chained upon, and be called on associations.
|
# ¿ Mar 15, 2013 16:33 |
|
How many is "a bunch", and how varied are they? It's not an intractable string processing problem, especially if you know "success" would be "a constant of this name already exists", because that'd be easy to write tests for, so with a database dump of the current values you could home in on a solution pretty quick. The worst case would be needing a full lookup table, but even that would only be temporary. The more important thing is to change your serialization to read downcase and snake-case but write only in snake-case.
|
# ¿ Apr 20, 2014 19:05 |
|
|
# ¿ Apr 29, 2024 02:43 |
|
Steely Dad posted:I want to obfuscate IDs in my URLs without having to either change my primary key types or add slug attributes to my models and use those. In the past, I've used the hashid gem for this and it worked well, but I see it hasn't been maintained in 4 years. Anybody else know of an actively maintained gem they like for this purpose? from that link it looks like they renamed the project to "sqids", which is maintained
|
# ¿ Jan 2, 2024 20:24 |