How do I create a parent record from the child when the parent doesn't exist?

1
Rails
Hi team, I've trying to model books, chapters, and notes. I have the following: ``` class Book < ApplicationRecord has_many :chapters has_many :notes end ``` ``` class Chapter < Applica...
Nino Rosella replied
Solved

Manipulate photos already on S3 or Spaces

2
Rails
Scenerio: User uploads a huge file to S3 or Spaces. Question: How can I set up a job or worker to go into S3 or Spaces and resize that file at a later time, or even batch all of the days uploaded ...
Ryan Carter replied
Solved

Form Object for devise authentication

1
Rails
Hi all - I need to create a signup from having company details along with user details. Currently I am using devise for authentication. I would like to create a form object rather than using accept...
Zanger02 replied

Is it better to switch from scratch to Devise ?

0
Rails
Hi everyone, I'm working on a project since some time now and made up some authentication system from scratch thanks to Michael Hartl among other resources... I was just thinking about the idea to...
Damian Nelwep posted

Table join and data retrieve

0
Rails
how can I link user model table with another model table and based on current_user login I want to retrieve data from second table
Deepika posted

Rails Button_tag not submitting edit form, but submits new form

11
Rails
I am using the following to submit my form when creating a product. ``` <%= button_tag("Create", type: "submit", form: 'new_product') %> ``` However, the issue I am facing is that when I tr...
Alan Reid replied
Solved

FATAL error on hitting Rails API

1
Rails
Hi, I am beginner in ruby/rails. I have a rails api which when curled directly works as excpected. But, when invoked through vent(wrapper on kafka queue) returns 4xx error. I have verified that ...
Srilekha Thirumalaisamy replied

ActionController::InvalidAuthenticityToken error

0
Rails
Hello, I'm getting ActionController::InvalidAuthenticityToken error, even after sending csrf token in the post request. On which cases, do i get this error can anyone please enlighten me. Thanks.
ravitej177 posted

ActionController::RoutingError (No route matches [GET] "/assets/images/4.jpg"):

3
Rails
How to resolve this issue: `ActionController::RoutingError (No route matches [GET] "/assets/images/4.jpg"):`
Alan Reid replied
Solved

Upgrade to Mojave on Mac OS

5
Rails
Hi Chris - I am running Sierra (not high Sierra) on my fairly new Mac (summer 2017). I need to upgrade to Mojave and am afraid I will break my ruby/rails dev environment (like I did when I upgraded...
Chris Oliver replied

How do we show dynamic data in .erb file like from a json file?

0
Rails
I have a view file index.html.erb in my view folder and there I am showing some data in the form of Table(bootstrap table) and this is a static table so I had to write so many lines of HTML for thi...
theshashiverma posted

Separate Asset Pipeline

1
Rails
Im building a webapp that has an admin panel... I separated this by creating a new folder in the controllers 'admin' and also on my views... This way I can have two completely different styles, one...
Nelson replied
Solved

Where do this code go? (Refactoring Rails Workers)

5
Rails
Hey! I have two different workers ``` #app/workers/website_worker.rb class WebsiteWorker def perform(website) do_this_action(website) end def do_this_action(website) ... end ...
Arjun Rajkumar replied
Solved

Improve on these ActiveRecord requests?

4
Rails
I am trying to get the top 5 products, based on the impressions that product has recieved. Now the code below is working ok, but its not in the right order, and I cant work out a better way to get...
Alan Reid replied

Do I have to create a controller for users using Devise or where can I find its actions ?

2
Rails
I'm having some trouble setting up Paperclip gem to setup profile pictures for the users of my app and I need to access users_controller. Since I'm using Devise, I don't really know where I can fin...
kadammanali987 replied

Accepts_nested_attributes_for, I am getting 'unpermitted parameter: :user' and User not entering to DB.

1
Rails
Hello! I am building an app with Accounts/Users & Memberships via has_many through. I am using Devise and want to create a new user from 'accounts#new" via 'accepts_nested_attributes_for.' Whe...
Ryan Mindigo replied
Solved

How do I create my homepage subdomain ('www')

8
Rails
Hi, I followed the tutorial for subdomain from scratch and got " redirect_to root_url(subdomain: "www") if @account.nil? " but I don't know how to get to manage it as a homepage like home#index. ...
Damian Nelwep replied
Solved

How do I create an app with Urls like 'https://username.website.com/' instead of 'https://website.com/username/' ?

17
Rails
Hello everyone, I searched but didn't find anything and was hoping like I said in the title of this subject, to find a way to get the url displaying a user's profile of a client's app to be like u...
Chris Oliver replied
Solved

Professional grade authentication with a single command (in rails 5)

2
Rails
I've built authentication a few times now, and every time it's been 99.9% the same (save for a few tweaks in form validations etc). The machinery has been more or less identical to that found in th...
S C replied

How might I handle event-sourcing?

2
Rails
I've *never* been happy with the way I've implemented certain kinds of features: * Notifications * Some kinds of reporting * Activity Feeds Then, I saw two things: 1. The "bucket/recording" patter...
Chris Zempel replied

Want to stay up-to-date with Ruby on Rails?

Join 88,697+ developers who get early access to new tutorials, screencasts, articles, and more.

    We care about the protection of your data. Read our Privacy Policy.