Click here to Skip to main content
15,892,298 members
Everything / Rails

Rails

Rails

Great Reads

by Danny Chu
Learn how to detect if client has JavaScript enabled or disabled at your backend webserver
by Aleksandr Ulanov
What are Service Objects and how you can use them to make your app cleaner and keep it maintainable
by Aleksandr Ulanov
In this article, we'll go through the basics of Hotwire, as well as build a sample app using it.
by Rocky R. Fernandes
Install Rails 4 and MySQL Server on Windows 7/8

Latest Articles

by Aleksandr Ulanov
What are Service Objects and how you can use them to make your app cleaner and keep it maintainable
by Aleksandr Ulanov
In this article, we'll go through the basics of Hotwire, as well as build a sample app using it.
by datarockets
Finding a vulnerability, using it for data extracting from the database, and fixing it with just one line of code
by Programming Tutorials by Tests4Geeks
In this tutorial, you'll see a very simple example of how to send a JavaScript response from the server and some of the more interesting things that can be done.

All Articles

Sort by Updated

Rails 

24 Sep 2022 by Chang Zying
I’m new in Ruby on Rails, how can I get the outlet id which is not at the product migration table , because category id has at product migration table, I can get it through product but how outlet id? I want to get it and put at the add item there...
29 Aug 2022 by Aleksandr Ulanov
What are Service Objects and how you can use them to make your app cleaner and keep it maintainable
11 Aug 2022 by Aleksandr Ulanov
In this article, we'll go through the basics of Hotwire, as well as build a sample app using it.
20 Jun 2022 by Member 12214576
it's my first time using rails,redis and sidekiq,and I have been facing this error all day and didn't reach any solution , I saw a lot solutions to this error but it didn't work for me, so I don't know where's the problem when i try the end...
20 Jun 2022 by Richard MacCutchan
https://dev.to/ben/nomethoderror-undefined-method-for-nil-nilclass-explained-422b[^].
5 Oct 2021 by Member 11164169
def group_by_owners(files) better_hash = Hash.new { |hash, key| hash[key] = [] } files.each_with_object(better_hash) {|(k, v), hash| hash[v] 'Randy', 'Code.py' => 'Stan', 'Output.txt' =>...
5 Oct 2021 by OriginalGriff
Do you have any idea how much work explaining code line by line is? Every single line needs a paragraph of explanation! For example: int next = r.Next(); Create a new variable called "next" which can hold a integer value. From...
27 Jul 2021 by Marchan4
My ruby ​​version is 2.6.6, my mysql version is 8.0.23, my mysql2 version is 0.5.3, my bundler version is 2.2.21, my rails version is 5.0.7.2, and my Xcode version is 12.5. I use macOS Big Sur(version 11.4) and the text editor "Atom". I'm...
27 Jul 2021 by Richard MacCutchan
$ export SECRET_KEY_BASE=GENERATED_CODE What is the $ sign in column 1 supposed to be for?
2 Jul 2021 by datarockets
Finding a vulnerability, using it for data extracting from the database, and fixing it with just one line of code
25 Apr 2021 by Member 13968986
I have installed Pervasive V10 server x86 and odbc gem. Whenever I make a request to fetch data from the database, I get the following error "IM003 (160) Specified driver could not be loaded due to system error 1114: A dynamic link library (DLL)...
29 Apr 2020 by MadMyche
What you are proposing will be a hybrid. Role Based Authorization Users can be assigned into various roles (eg DocumentAdmin) and then those roles are mapped to the documents User Level Authorization aka Access Control List User permissions are...
29 Apr 2020 by Member 14817567
I have a relatively complex model association in mind, and was wondering how I could accomplish it. In essence, this is what i want to accomplish. - I have a User model, and a Document model - User A can create a document. He is now the...
8 Nov 2019 by Member 14471936
First of all sorry for my poor english. It's my first time working with ruby on rails and i don't have so much idea. I have a redmine proyect mounted in a virtual machine, i can access to it writting my ip an it works. But the problem is when i want to enter from an external link, (i have my...
3 Apr 2019 by Member 14200783
This is my index.html.erb This is my edit.html.erb:
29 Mar 2019 by Member 14200783
I just started my rails. I try to set routes but my controller format has an underline. Therefore I do not how to write route. What I have tried: This is my controller file name: method_types_controller.rb This is what I have tried on my route: Rails.application.routes.draw do # For...
26 Jun 2018 by rikidev
Hi I'm creating a PDF with prawn, how can I do to align the texts here that you see in the image below at the same height? Report Image What I have tried: Prawn::Document.generate("my.pdf") do image logo,:width=>540,:height=>60 text "Spett.le ",:align=>:right move_down 5 text...
4 May 2018 by Member 12694539
I have created a gallery module with the help of this tutorial https://kolosek.com/carrierwave-upload-multiple-images/ and now I wanted to add one more image attribute has a master image to the same model. So I thot of creating one more uploader. The code works fine but when I upload multiple...
9 Jan 2018 by Programming Tutorials by Tests4Geeks
In this tutorial, you'll see a very simple example of how to send a JavaScript response from the server and some of the more interesting things that can be done.
29 Nov 2017 by Danny Chu
Learn how to detect if client has JavaScript enabled or disabled at your backend webserver
6 Mar 2017 by Member 13041006
Hello,thanks a lot for you help. I am having some issues in understanding how fields_for works. I have a location model that has_many :ads. I would like to do a form for filtering locations and ads. I am thinking of using the following syntax:
6 Mar 2017 by Member 13041006
Ok. I found out the solution using nested attributes hear is the link to the explanation.Ruby on Rails, two models in one form - Stack Overflow[^]
20 Jan 2017 by Member 12960523
Hi, I am trying to build a ruby on rails application but I am unable to resolve this issue:ERROR["test_should_redirect_update_when_not_logged_in", UsersControllerTest, 3.086077447998832] test_should_redirect_update_when_not_logged_in#UsersControllerTest...
16 Sep 2016 by Paul Yi
I have button/link that takes a screenshot when clicked. How can I automate this to click the link on all pages to take the screenshot by a script so I can have all screenshots available. Trying to avoid having to go to all pages to click that button manually. Possibly through a rake but I've...
24 Aug 2016 by Member 12701313- questforimprovement
I'm trying to create a planner for teachers, as a personal project, where the Users (teachers) can click on a day (in a calendar, that's been already created) leading to a page where they can add a Subject, Hours, Class. All of this, along with the User_id and Day should be updated in the...
24 Aug 2016 by Member 11114915 - Tanvi
There could be two way to reach the solution here on the basis of front end developed to enter the details(by user).1). If on front end dropdowns/Radiobuttons has been used to select Hours, Subject, class then your plan is perfect.2). If user is entering details in textboxes manually...
17 May 2016 by dravoss
Hello ,i tried to use this code to replace any __Random_and[x,y] with rand(x,y) but it didn't run please help me function charCallbackRand($matches1){ $charOne = (int)$matches1[1]; $charTwo = (int)$matches1[2]; return rand($charOne,$charTwo); } $myword =...
17 May 2016 by Patrice T
RegEx only apply on strings, not on code.function charCallbackRand($matches1){ $charOne = (int)$matches1[1]; $charTwo = (int)$matches1[2]; return 'rand('.$charOne.','.$charTwo.')'; } $myword = '__Random_and[22,95]'; $result =...
17 May 2016 by George Jonsson
Instead of using a preg_replace_callback() you can directly insert the wanted numbers from the original text with preg_replace()Try this:$string = '__Random_and[22,95]';$pattern = '/__Random_and\[(\d+),(\d+)\]';$replacement = 'rand($1,$2)';$result preg_replace($pattern,...
11 May 2016 by Member 12517047
I have a model with a methodclass Post
28 Apr 2016 by Supraja05
Hi, I'm working on a ruby on rails project. In a particular view page, I have used jQuery. This page has a table with (say ) 10 columns. Initially only 5 columns is show and rest are hidden. For hiding columns I have used jQuery. I have included jquery-rails gem jquery-ui gem and all...
28 Apr 2016 by Karthik_Mahalingam
check thisjQuery The noConflict() Method[^]Avoiding Conflicts with Other Libraries[^]jQuery.noConflict() | jQuery API Documentation[^]
15 Apr 2016 by Member 12460784
I would like to know if you provide the service to edit pdf in browser within my web application just like any pdf editor. By clicking save will save the changes done. Currently It can be in any platform either PHP, ROR or Python or javascript or juqery. Please advice?What I have...
15 Apr 2016 by Sergey Alexandrovich Kryukov
Your question assumes that you have some PDF editor, only have problem embedding it, but you did not show anything like that. Please see my comment to the question. Even though, formally, PDF can be edited, as any other file, but in practice it is nearly complete nonsense. However, I faced...
6 Apr 2016 by Member 11617113
I have two models. models/Resident.rb : has_many: leavesmodels/leave.rb: belongs_to: residentNow what I want to validate leave model attributes before they get created..leave.rb attributes : start_date,end_date,destinationhere is my leave model:class Leave
31 Mar 2016 by Member 12168752
im trying to upgrade my project from ruby 1.9.3 to ruby 2.3.0, and the rails version from rails 3.1.4 to rails 4.2.6 , after updating my gem files, i get an error "Bundler is using a binstub that was created for a different gem.". What should i do?What I have tried:I tried bundle update,...
22 Mar 2016 by Poombavai
Hi..I want to make some of my text fields to auto fill with zero(0), when the user selects NA in dropdown.. How can I achieve that? Is there any rails way to do that??What I have tried:I have seen lot of jquery to accomplish auto fill values.. I am new to rails as well as am zero at...
16 Feb 2016 by Jason Floyd
Use Mina to deploy a Ruby on Rails app quickly and easily.
30 Nov 2015 by rudy-peto
Ups!Sorry, my mistake.. I found it! p = a('number').to_iThen I can add the value by 1 easily..
30 Nov 2015 by rudy-peto
Hi, I really appreciate any respond for this simple question.test = Model.find_by_sql("SELECT number FROM tbl_one LIMIT 1").each do |a| p = a('number') puts pendLook, I mean, after store a value to 'p', how do I add the 'p' value by 1.puts p + 1I tried it but doesn't...
8 Nov 2015 by Memthoi
I need an image gallery with zoom effect and thumbnails for ruby on rails.I have tried many jquery image gallery but its not working on rails. Please help .
5 Nov 2015 by Mehdi Gholam
No, an example of the others : https://www.digitalocean.com/community/tutorials/how-to-use-mysql-with-your-ruby-on-rails-application-on-ubuntu-14-04[^]
5 Nov 2015 by TheWajid
Is SQLite is the only supported Database Management by Ruby on Rails?
20 Oct 2015 by priya dharshan
This is called Arrow functions.An arrow function expression (also known as fat arrow function) has a shorter syntax compared to function expressions and lexically binds the this value. Arrow functions are always...
19 Oct 2015 by E.F. Nijboer
It is called a Hash Rocket. Used for creating hashes like this {key1 => value1, key2 => value2}By the way, new style syntax (Ruby 1.9) is: {key1: value1, key2: value2}Good luck!
19 Oct 2015 by priya dharshan
Can anyone know the meaning for the following symbol in rails?=>def update account = Account.find params[:id] permitted = params.require(:account).permit(:name, :otherparam) account.update_attributes permitted render :json => accountendfor what purpose we need to use...
23 Aug 2015 by Martin Zinovsky
Hi guys!I have archive about 2gb size and I need to add bunch of the txt/config files in response on user interactions. How can I do that in ruby/rails?Thanks!
20 May 2015 by Torakami
I am new on rails. Below is what i am tryingclass Category
7 May 2015 by hai nguyen ngoc
ActiveAdmin.register Link do member_action :scan, method: :get do resource.scan_jobs # => Resque.enqueue_at( 1.minute.from_now, resource.scan_jobs ) ? redirect_to '/', notice: "Scan!" end index do selectable_column Link.column_names.each do |field| ...
30 Apr 2015 by Torakami
Hi , I have created one controller and added default 7 action methods , I have also created 4 views and those are index , new , show , edit all contains difeent data also added resources :posts controller configuration into my routing file as well 'My problem is when i try to...
29 Apr 2015 by Nagy Vilmos
I am building a small app using Ruby on Rails, and I am trying to rationalise my views.Every view [.html.erb] is becoming the same thing: Page Title ...
3 Apr 2015 by Syed Muhammad Ali Gardezi
I am trying to figure out the problem(I am new to ruby ) that I am facing but I can't figure out the problem. I can't figure out how to explain the problem so if you have an doubt you can ask.now getting to the main question When ever updateRequest function of the request is called it throws an...
15 Mar 2015 by User 59241
There are a number of RoR forum engines to choose from. Maybe start by having a look at them:https://www.ruby-toolbox.com/categories/forum_systems[^]You did not say why you want to do this because there are many easier ways to set up a forum.
15 Mar 2015 by manchanx
Here's an online book on Ruby On Rails: https://www.railstutorial.org/book/beginning[^]From the first paragraph:[..] the Ruby on Rails Tutorial will give you a thorough introduction to web application development, including a basic grounding in Ruby, Rails, HTML & CSS, databases, version...
14 Mar 2015 by Braydon
I'm looking for a tutorial on how to make a forum using Ruby On Rails.I've looked for something but I can't seem to find anything so can someone else help me?I would be Very Glad!!
9 Mar 2015 by Mdzzzl5
Not trying to seem smart-alecky, but have you opened config/database.yml and filled it in with the correct values to access your database? That would be my first guess. If you've left the default values, Rails can't access the db.
18 Jan 2015 by Member 11285361
i need to make a console program in ruby on rails for cronjob. which send emails to all email id's which are exist in database after every 5min duration,
12 Jan 2015 by Hapisha
I m trying to install redmine on my PC using the installation step http://www.redmine.org/projects/redmine/wiki/redmineinstall[^] found here. but getting the error please configure your config/database.yml first while executing the command "rake generate_secret_token" . i need help on this...
6 Jan 2015 by Gregory Gadow
I've been learning Ruby, and would like to translate some Response filters I had written in VB.Net some years ago. I have been told that Rails has an equivalent slot, where you can modify a document after it has been processed by Rails but before it is delivered to the user. My sources disagree...
14 Dec 2014 by Member 10789046
I've made a functional mini social network app in Rails. I'm using the Sync gem in order to make my app realtime so that when a user posts something, it'll immediately show up on their home feed. I feel like I'm extremely close to making this work. The form works and there are no run-time errors...
13 Dec 2014 by Member 11309086
I have created a rails app for booking cabs online. I want my app to have the functionality of sending emails to users once their booking is confirmed. For this, I am following Ryan Bates railscasts: `https://www.youtube.com/watch?v=v1KI571TdUQ`I started with creating a setup_mail.rb...
25 Aug 2014 by Member 8065843
Do you have any article which describes about Making a Class Schedule Using a Genetic Algorithm using ruby on rails?
22 Jul 2014 by Rocky R. Fernandes
Install Rails 4 and MySQL Server on Windows 7/8
18 Jul 2014 by Viral Prajapati
please help me to solve it...i am working in ruby with store procedure with following code.... call_stored_proc_verb="exec" name="dbo.SpData" args=1 sql = "#{call_stored_proc_verb} #{name} #{args}" results=ActiveRecord::Base.connection.execute(sql) ...
11 Jun 2014 by Mdzzzl5
I would suggest, as a good starting place: Make Your Own Gem from the RubyGems website[^]Hope that helps
2 Feb 2014 by Richard MacCutchan
This question is far too broad for a Quick Answers forum. Try https://www.google.com/search?q=ruby+on+rails+controller+spec[^].
2 Feb 2014 by Member 10535639
Plz ..in deatail ...what this spec do while start a rail application
31 Jan 2014 by E.F. Nijboer
Yeah, it simply checks that you don't use publicly known information as a password because that would make it to easy to break it. Good lucl!
27 Jan 2014 by Kornfeld Eliyahu Peter
I Googled it for you:Quote:add textbox value to listbox using jquery
27 Jan 2014 by Tadit Dash (ତଡିତ୍ କୁମାର ଦାଶ)
If you want to do it in JavaScript, then analyze the HTML rendered on browser for the ListBox.Suppose it is a table having rows for each item. So, you need to create one new row and append that to the existing table. That will create a new ListBox item.That's it.
27 Jan 2014 by Bindi Bhatt
Currently i'm not having any code , i'm not getting the way to do this but i want to learn asap ,so please anybody can help me with this. I'll glad if any can do this .Thank You