stackoverflow.com Archives - 23 March 2017, Thursday

  • My ruby on rails product index page not displayed correctly

    stackoverflow.com 10 Mar '17, 6pm

    772 A concise explanation of nil v. empty v. blank in Ruby on Rails 10 Changing Index Page - Ruby on Rails 0 How to override a file that is causing trouble in Ruby on Rails Spree Commerce App? 0 Ruby on Rails: Counting how many times an images appears on screen 0 navbar in ruby on rai...

  • How to insert post data in mongodb using ruby on rails

    stackoverflow.com 06 Mar '17, 10am

    I am trying to insert article post data in mongodb collection but I got below error. Mongoid::Errors::NoParent at /articles message: Cannot persist embedded document Article without a parent document. summary: If the document is embedded, in order to be persisted it must always have a...

  • ¿?—Ruby on rails, Kaminari, paginate multiple Bootstrap tabs using Ajax https://t.co/hshdV5KDaP

    on rails, Kaminari, paginate multiple Bootstrap tabs using Ajax

    stackoverflow.com 02 Mar '17, 10am

    I work on app using Ruby on Rails, Mongoid, Bootstrap and Kaminari. I have a School page (with a model and controller) with many ratings on it. Ratings are separated in 3 parts : verified ratings, unverified ratings and all ratings. They are separated with a Bootstrap tabs. I want to ...

  • javascript - Ruby on rails live update

    stackoverflow.com 28 Feb '17, 4pm

    Okay, what i am looking for is a way to get an ajax script to run in the background of a page and look to see if there is a new record in the database and if there has grab that record and display that on my page. i also do not want to use plugins i would rather do this myself as i pr...

  • css - Ruby on Rails - Bootstrap - Columns not stacking Horizontally

    stackoverflow.com 16 Feb '17, 4pm

    A newbie at web designing here. I've been experiencing some problems trying to create columns for Rails using bootstrap. I installed bootstrap with this tutorial . This is what I have so far: <html> <body> <div id="main-container" class="container"> <div class="row"> <div id="A_Name_T...

  • Block discount on certain product shopify script

    stackoverflow.com 15 Feb '17, 4pm

    I want to write a script in Shopify that prevents discounts from rendering on certain products. I know this is wrong, but something like this: Input.cart.line_items.each do |line_item| product = line_item.variant.product if product = 123456789 CartDiscount.remove("Discount does not ap...

  • No automatic line break when exceeding textarea in form input field

    html - No automatic line break when exceeding textarea in form input field

    stackoverflow.com 13 Feb '17, 3am

    I have a form with an input field for a string. I resized the 'textarea' height to fit with the style I'm trying to achieve but I found two unexpected problems which I haven't been able to fix. The text input and placeholder values are centred vertically in the textarea. I'd like them...

  • javascript - Using an external React component on Rails application

    stackoverflow.com 01 Feb '17, 6pm

    I am trying to use the rc-slider React component on a existing Rails application that is using react-rails gem and it already have some other components that were built within the application that work just fine. Based on this blog post I've been able to follow its first 3 steps, I've...

  • ¿?—Import Twitter Bootstrap Template to Ruby on Rails Application https://t.co/yGQyJkBqnp

    css - Import Twitter Bootstrap Template to Ruby on Rails Application

    stackoverflow.com 25 Jan '17, 4pm

    I'm currently involved in a complex project which I will require help from this forum in order to complete! I am a novice; and have thus far only completed Michael Hartls Tutorial. Currently I am attempting to import this template into my new application. I have successfully got Boots...

  • javascript - Ruby on Rails - Sort by asc using jQuery

    stackoverflow.com 24 Jan '17, 10am

    var table = document.getElementById("targetTable"); var data = []; var sortAsc = true; for (var i = 0; i < 5; i++) { var obj = { id: i + 0, rowNode: document.createElement("tr"), idNode: document.createElement("td"), valueNode: document.createElement("td"), value: Math.random() * 1000...

  • on Rails - Default ascending sort bootstrap table for the filtered column

    stackoverflow.com 23 Jan '17, 2pm

    I'm a newbie in Rails, I want sort data in some code and I stuck... I have a problem with the default sorting (ASC) on my bootstrap table. I want to sort data by the 'Expires' column, but I'm not sure how in case of filters add attributes which will refer to only one column. Data-fiel...

  • AWS Gem Build Error when deploying Ruby on Rails App

    stackoverflow.com 20 Jan '17, 9am

    Hi I'm trying to switch to AWS and Elastic Beanstalk. I was able to get a successful sample instance of AWS going. I am trying to deploy my RoR app and am experiencing the following. An error occurred while installing nokogiri (1.6.6.2), and Bundler cannot continue. Make sure that `ge...

  • on Rails, create a record from another model

    stackoverflow.com 16 Jan '17, 3am

    Your first approach should be ok, you can save the Result from the File model. You do not need to use the instance variable @, as it is thought to send the variable to the view, and I can not imagine why you need so here. To sum up, in filedb.rb: # here you calculations and then cell ...

  • on Rails: Adding jQueryUI and Bootstrap icons on production environment

    stackoverflow.com 13 Jan '17, 12pm

    and restart apache. Bootstrap and jQueryUI works fine but i can't add icons (or glyphicons from Bootstrap). When i change environment to development icons works fine. The problem is only on production environment. I have tried add png files with icons and fonts files with glyphicons t...

  • twitter bootstrap - how do I use a bootstrapious theme on Ruby on Rails

    stackoverflow.com 12 Jan '17, 9pm

    I tried looking through already asked questions like basic bootstrap Integrate bootstrap theme in Ruby on Rails and How to integrate a Wrap Bootstrap theme into an Rails application? but when I try just adding the folders from the free downloaded bootstrapious theme, I get the basic o...

  • css - How to show an image in bootstrap based navbar on ruby on rails

    stackoverflow.com 12 Jan '17, 11am

    I want to place an image on the left in my Bootstrap based navbar in ruby on rails. My image does not show up. I suppose I did not reference the link well. How can I fix this? The image is in app/assets/images/logo.png <nav class="navbar navbar-default navbar-fixed-top" role="navigati...

  • on rails - Eager-load for custom joins in ActiveRecord

    stackoverflow.com 08 Jan '17, 12pm

    I have a table of restaurants that have many reservations. Now I would like to query all restaurants and in case they have reservations for 2 people it should preload these associations. In case there are no reservations for 2 it should still return the restaurants, but with an empty ...

  • twitter bootstrap - Ruby / Rails (5.0.0.1) - Material Design Lite: Creating form_for using MDL

    stackoverflow.com 21 Dec '16, 4pm

    I am attempting to create a Rails "form_for" using Material Design Lite for styling. I am following the Ruby on Rails Tutorial (Rails 5) by Micheal Hartl . Specifically, Chapter 7, Listing 7.15 "A form to sign up new users". This tutorial uses Twitter's Bootstrap. Since I am using MDL...

  • on rails 3.1 - ExecJS and could not find a JavaScript runtime

    stackoverflow.com 11 Dec '16, 8am

    I had a similar problem: my Rails 3.1 app worked fine on Windows but got the same error as the OP when running on Linux. The fix that worked for me on both platforms was to add the following to my Gemfile : gem 'therubyracer', :platforms => :ruby The trick is knowing that :platforms =...

  • on rails - gem install nokogiri -v '1.6.8.1' fails

    stackoverflow.com 11 Dec '16, 3am

    gem install nokogiri -v '1.6.8.1' Building native extensions. This could take a while... ERROR: Error installing nokogiri: ERROR: Failed to build gem native extension. current directory: ~/.gem/ruby/2.3.1/gems/nokogiri-1.6.8.1/ext/nokogiri ~/.rubies/ruby-2.3.1/bin/ruby -r ./siteconf20...

  • 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 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...

  • 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 - 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 ...

  • 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...

  • 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...

  • on Rails: Cant figure out why my jQuery-ui autocomplete isn't working?

    stackoverflow.com 15 Sep '16, 2am

    I just followed a youtube tutorial on adding a jQuery-ui autocomplete feature to my search field. This is the link to the tutorial: https://www.youtube.com/watch?v=iMz8HmrQ350 . For some reason it is not working, despite going over the tutorial and rechecking syntax constantly. I'm NO...

  • 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...

  • 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...

  • Rails: ruby class name must base on file name?

    stackoverflow.com 07 Aug '16, 4am

    I'm learning rails 5.0. When I learn Ruby, I know that ruby file name can be different with class name inside. But when I move to rails, I see that ruby file name and class name must have same format. For example, a class name CheckInDetail will be in check_in_detail.ruby . I also see...