Offer HN: Help with Ruby on Rails
Inspired with latest topics on legal and design help.
I cant help you with some simple stuff for your RoR project. Maybe converting your mockups to HAML, working on backed, consulting on something, scalable deployments, adding couple nice features etc. Anything that can be done within 2-5 hours.
You must be not concerned with NDAs stuff.
Feel free to reply in this tread (If you are RoR developer willing to give back to community please comment as well!)
About me: I am doing this startup - Videolla.com and contracting on Rails to bootstrap it. Have over like 4 yrs full-time Rails contracting experience.
58 comments
[ 2.9 ms ] story [ 123 ms ] threadI can't find the original post, but NDA = "No deal, amateur."
My buddy and I built a social network for the iPhone. Has 25,000 users and growing. We are looking to build an admin portal on the web to facilitate moderating users, groups and messages as well as some other things. We like what we have learned about Rails but dont know much about it. A lot of our web services for the app are built with PHP but we have a MySQL database storing the content. I imagine that isnt an issue for Rails.
Anyway, would be interested in talking through some of the advantages and disadvantages of RoR and perhaps get you involved in some capacity.
Do youhappen to have examples of stuff you have built in the past?
Otherwise you need to re-engineer all model mapping in Rails. Technically possible, but hardly makes sense. My email is vlad@videolla.com
1. I'd like several submit buttons on a form that do different things. I'd also like to input data alongside some of the buttons, e.g. to allocate some % of a resource.
My problem is I can't work out how to sensibly do this without repeating myself, or having a very hacky controller. How can I do this without matching on the value part of the submit buttons (the text on the buttons, since that is bad for i18n and in some cases the text is the same anyway), and without using any javascript?
2. If you have two forms on a page, can you set it up so changes on both forms are saved when any submit button is clicked? Again, without javascript. Obviously you need to override the form tag generator so the page only has one actual form; is there a standard solution to this somewhere?
[1] http://stackoverflow.com/questions/461790/multiple-submit-bu...
If you can't get stuff working with the rails helpers you can always hand write the html yourself. I need to do this once in awhile. I prefer using formtastic for my current project and I've had to hand write some html to add custom logic to a formtastic form. (I prefer not to abstract one off hacks until I need to do it twice)
Rails does a lot of stuff but it doesn't do everything. If the built in tools don't do it, build your own.
> 1. I'd like several submit buttons on a form that do different things.
The only way to target these is javascript hackery, use the text on the submit button or find an alternative method that doesn't rely on multiple forms.
> 2. If you have two forms on a page, can you set it up so changes on both forms are saved when any submit button is clicked?
Without javascript, not happening. For a rails solution to combine two forms, look at fields_for.
All that said,
Without specific details (screenshots, etc.) I can't really figure out what you are trying to do. I assume you have a valid reason for asking the question. Sorry if I wasn't able to help.
On the point of building my own, that's what I've done, but these felt like an obvious things to want (I implemented them both in my own PHP framework.) Thinking about it, the standard Rails CRUD index provides delete links instead of buttons; IMHO that is totally wrong, but when all you have is a hammer... Also, button_to is not good enough as it makes its own form, which breaks any solution to question 2.
On question 1, what I want is to generate submit buttons like <input type=submit name=some_non_clashing_string_that_identifies_this_button value=ButtonText> and then have this routed to a function nicely. I've not found a standard way of doing that; maybe I should write one? Could you see it being useful?
In fact the application I'm using at work right now uses ExtJS for views and half of the data is retrieved through manual queries. Rails is not designed to do this but it can work, if you are willing to put in the effort to work around missing functionality.
I do not recommend using rails as a hammer, it's a very bad hammer. It's a chainsaw with diamond teeth and a 50 hp gas-powered engine. If you have a lot of wood to chop through, it's amazing. If you need to pound in a few nails, it's a little awkward. :)
2. Yes. Just make the form a single big form with two submit buttons, so they look like two forms.
1. I know you can look at the value of the submitted button on the server. What you need to use is actually <input type=submit name=some_non_clashing_string_that_identifies_this_button value=ButtonText>, so my question is how do you generate those strings nicely in Rails and have the controller act on them nicely as well.
2. Of course that's what you need to do, as I said in my question. My question was, how do I make Rails do this in a nice way? fields_for helps, but I'd like to know if there is a plugin or something better.
Now with the advent of Rails 3, my app is stuck in a limbo of sorts. I'd like to upgrade it to Rails 3, but a few gems I'm using are really resisting the upgrade, and what's worse is that there's been no movement in their git-repos for quite a while now.
I know the best bet is probably to dig into these gems and fix them for Rails 3, but I really don't feel I'm that skilled a ruby programmer. Thoughts?
1) Dig into your problems with these gems and either fix or replace them 2) Think again if you really need Rails 3. What are some benefits that you will get from that upgrade?
I'd suggest 2 approach. Rails 2.3 is a very solid version and is used in many apps. I don't see reason to "upgrade for upgrade". Especially if there is some friction and not enough time.
I recently made very small project on Rails 2 just because all I needed was ActiveScaffold(not available in Rails3 atm)- which is really awesome for some stuff btw.
My app is currently running on 2.3.5 – I think the reason I feel compelled to upgrade is that I just hear so much about Rails 3. Good point with the 'upgrade for upgrade' point. I'll have to think about it, and yeah, it is just friction at this point.
I guess this app is destined to stay at Rails 2 and I will just start a new one for Rails 3, once I get a good enough idea!
anyway, if you list them we might be able to make some suggestions.
Would you be willing?
This is a really simple beginners tutorial, hope it helps.
http://stackoverflow.com/questions/4020393/ruby-on-rails-3-f...
documentation /tutorials on this), I'd even pay a nominal amount just to email you a few questions over the next few months as I learn.In your original page, along with the form, you need to bind an event to the form's "ajax:success" event.
The rails.js ujs driver binds to forms and links with "data-remote=true", which is what the ":remote => true" is doing, to make them submit their requests remotely, but that is where the Rails magic stops.
The good news is that the remote requests fires off some events you can bind to, which give you access to the data returned by the server (which fire off in the following order):
You need to bind an event to the ajax:success event of your form. So, if your form had the id "myform", you'd want something like this on your page: xhr.responseText is what your server returns, so this simply executes it as javascript.Of course, it's proper to also bind to the failure event with some error handling as well.
I usually don't even use the action.js.erb method of returning javascript, I just have my controller render the HTML partial, and then I have a binding like this in the page:
It's an AR question that has been bugging me.
Thanks!
Most of the screens are CRUD (it's a business management thing) but I want to start this project correctly.
Thanks!
As for authentication, I am a big fan of rolling my own auth. Once you have a nice functioning authentication system you worked out yourself, moving it from project to project is simple. The problem I have had with all the authentication plugins, is they insert too much automagic in something that should be simple to understand, and realistically, is a pretty easy concept. There are many guides on authentication, and playing with it is a great way to learn several fundamental rails security ideas that will be helpful in other areas (log filtering, attribute accessors on models).
Basically I'm asking for a homework assignment that would help ramp up my rails skills and maybe be of use to the community. I worked on and helped complete a rails project between Oct '09 and March '10 but I ended up preferring Sinatra/Datamapper for light web apps. Now I'm looking to get back into Rails 3.0.
LinkedIn suck. Its something from myspace age. There are multiple problems with it but its still #1 HR tool
Would be cool if you can make LinkedIn-like network or just start with directory that would be great for searching and hiring best experts.
Extra bonuses: Import users data from LI, Fb, etc Smart limiting contacting abilities to prevent spamming. Smart ratings for ppl based on their social impact (like hn karma, stackoverflow rating, github, etc)
Mortality bonus: "Pay to pitch" feature. Instead of spending $400 to post job ads on 37signals job board, recruiter can pitch his ad to top 400 Rails developers. Developers have to reply and can donate these money to some charity of their chose.
Let me know if you are interested or need more clarification with that idea
setup for Mac OS X (not very different for Ubuntu just apt-get rvm)
http://pragmaticstudio.com/blog/2010/9/23/install-rails-ruby...
Get started->
http://railstutorial.org/
http://edgeguides.rubyonrails.org/getting_started.html
http://rubyonrails.org/screencasts
http://ruby.runpaint.org/
http://weblog.rubyonrails.org/2010/8/29/rails-3-0-it-s-done
http://railsnotes.com/rails-3/
Why Rails, interesting anecdote from how 2 pythonistas decided to go rails.
http://blog.brandonbloom.name/2010/09/how-two-pythonistas-ac...
The reason I say find a project like this, is because if you don't have actual problems to solve, you won't know what to read about. You can read about rails routing all you want, but until you have a reason to use rails routing in any sort of complex way (resourceful nested routes, like a user has many photos => /users/1/photos) you can't really do anything with it.
Once you have a project and have questions, this is a great way to get help, however, without a project we are all flying in the dark with you :)
Surprised to see that so many people dont know where to start with their projects. Here is my answer - just do that. Read couple books, watch screencasts and you are good to go! Thats a great thing about coding - you can always refactor it later! :)
I followed mhartls book, the railscasts, and the documentation of various projects but I still cannot grasp testing.
How does rspec, cucumber, factories, shoulda etc etc etc all fit together? What do I use each for and when? What does a good test consist of?
Rspec: Behavior Driven Development Framework. It is essentially a different approach to testing than the test/unit (which Rails uses by default). In Rspec you are more interested in testing the side effects of your code, i.e. its behavior, you are less concerned with the internals. This doesn't mean you should write huge methods, and in the end your specs and tests will look pretty similar. My company uses Rspec on our main project.
http://gist.github.com/649417
People will argue the value of the different styles until they're blue in the face. I liked Rspec's syntax more so thats where I started, but in the end I know both and think they each have their own merits and its probably a total wash. Recently with things like shoulda and other tools both approaches are rapidly converging on the same feature set.
Cucumber: Integration framework. This tests your whole stack end-to-end. Depending on what you are building this may be the only way to test it, and for a lot of people they are just doing Unit + Integration tests and not writing any controller tests. You write in Gherkin (http://github.com/aslakhellesoy/cucumber/wiki/gherkin) which is a special subset of English. You can also use Steak (http://jeffkreeftmeijer.com/2010/steak-because-cucumber-is-f...) which lets you write your story in pure Ruby. Either way, this story is broken out in to steps and then some driver follows those steps, either driving or emulating a web browser. The original driver was Webrat, which you can think of as a web browser in Ruby. Webrat has been replaced by Capybara which is more complete and has pluggable backends, including Selenium. If you aren't using much JavaScript you can stay in pure Ruby and your tests will be parsing the HTML with something like Nokogiri, this is also pretty fast. If you have complex JS you can actually drive Selenium which in turn will drive a real browser (you can even drive flock of different browsers). Depending on how complex you get this can be a total PITA, so I would start simple with just getting it running in pure Ruby and maybe testing your sign-up form.
Story -> Cucumber -> Capybara -> Selenium -> Firefox... its a lot of layers and as a result can be suuuuuuper slow.
Factories: Instead of pre-loading a database with stuff (fixtures), factories let you write code that returns prepped objects for you. ActiveRecord takes a row from a table and converts it to an Object (Object Relational Mapper - ORM). Say a post from the posts table into a Post object. Factory Girl will just make you a Post object. I much prefer factories because you can actually get a stack trace to figure out where all the data came from instead of shifting between a SQL database, a YAML file, and a Ruby file to find your 'fixture fail'. There are some variations on preferred syntax and Factory Girl supports most of them.
Shoulda: Just some macros to save you typing. Most of them work in both Test/Unit and Rspec. Instead of writing a test like this to ensure there is a validation error if number in't a number:
http://gist.github.com/649419
Just saves you time and typing, at the expense of learning the helpers.
A good test is something that breaks when the code breaks. Start small, test a few 3 line methods and then build up successively higher tests. Read the tests of some projects on github to get a feel for what they're looking to test, and how they approach it. Then just ask a lot of questions.
I'm by no means an expert but feel free to hit me up and I'll see if I can help: dev@evan.co.nz
Can you be reached by email and do you have any experience integrating Rails apps with the Facebook platform?
I am looking at exploring mini_fb in the next few days (http://github.com/appoxy/mini_fb) for my new project, and for replacing facebooker/facebook connect in my ongoing startup (http://ridewithgps.com) towards.
I am learning RoR right now. Could I occasionally send you a quick email asking for clarification on something or help if I get stuck?
Please let me know what you think. Thanks for the offer!
Much like Python and Django has virtualenv/pip?
It also helps to have a decent grasp of git, you'll be using it a lot for installing things and getting resources from the community. Other than that, it's all personal opinion and you'll work out something that works for you soon enough.
I recommend railstutorial.org as the first and most important stop for Rails learning anyway, so you should try following his instructions for setting up an environment:
http://railstutorial.org/book#sec:rubygems
In terms of getting your app in front of the public quickly and easily, you can't look past Heroku. It has an awesome free account and you won't need to start paying until you want to either a) increase your traffic, or b) run background tasks (such as scheduled bulk emails or something like that)
Can you also check my service - http://videolla.com ? It might be great for donation or "paywhatyouwant" based tutorials and screencasts on Rails. (I just got good reviews from Ryan Bates and DHH :) )Maybe we can partner in some way?