|
RonaldMcDonald posted:how would the following PHP code look in RoR? If I wanted a page that listed all people ordered by lastname, I could do this: In app/controllers/person_controller.rb: code:
In app/models/person.rb: code:
In app/views/person/list.rhtml: code:
To highlight another convenience of Rails, if I have a site template, I simply put that in app/views/layouts/application.rhtml and it will wrap other views: code:
Novo fucked around with this message at 00:18 on Aug 9, 2007 |
# ¿ Aug 9, 2007 00:06 |
|
|
# ¿ Apr 29, 2024 07:45 |
|
SpaceNinja posted:can anybody recommend a better MySQL browser under Windows?
|
# ¿ Dec 28, 2007 19:42 |
|
Deus Rex posted:Is ActiveResource really as goddamn slick as it seems? Automatically map REST resources from an external API to models in my application? I spend more time fighting with ActiveResource than any other part of Rails. Of course, I'm trying to make it do crazy things like use non-numeric IDs. I have enough trouble getting it to work between two Rails apps, I wouldn't even bother trying it against a third party API.
|
# ¿ Dec 16, 2011 01:02 |
|
Sometimes you want to control the order in which things show up. I have gotten into the habit of defining my navigation in lib/appname/navigation.rb using an Array instead of a Hash.code:
Also, you should never be writing literal URLs in a Rails app, use the route names or _url helpers, they will save you a lot of hassle.
|
# ¿ Apr 26, 2012 00:27 |
|
Sparta posted:My company is offering a nice finders-fee to any of us who recruit a ruby/rails developer. I've been posting ads on cl, responding to resumes, etc, but I have yet to even get a response back. Have you tried GitHub / StackOverflow's jobs page? I check those when I'm bored and thinking about moving on. Just don't do what Rumblefish did: contacted me out of the blue, refused to say how they found me, complained about how hard it was to find "good developers" then stopped talking to me entirely without so much as a "we dont' think you'd be a good match because _______" after I agreed to talk with them. That type of poo poo is not going to make finding good developers any easier.
|
# ¿ Dec 4, 2012 01:51 |
|
prom candy posted:It's times like this that I hate managing 150+ Rails applications across a ton of different versions. I feel your pain. I provide infrastructure support for almost 40 Rails apps ranging from 2.3 to 3.2, and maintain a few of those apps myself as well. There are days where I end up hating the entire Ruby ecosystem. We're still on 1.8.7 so I'm simultaneously dreading and looking forward to moving to 1.9.
|
# ¿ Jan 4, 2013 01:14 |
|
From the Rack homepage:quote:Rack provides a minimal interface between webservers supporting Ruby and Ruby frameworks. Rack defines an interface that web servers and Ruby web application frameworks can use to pass HTTP requests and responses back and forth in a standard way. It's what allows things like Passenger to run both Rails and Sinatra applications. It also allows you to put functionality into framework-agnostic "middleware", (things like JSONP responses or cookie verification). As long as the web server and framework support Rack, they can interoperate. If you are using Sinatra or Rails, or just about any Ruby web app framework, you are probably using Rack. (Though you may not be using the affected middlewares: Rack::File and Rack::Session::Cookie). Novo fucked around with this message at 23:03 on Feb 8, 2013 |
# ¿ Feb 8, 2013 23:00 |
|
kitten smoothie posted:Is Railsconf worth the money? Google I/O registration failed me this year and so now I'm trying to decide if I should burn the money on Railsconf instead. I find that I can get as much or more out of watching videos of conference talks after the fact without flying across the country to sit in a room where everyone is dicking around on their laptops. I've been told that this means I don't "get" conferences though, so YMMV.
|
# ¿ Mar 13, 2013 19:28 |
|
Smol posted:an IDE like Rubymine (highly recommended, it's well worth the price) Counterpoint: If you type fast and/or are used to the responsiveness of editors like Sublime Text, Rubymine will feel like you are using VNC or something. This kills my flow, but YMMV.
|
# ¿ Jun 14, 2013 20:59 |
|
The Journey Fraternity posted:Really should be built-in functionality, but what can you do? gem install rbenv-rehash Smol posted:I hope that you're not seriously as a Ruby developer complaining about Java performance. I wouldn't use an IDE written in Ruby either if it was as slow as RubyMine is. What a lemon.
|
# ¿ Aug 23, 2013 17:36 |
|
xtal posted:I actually test if my classes inherit from ActiveRecord::Base sometimes. You can't have too many tests. This is dumb; you might as well be writing tests to make sure your models respond to Object methods.
|
# ¿ Aug 26, 2013 19:19 |
|
Cocoa Crispies posted:TDD is driving your development with tests, not writing your code once in test form and once in implementation form. Exactly. If you are defining classes at runtime then testing a parent class is defensible, but testing that "class Foo < Bar" has the desired effect is way outside the scope of what you should be testing, TDD or no.
|
# ¿ Aug 29, 2013 00:25 |
|
Fillerbunny posted:How do you determine what's in scope? I test the methods I've implemented, not the ones Ruby implements. I also don't test things that are implemented by frameworks or libraries I'm using. I set up the preconditions (if necessary), feed my code inputs, and check that the outputs conform to my expectations. I don't test that the implementation was expressed in a particular way, because that's not what tests are for. OOP is supposed to help you separate the "what" from the "how", the interface from the implementation, etc. When I am refactoring part of my implementation, I want my failed tests to tell me "hey, these things stopped working the way they're supposed to!" not "hey, you forgot to subclass FooBarBaz!" Basically, even a clean well-designed OO codebase is full of assumptions, conventions, and other implicit behaviors. Testing should be about making these things explicit so that if you decide to change a class hierarchy or whatever, you have a way of knowing that you still conform. If your test just fails because you did some refactoring (but didn't change the behavior in any way) then it's not useful. Novo fucked around with this message at 00:10 on Aug 30, 2013 |
# ¿ Aug 30, 2013 00:01 |
|
I wanted to like RSpec but after using it for a while I realized my Test::Unit tests were way more maintainable. When it comes down to it all you really need in a testing framework is "assert", the DSL frameworks like Cucumber are just trendy conventions created for and by idiots.
|
# ¿ Aug 30, 2013 17:48 |
|
Right, when I said that my RSpec test were less maintainable than my Test::Unit tests, I literally meant that the way I found myself writing RSpec over time (trying different ways of structuring my assertions, trying to apply DRY, etc) was less maintainable for me than the way I found myself writing Test::Unit tests. Follow your bliss.
|
# ¿ Sep 1, 2013 01:27 |
|
prom candy posted:You know, it's possible to say you prefer Test::Unit without insulting everyone who likes to use different tools. Can I still make fun of Windows and PHP?
|
# ¿ Sep 2, 2013 18:57 |
|
kayakyakr posted:yeah, looks like in your cases, you're pretty much doomed. Maybe look at modifying the capistrano 3 bundler gem to check for gemfile change? I've had pretty good success using "bundle check || bundle install" instead of just "bundle install"
|
# ¿ Feb 20, 2014 20:25 |
|
|
# ¿ Apr 29, 2024 07:45 |
|
The Journey Fraternity posted:Am I the only person left in TYOOL 2016 that manually adds every JS library that he uses? Granted, I don't use much, but still. I never use bullshit like bower or npm and I get along just fine. If a library requires me to use either of those abominations I use something else because chances are the author is an idiot.
|
# ¿ Jun 15, 2016 22:35 |