Newest 'ruby-on-rails' Questions

Q&A for professional and enthusiast programmers

Lightbox open image from second time

I have issue with lightbox. When I click on image, first it open image link, when i click second time it open image with lightbox. I'm using lightbox on ruby on rails with loop. Lightbox.js I included ...

Heroku code=H10 app crashed

I am new to Heroku and rails. I've read articles to create APIs for my phone app. I have succeeded in creating locally and when I run server, the APIs respond correctly, but when I try to use the ...

Nested Associations In Angular Ng-Repeat

My application has the following associations. A :review has_many :comments, each comment has a :user that has a :username. In my angular view the following code is not displaying. <div ng-repeat=...

How to validate boolean values from HTML5 to vmWare Orchestrator?

I'm presenting a vmWare Orchestrator workflow on a website using Ruby and HTML5. When I run the workflow inside Orchestrator it validates and runs the workflow. When the workflow is presented on my ...

ODD ISSUE: Heroku app works great on few computers but not the others. Could running “heroku restart” cause the issue?

I am running into a very odd issue and coming up short with identifying the issue. I don't even know if it is a front-end, server or heroku issue. Please help me out. I am managing a Rails App (with ...

Rails Accepts Nested Attributes Form with Has Many Through not working

I have several models that are all interconnected with some complex relationships. I have a Projects model, Reference model, and Source model...I also have a model ReferenceRelationship (the ...

Condition on mount_uploader Carrierwave

I have user model and have multiple method of signup : via form, with facebook & with gmail. User model have user_picture attribute and it mount to uploader using carrierwave. I won't to upload ...

Using Wikipedia-Client Gem to Update Rails Database

My ruby and Rails is a bit rusty. I have a table in my database called institutes which has some of the columns filled. I want to use the Wikipedia-Client gem to fill some of the others. I want to use ...

Strong Params: params.permit returns Unpermitted parameters despite whitelist

UsersProfileController has strong params that looks like so: def user_profile_params params.permit(:age, :relations) # yes, I am not requiring user_profile. Just permitting ...

Scraping HTML table with Nokogiri and saving to database

I've been trying to scrape a website for education information to save to my app database. The site has a three column table as follows: <thead> <tr height="20"> <th height="20" scope="...

How do I use an ActiveSupport Concern to add a refinement to a class

I have a concern that adds some helper methods to the including class. How can I automatically add a refinement to the including class? The following example works, however, I'd like not explicitly ...

Rails - Object Available in View, but Not Object's properties?

I've got an unusual problem where I can access an Object, but not its properties in a view. Any Assistance, guidance, is greatly appreciated. This is my model (app/models/team_member.rb): class ...

RoR/Mongoid, Set of Foreign Keys vs. Associations

Within my application, I have finding sheets that are related to many users in different ways, such as the 'one that found the problem', 'one that reported', 'one that solved', as well as a list of '...

Redmine - 501 Syntactically invalid HELO argument(s)

Installed redmine on remote server(ubuntu) In redmine i want test mail(Setting-email notification). Get error: An error occurred while sending mail (501 Syntactically invalid HELO argument(s) ) I ...

Rails 5 - using a scope in an edit action to find relevant children of a specific instance

I am trying to learn how to use scopes in my Rails 5 app. I have asked a background question here. have models in my Rails 5 app for User, Proposal and Potential. Users create Proposals which they ...

Rails with FactoryGirl, parent-child association. Omit creating one more record in child model

I have two models. Parent model Tag: class Tag < ApplicationRecord has_many :keywords, inverse_of: :tag, dependent: :destroy accepts_nested_attributes_for :keywords validates :keywords, ...

Rails Associations - undefined method for nil:NilClass

Basic question on Rails associations with the following tables: Shop: name, network Product: title, price, shop_id Relation defined as has_many and belongs_to: Model: shop.rb class Shop < ...

Rails server command JavaScript runtime error

I just started learning Ruby on rails and everything works fine until when I run the server also I reinstalled Nodejs and no lock. i'm on windows 10. also I tried : gem update , bundle install, gem ...

Tinymce default styles in Rails app

I was following the tutorial on How to build a blog with Rails 5 and Bootstrap 4 - Part 5, initialized Tinymce Editor but I can't change the default font size of text in this editor. I have this code ...

Omniauth not returning email

I need to get the user mail when he log in. I can get the name but not the email address. The only solution I found it's to add "email" in the info_fieldsbut it doesn't work. Here is the code of my ...

How to convert img inline styles for width & height to attributes

currently my images are displayed from my cms like so: I'm working to create AMP pages and they do not accept image dimensions in style. AMP pages require: <amp-img alt="stuff" src="welcome.jpg" ...

how to test json using swagger

I have created a json which returns a account info. I am trying to test it on swagger. This is what i did so far: downloaded zip folder from the location below https://github.com/swagger-api/swagger-...

Dynamically include associations for objects in Rails

I am currently developing a small Rails 5 application where I need to pass on an ActiveRecord object to an external service based on certain events. In my model I have defined the following: # /...

Ruby on rails - Devise - Show user created content only

I am creating a basic ruby on rails application similar to zapier or ifttt. Users create recipes. I'd like to ONLY display recipes created by the user. I've used device gem for authentication. My ...

Rails create has_many association models from a list of options

I have options for timeslots that a user should be able to choose from: [ { day_of_week: 'Thursday', time_of_day: '7 am' }, { day_of_week: 'Thursday', time_of_day: '8 am' }, { day_of_week: '...

rails5: generic grid - how to get column names for current search

I wan to do a generic grid, that could be used in my app to show data from different Models. As I am a newbie in RoR - please let me know if my "vision" is ok, or i should change the way i think about ...

missing requiered keys: [:post_id], add comments to post on a page with many posts

I'm trying to add comments to my posts. When I have done that successfully before I cannot get it right now. The problem is that I have lots of posts on the same page, all of them with a comment box ...

gem pg destroyed my app

UserXs-MacBook-Pro:shobiz Ayaz$ rails s => Booting Puma => Rails 5.0.1 application starting in development on http://localhost:3000 => Run `rails server -h` for more startup options Exiting /...

Validation Failed when using accepts_nested_attributes_for with Single Table Inheritance

First time I'm using STI, and I'm running into issues when trying to use accepts_nested_attributes_for with nested inherited objects. class Document < ApplicationRecord # code removed for ...

Associating Devise user ID with third nested resource

I need to assign the current_user ID to all new projects, tasks and comments created in my app. I got projects and tasks working fine, but for some reason comments are giving me trouble. Here's what ...

using prepend_view_path to manage multiple domains on same app

I'm trying to run several domains on my rails app where a lot of the view codes is shared. In order to do this I've created the following directory structure - views - shared - domain1 - ...

Rails; Fetch records within initializer

I've been wondering it is common to fetch records within initializer? Here this is an example for service object to fetch records and generated pdf receipt file. Input is invoice uuid, and fetch the ...

Bundler trying to install development gems in production

When I try to deploy my Rails 5 application using Capistrano 3, it tries to install development gems even in staging. This is completely new behaviour and I have no idea where it's coming from (came ...

heroku push rejected : require_tree argument must be a directory

I'm trying to push my app to Heroku. All works good, until the last command git push heroku master The end of the work is: remote: Bundle complete! 23 Gemfile dependencies, 64 gems now ...

crossing borders of tables: language role

I'm new to development, and have spent the last 12 hours (literally) trying to figure out this error message - I'm giving up for the night, but not before a quick cry for help to stackoverflow. I ...

Setup react-routing with rails app

I am newbie for React, I know rails, I have created basic React application that perform CRUD operation. Now, I tried to implement routing with react and want to redirect a page after successful ...

Ruby on Rails - Couldn't find Post with 'id'=string

Having trouble passing a string as a parameter instead of an ID. I keep getting hit with "Couldn't find Post with 'id'=stack". routes.rb makes a GET request for a :short_url in the redirect ...

Issue with vagrant push & heroku

I'm trying to push a rails application to heroku. i'm aware I could do this inside the project directory where the actual app is living, but I'm trying to give this vagrant push command a shot. The ...

Rails 5 - vendor assets are not loaded on production (fonts only)

It's perfectly working in development, but not in production. It's not finding the following files: /assets/fontello.woff /assets/fontello.ttf Here is the setup: fonts files: assets.rb Rails....

Rails delayed job and docker: adding more workers

I run my rails app using a Docker. Now delayed jobs are processed by a single worker that runs in a separate contariner called worker and it runs with a command bundle exec rake jobs:work. I have ...

Rails Admin: display a has many association with checkboxes

Rails Admin displays the has_many association as a couple of boxes like this: Instead, I would like to show simple checkboxes. How can I achieve that?

Rails show parent data in child index page

See the code and what I mean in the picture how do i show the parent in the child index page? An example is the ID number 1,2,3,5 they are the child and their parent is the account name OSCAR. and ...

How to know plain text of :encrypted_password, in devise?

If i use has_secure_password, i have whitelist are: password, password_confirmation, and password_digest. With password is the plain text of password_digest, which was encrypted by bcrypt. But when i ...

How to seed database with data from yaml file? Ruby on rails

I need to fill my database with data from yaml file, which contains something like: -Users: ------Users_nameship: 'First group' ------Members: ----------Name:'Jack' etc. And i need to use seeds.rb ...

gem install mysql2 does not work

I'm trying to install mysql2 gem to use in learning rails, but it just doesn't work. Reinstalling mysql or ruby doesn't work. Using ARCHFLAGS doesn't work. I can't use apt-get libmysqlclient-dev ...

Build method is not associating in Rails

I'm still newbie in Rails, but got confused with the initialization of a HABTM association. Reading its documentation, it says When initializing a new has_one or belongs_to association you must ...

How do I go about adding business_day, opening_time, and closing_time to my app?

What I want to accomplish in my form is like that of the Hours field in the yelp's business form where a user can set an opening and closing time for a specific day. Do I have to add a column ...

Redmine : rake aborted due to “existent table ”when installing “wk-time” Plugin

I'm trying to install the "ERPmine" plugin : Official documentation : http://www.redmine.org/plugins/wk-time As the documentation says , and like every plugin i'm used to do the following : ...

Missing required arguments: aws_access_key_id, aws_secret_access_key - Travis

I'm getting this error when I run travis ArgumentError: Missing required arguments: aws_access_key_id, aws_secret_access_key. It stops my build. I'm using carrierwave for fileuploads and storing them ...

searchkick re indexing not working on rails application production

Im trying to use Searchkick in my application. However, I get Searchkick::MissingIndexError Index missing - run Restaurant.reindex I run Restaurant.reindex but it didn't solve the issue. I also ...
Translating... 0%