Rails Ruby on Rails Forum
Rails csv import with associations
8
Rails
I am building a rails application that associates posts with many different categories. For example, I have a Post and need to be able to assign it to the categories Sports, News and Science throug...
Chris Oliver replied
Solved
How do i add a ":unique => true" to an already existing reference?
2
Rails
I have my DB already set up, and it references another table. I need to add in `:unique => true` so i don't get duplicates. I cant however drop the table and start over as there are items in the...
Félix Landry-Audet replied
Solved
Multiple select for CSV Export
3
Rails
Hi there,
My users can create a report record which is basically a scaffolded model "**Report**" with controller and views. The users can use this model to create records that a CSV method is usin...
Sascha M. replied
Solved
[Performance] - Can I Still Refactor This Code?
4
Rails
I'm building an API based Rails app and I've one endpoint to list down all active users account numbers and gold balance inside that account.
The requirement is:
1. Take all active users (kyc_pas...
Zulhilmi Zainudin replied
store_accessor with jsonb nesting
3
Rails
So Im building a user permits column with jsonb.
jsonb column
```permits:{
bar_permit: {
key1: [],
key2: "Bar",
key3: false,
key4: false,
...
Francisco Quinones replied
Solved
Is there a better way to simplify this?
9
Rails
Hi again,
I want to know if there is a better way to get a list of categories which only have products.
I have tried to do `@categories = Category.where(category_type: 'product').order(name: :as...
Chris Oliver replied
Solved
Routing question: Pass a 2nd parameter in the URL?
5
Rails
Hi again :)
I would like to know how to get my routes how i want them haha as we all do :) Basically i want to get the edit variant URL to be like `/products/:product_id/variants/:variant_id`
ins...
Chris Oliver replied
Solved
Was wondering id there is a way i can simply this ...
6
Rails
I was wondering if there is any way I can simplify this code, Ideally, I don't want to be looking up brands that are associated with the user, i want to do it on hit.
```
#Gets the ID associated t...
Alan Reid replied
Solved
Pull data from another table in a lookup
53
Rails
Hi all,
I am looking up a list of articles, depending on the brand ID's - `@articles = Article.where(brand_id: brand_ids)` what i would like to know is there a way to retrieve the brand name in thi...
Jacob Montgomery replied
Solved
How do i save a field in a separate table?
21
Rails
Hi all,
I want to save the brand_id i am creating in my users table how would i go about doing this? I currently have my code saving the brand.
````
def create
@brand = Brand.new(brand_params...
Chris Oliver replied
Solved
FAO: Chris... URL Errors on pretty much any Rails site
3
Rails
Hi I've come across a really weird bug, not just in my project but on quite a few rails sites.
`https://gorails.com/users/sign_in?redirect_to=%2F` - **works fine**
`https://gorails.com/users/SIGN_...
Alan Reid replied
Solved
Issue with devise
2
Rails
Hi all,
I am getting this error when i reset passwords - it throws to this error message. It still sends out the email, and allows me to reset the password. Any ideas whats causing this so i can fi...
Bill Tihen replied
Whats the best way to deal with JS in Rails?
1
Rails
In my quest to ever understand rails, i notice that Rails adds a few JS files to the bottom on my page.
Whats the best way to deal with this?
Looking at the likes of AirBNB they don't have this, s...
Alan Reid replied
Solved
How do i create another table when a user signs up?
2
Rails
When a user signs up, i ask them for their company name so i can then associate that user with a company. How would i go about doing this? I am using devise, so somehow i will need to store the com...
Alan Reid replied
Solved
Putting SignIn and SignUp in single page using devise rails
2
Rails
Is it possible to have sign in and sign up forms on the same page,and after sign in or sign up redirect to the index page?like twitter or facebook?
Alvi Mahadi replied
Solved
Devise: Add a select to my signup form
14
Rails
Hi all, me again! haha
So i have got my app working as i want so far. All is good and i am picking up Rails really quickly thanks to GoRails.
I am however a little stuck, I can't seem to add in a ...
Jacob Montgomery replied
Is anyone using Rails 5 yet?
6
Rails
The setup guides on the site recommend using Rails 4.2.6. I'm curious to know if we should be using Rails 5 now as it's been out for almost a month?
Cheers
Alan Reid replied
Solved
How do I get devise to use my custom routes inside of the authenticate_user!
0
Rails
I've declared custom routes in my app for a few of the devise actions, they are as follows:
````
devise_scope :user do
get 'signup', to: 'devise/registrations#new', as: :signup
get 'login', ...
Alan Reid posted
Better Errors ignore 404 errors
3
Rails
I'm using better_errors gem to track errors better. Any idea how to make it ignore 404 or ActiveRecord::RecordNotFound exceptions? I want to test to make sure my 404 page is working correctly and I...
Chris Oliver replied
Solved
Rails console hacks :)
2
Rails
Hi there,
I need some help how to handle the rails console commands. I'm really stuck here..
I've recently added a new column (teams) to my Sales and Orders model. Both models containing the user...
Chris Oliver replied
Solved