Ruby on Rails is an open-source web development framework optimized for programmer happiness and maintaining sustainable productivity. Many things are defined by convention, freeing you from having to re-invent things to stay productive.
-4
votes
0answers
27 views
I need advice about Pjax [on hold]
I have to do a website for a radio with a continuous sound system like SoundCloud.
The solution is to use Javascript and History API in order to navigate, without reloading all the page. I found the ...
2
votes
2answers
60 views
Does RESTful response always return a 404 and empty content when an array is expected but the result is empty?
I worked with Ruby on Rails and RESTful api before and now with Django Rest framework. For this question let's say we only consider the case of JSON but not XML. It seems that when we expect an ...
1
vote
3answers
167 views
Using multiple languages
I currently have a website running PHP laravel. We came to a point where we want to add a user-backend -- where users sign-up and can access functions when logging in.
My question is; Is it possible ...
3
votes
1answer
60 views
Increase code duplication to simplify business rules in views
I am in the process of writing a Ruby on Rails web application for my university's department.
For some of our resources in the web application, e.g. Project, are complex with their view layer logic:
...
2
votes
1answer
126 views
How to implement a (truly) global variable in a Rails app
How can I best implement a global counter in a Rails API app? (A central component in a system with several.)
Basically I have a transaction id I need to increment and roll over past a maximum value. ...
0
votes
1answer
70 views
Ruby: Abusing mixin
I'm currently working with some code that IMO has abused ruby's mixin features. Given that I'm new to ruby, I wonder if MO in IMO is correct or not.
My primary question is what makes more sense (and ...
1
vote
0answers
39 views
Why separate routes and controllers in MVC backend applications?
I've dabbled in a few MVC frameworks (like Rails and its ilk) and I've noticed that the file that defines restful routes often go separate from controllers which hold the actions executed through ...
4
votes
1answer
55 views
Adding permission levels in Rails
So I'm making a bug tracker to help me learn Ruby on Rails. My current setup is something like this:
Each Project has_many :metadata and has_many :permissions, through: :metadata. Also some other ...
-2
votes
2answers
93 views
Tables vs. Booleans: Which of the two are more secure for setting admin roles in an app? [closed]
I'm currently in the process of setting up roles where there are regular users, admins, and super admins, each of which have special permissions. I deferred to this post on how to do so.
It ...
0
votes
1answer
201 views
Best way to design a database interface [duplicate]
This is my situation
I have a website, mobile client and desktop client.
They can all pretty much do the same operations (website might be able to do more now but in the future they might have the ...
3
votes
1answer
131 views
Can a model have itself as a foreign key?
I am doing a coding project in rails. I have a user model, and I want to add a "spouse_id" to it (which would reference other users). Can a model reference itself in a foreign key?
1
vote
1answer
134 views
Rails validation: Which method is preferred
In Ruby on Rails there are two ways to validate, for instance, the presence of input fields. Say I want to make sure the user has filled out my fields called value and name. I could put in my model ...
1
vote
5answers
436 views
MVC - Checking data in the model or the controller?
I'm currently creating a web application with Ruby on Rails and I'm facing an conceptual problem about the MVC pattern.
If I need to check, for example, if the name of a data that I want to add in ...
1
vote
2answers
94 views
Using self.method vs the scope :method DSL
According to the Thoughbot Rails Style Guide, we should
Use def self.method, not the scope :method DSL.
My question is: is this simply for the sake of choosing one of these styles and sticking ...
1
vote
2answers
171 views
Is there a better pattern for a form object populating itself in 3 different ways?
So I'm writing a form object that deals with a specific thing - price - which is going to be included in several different underlying resources. (The Price is a separate model that may or may not need ...
2
votes
2answers
701 views
Is setting “permanent” persistent login cookies a bad practice?
I realized that in Rails there is a built in permanent method for its persistent login cookies (aka. "remember me" cookies) method to give the client a cookie that expires in 20 years:
...
2
votes
3answers
280 views
Which is the convention in Rails to perform calculations and display the results?
So I'm working on a personal project on Rails to learn more about this framework, and I wanted to add a feature in which the user choose a particular record from the view, and after some calculations ...
3
votes
1answer
304 views
Any way to use VoltDB in rails app?
I've been curiously looking at VoltDB and one year ago I have even seen a gem that was providing Ruby connection to VoltDB. I have checked today again and it seems gone.
I'm planning to go through ...
1
vote
1answer
65 views
Database integration of Rails and Laravel apps
I have some very small apps on a VPS running ruby on rails and a co-worker also have some of his own apps running on laravel at another VPS.
So far we dont needed to share any data among the apps, but ...
51
votes
6answers
9k views
Should Latin-1 be used over UTF-8 when it comes to database configuration?
We are using MySQL at the company I work for, and we build both client-facing and internal applications using Ruby on Rails.
When I started working here, I ran into a problem what I had never ...
-1
votes
1answer
261 views
Is there any harm in using amazon AWS as a development environment? [closed]
What modifications do I need to make to my workflow, and which skills do I need to learn in order to develop with Ruby On Rails on a Linux cloud server on Amazon Web Services (AWS)?
In particular, I ...
1
vote
1answer
145 views
What's the best practice for adding a lot of attributes to a Rails model?
So, I'm building an API wrapper gem that works with Spree's Product model. The API provides extensive customization of the data you send to it. I would like a user of the gem to be able to take ...
0
votes
1answer
262 views
ActiveRecord equivalent in Java [closed]
My question is fairly simple.. What is the closest ORM to ActiveRecord that I'd be able to find for Java?
In other words, in terms of thinking patterns and knowledge, with limted development time, ...
3
votes
2answers
320 views
S3 image urls in database
I have an application where users will be able to upload multiple images for one Product (via something like Ryan Bates nested fields, so you'd click "Add Image", and a file upload would appear on the ...
-1
votes
1answer
122 views
Is obsolete to study older versions of Ruby and RoR? [closed]
I want to study Ruby and RoR for some things I'll have to make, but almost every book, videos or any kind of source I find is outated, where the most current book I could find (link here) is one of ...
-3
votes
1answer
184 views
PHP vs ROR for AJAX and responsive design [closed]
I'm in the planning phase of making a website for calculating various mathematical problems, as a school/sparetime project with a couple of friends. We're gonna start off with implementing a "right ...
1
vote
1answer
131 views
Incorporating web designer's into a rails app
I have a designer who has great knowledge of HTML, CSS and JavaScript (Not jQuery or AJAX though).
He gives me his designs in those files and I have to incorporate it into my apps.
The site is not ...
3
votes
1answer
914 views
Rendering head :ok vs head :no_content. Any good practices?
Whenever I take in data and do something like delete a post, etc. I generally return head :no_content.
For example:
def destroy
@post = Post.find_by(external_id: params[:post_id])
@post.destroy!
...
3
votes
2answers
727 views
Where to load data for things like a sidebar in MVC frameworks?
This seems extremely basic, but I've read a lot of related questions and haven't found a proper answer.
Using Ruby on Rails or other similar MVC framework, how am I supposed to load data that is ...
1
vote
1answer
149 views
How to scrub Twitter and Facebook posts for many users
I'm making an Rails app that in theory should scrub new posts from the users facebook and twitter accounts and put them in a timeline for an analyst to analyze and determine if they are good or bad ...
1
vote
1answer
86 views
How do rails project know about rake tasks from other repositories
We have a rake task called db:sanity_check which exists in a 'core' repo.
Other repositories that we have also show this rake task.
But they do not define the rake task. It 'comes' from core'
How ...
1
vote
1answer
280 views
Should I be writing feature or request specs?
I've been writing model specs for a while now and I'm gradually moving towards integration testing. Right now, I'm looking at the best way to test the output of my ActiveAdmin dashboard but I'm unsure ...
1
vote
1answer
394 views
Should I use expect or should when writing RSpec specs? [closed]
Please can someone explain to me how I should go about deciding whether to use expect or should syntax for my rspec examples.
From my understanding we should no longer be using the 'should' syntax.
...
0
votes
1answer
81 views
Calculate which quantity packages to use based on quantity of bookings
In my app, many appointments can be booked for activities. Each activity has many price packages with a price and a quantity.
On showing the cart, I need to work out what combination of packages ...
1
vote
1answer
98 views
Ruby on Rails application interfacing with a Datamax barcode printer [closed]
I am trying to find a standalone way to interface with a Datamax M-Class Mark2 label printer through a Ruby on Rails application. I currently have a solution that is working, which i use javascript to ...
3
votes
0answers
264 views
Splitting up a Rails/Ruby app onto multiple servers
We recently moved a large application to two machines, both running the same codebase.
I. Machine A
Web server for public facing application
Receives web hook call backs from our ESP
Handles a ...
1
vote
1answer
37 views
A container only assets in Rails
I have multiple segmented Rails apps that are connected to each other:
App A
App B
App C
While I try to keep the design, such as header and footer, to look similar, but each app has its own ...
0
votes
1answer
304 views
Refactoring a Single Rails Model with large methods & long join queries trying to do everything
I have a working Ruby on Rails Model that I suspect is inefficient, hard to maintain, and full of unnecessary SQL join queries. I want to optimize and refactor this Model (Quiz.rb) to comply with ...
2
votes
1answer
630 views
Rails Google Cloud Messaging with heroku
I'm looking at using GCM to send notifications from my rails app to an Android app. The getting started guide says:
In the resulting configuration dialog, supply your server's IP address.
I'm using ...
-1
votes
1answer
78 views
Web app that runs other applications? [closed]
I am trying to write a web application that interacts with a service that would run scripts at the system level. Something like a website that you can schedule a job, the service will run the job with ...
3
votes
1answer
221 views
Do Rails Join Models Get Controllers?
I have a rails app where my users can buddy up with other users. Since that relationship can have a status (approved/rejected/pending), I decided to go with a join model (UserRelationship) so now I ...
1
vote
1answer
105 views
How to Structure a Trinary state in DB and Application
How should I structure, in the DB especially, but also in the application, a trinary state?
For instance, I have user feedback records which need to be reviewed before they are presented to the ...
1
vote
1answer
187 views
Where does Rails get its datetime for creating records?
I have a rails app with a data model called 'jobs' and I'm faced with a critical design choice crossroads.
I don't know enough about Rails and its inner workings to be able to say for sure what I ...
2
votes
1answer
180 views
Serialized values or separate table, which is more efficient?
I have a Rails model email_condition_string with a word column in it. Now I have another model called request_creation_email_config with the following columns
admin_filter_group:references
...
2
votes
2answers
692 views
Is is OK to use a non-primary key as the id in a rails resource?
I am getting ready to set up a resource for some new api calls to my rails application.
I am planning on calling the resource devices ie
resources :devices
This is going to represent android ...
0
votes
1answer
638 views
Rails engine testing - use dummy app or real parent app?
I'm using Rails engines to break up a big app into smaller pieces. The parent app mostly handles users and authentication.
In one of my engine tests I want to log in a user before each test. How ...
2
votes
2answers
257 views
Need advice on design in Ruby On Rails
For personal educational purposes I am making a site for a conference. One of the object that exist in a conference is a session, which has different states and in each state it has slightly different ...
0
votes
1answer
545 views
Create a loop that visits every link on a site [closed]
I want to create an HTML scraper in Ruby on Rails and I want to implement a progress bar and an ability for it to pick up where it left off if it's interrupted while scraping.
I think the best way to ...
1
vote
3answers
261 views
Why does Rails do config in code?
According to the Pragmatic Programmers, code should be for abstractions, while configuration and details should live in metadata. Rails seems to diverge dramatically from this pattern. Much config is ...
1
vote
1answer
262 views
Should an object update itself?
I'm working on Ruby on Rails. There is a feature in our app where doctors can "claim" cases for themselves.
I can either have the doctor perform the action and update the plate, or I can have the ...