Stack Overflow

A language-independent collaboratively edited question and answer site for programmers.

  • Why is Ruby more suitable for Rails than Python?

    stackoverflow.com 03 Nov '16, 11am

    There are probably two major differences: Ruby has elegant, anonymous closures. Rails uses them to good effect. Here's an example: class WeblogController < ActionController::Base def index @posts = Post.find :all respond_to do |format| format.html format.xml { render :xml => @posts.to...

  • Rails Best Practices - Ruby on Rails

    stackoverflow.com 13 Nov '16, 2pm

    "Fat Model, Skinny Controller" is a very good first step, but it doesn't scale well once your codebase starts to grow. Let's think on the Single Responsibility of models. What is the single responsibility of models? Is it to hold business logic? Is it to hold non-response-related logi...

  • ajax - Dynamic select tag in Ruby on Rails

    stackoverflow.com 13 Nov '16, 2pm

    I am a newbie to Ruby on Rails . I have started working in RoR month ago. My question is: How can I make dynamic select tag that shows me sizes based on selected color of the product variant via AJAX? Each product has many variants. Each variant has one color, one size and quantity. H...

  • Rails - Could not find a JavaScript runtime?

    stackoverflow.com 28 Oct '16, 4pm

    Note from Michael 12/28/2011 - I have changed my accept from this (rubytheracer) to above (nodejs) as therubyracer has code size issues. Heroku now strongly discourage it . It will 'work' but may have size/performance issues. If you add a runtime, such as therubyracer to your Gemfile ...

  • AWS cloudfomation Sample Ruby on Rails Stack template times out

    stackoverflow.com 27 Aug '16, 6pm

    I am tying to use the Ruby on Rails sample stack and it always fails with a timeout after about 20 minutes. Would someone kindly try to create this bare minimum Rails app using this basic sample Ruby on Rails cloud formation template and report back to me if they had a success or fail...

  • Ruby / Rails / Bootstrap / Paperclip - Image Gallery Layout

    html - Ruby / Rails / Bootstrap / Paperclip - Image Gallery Layout

    stackoverflow.com 17 Oct '16, 10pm

    I have an image gallery that needs styling. The layout is currently stacked. I would like the gallery to show 4 images on each row before generating a new row. The problem I face so far is getting the images not to repeat when using bootstrap grid. View View HTML: <div class="row"> <d...

  • on Rails - User object showing nil fields even though they are filled

    stackoverflow.com 14 Aug '16, 3am

    I'm having a weird problem with getting my user registration to work in Rails. When I create a user, it will show all its fields but the password_digest being nil, but when I type something like "u.email", the email will show up. However, it doesn't want to save the user, I assume bec...

  • api - Ruby on Rails Sunlight Congress Gem

    stackoverflow.com 15 Oct '16, 4am

    I'm really new to Rails, but I'm loving it so far. I'm trying to make a website that takes the user's address, and tells the user who his senators and congressional representative is. I'm using the sunlight api gem for this, which can be found here: https://github.com/sunlightlabs/rub...