Skip to main content
The 2024 Developer Survey results are live! See the results

Questions tagged [ruby-on-rails]

Ruby on Rails is an open source full-stack web application framework written in Ruby. It follows the popular MVC framework model and is known for its "convention over configuration" approach to application development.

179 votes
4 answers
60k views

Ignoring time zones for Postgres timestamps

I'm dealing with dates and times in Rails and Postgres and running into this issue: The database is in UTC. The user sets a time zone of choice in the Rails app, but it's only to be used when getting ...
99miles's user avatar
  • 11.2k
413 votes
7 answers
123k views

What is the difference between <%, <%=, <%# and -%> in ERB in Rails?

Can some one please describe the usage of the following characters which is used in ERB file: <% %> <%= %> <% -%> <%# %> what's the usage of each one ?
simo's user avatar
  • 24.2k
286 votes
14 answers
145k views

Is Ruby pass by reference or by value?

@user.update_languages(params[:language][:language1], params[:language][:language2], params[:language][:language3]) lang_errors = @user.errors logger....
Sid's user avatar
  • 6,234
244 votes
6 answers
196k views

Override devise registrations controller

I have added a field to the sign-up form that is based on a different model, see How do I use nested attributes with the devise model for the gory details. This part is working fine. The problem now ...
Craig McGuff's user avatar
  • 3,978
362 votes
7 answers
313k views

raw vs. html_safe vs. h to unescape html

Suppose I have the following string @x = "<a href='#'>Turn me into a link</a>" In my view, I want a link to be displayed. That is, I don't want everything in @x to be unescaped and ...
grautur's user avatar
  • 30.3k
291 votes
38 answers
291k views

SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed

I am using Authlogic-Connect for third party logins. After running appropriate migrations, Twitter/Google/yahoo logins seem to work fine but the facebook login throws exception: SSL_connect returned=...
Vikash's user avatar
  • 2,927
257 votes
19 answers
177k views

WARNING: Can't verify CSRF token authenticity rails

I am sending data from view to controller with AJAXand I got this error: WARNING: Can't verify CSRF token authenticity I think I have to send this token with data. Does anyone know how can I do ...
kbaccouche's user avatar
  • 4,605
207 votes
7 answers
81k views

config.assets.compile=true in Rails production, why not?

The default Rails app installed by rails new has config.assets.compile = false in production. And the ordinary way to do things is to run rake assets:precompile before deploying your app, to make ...
jrochkind's user avatar
  • 23.2k
1063 votes
11 answers
230k views

Understanding the Rails Authenticity Token

What is the Authenticity Token in Rails?
Ricardo Acras's user avatar
992 votes
51 answers
436k views

Can't find the 'libpq-fe.h header when trying to install pg gem

I am using the Ruby on Rails 3.1 pre version. I like to use PostgreSQL, but the problem is installing the pg gem. It gives me the following error: $ gem install pg Building native extensions. This ...
demonchand's user avatar
  • 11.4k
647 votes
6 answers
248k views

How to use concerns in Rails 4

The default Rails 4 project generator now creates the directory "concerns" under controllers and models. I have found some explanations about how to use routing concerns, but nothing about controllers ...
yagooar's user avatar
  • 16k
105 votes
13 answers
77k views

ExecJS::RuntimeError on Windows trying to follow rubytutorial

UPDATE: Colin's suggestion of removing the line //= require_tree . has fixed the issue. I have wasted over 2 days trying to follow every suggestion out there and fix my issue. I am trying to follow ...
user1687078's user avatar
  • 1,373
1214 votes
15 answers
336k views

How to understand nil vs. empty vs. blank in Ruby

I find myself repeatedly looking for a clear definition of the differences of nil?, blank?, and empty? in Ruby on Rails. Here's the closest I've come: blank? objects are false, empty, or a ...
Arrel's user avatar
  • 13.6k
536 votes
33 answers
315k views

Error installing mysql2: Failed to build gem native extension

I am having some problems when trying to install mysql2 gem for Rails. When I try to install it by running bundle install or gem install mysql2 it gives me the following error: Error installing ...
spacemonkey's user avatar
  • 19.9k
286 votes
18 answers
270k views

Fully custom validation error message with Rails

Using Rails I'm trying to get an error message like "The song field can't be empty" on save. Doing the following: validates_presence_of :song_rep_xyz, :message => "can't be empty" ... only ...
marcgg's user avatar
  • 66.1k

15 30 50 per page
1
2 3 4 5
1816