Skip to main content

Questions tagged [ruby-on-rails]

Ruby on Rails is an open-source web development framework written in Ruby. If your question code is written in Ruby on Rails, tag with Ruby as the language tag. Many things are defined by convention, freeing you from having to re-invent things to stay productive.

Filter by
Sorted by
Tagged with
3 votes
1 answer
173 views

Parsing GPS data

Recently I sent this code snippet as CV attachment and I got simple answer - this code smells and we employ another developer. I'm new to RoR, so guys can you give me directions to refactor this code ...
Aleksandr K.'s user avatar
28 votes
4 answers
15k views

Unit-testing a controller in Ruby on Rails

I intend this to be a general question on writing an effective set of test cases for a controller action. I include the following ingredients: Ruby on Rails RSpec: A testing framework. I considered ...
Steven's user avatar
  • 281
9 votes
2 answers
4k views

Using I18n in capybara feature specs

Here I am trying to avoid hardcoding in flash messages by using I18n. Also, I have tried to use a CSS selector for submitting the form to make the tests less brittle (I don't really care that much ...
papirtiger's user avatar
2 votes
2 answers
141 views

Transfer the format of an old string to a new string

First, I've extended the String class to detect uppercase and lowercase characters: ...
Starkers's user avatar
  • 195
1 vote
1 answer
48 views

Rails session after migrate from PHP (improved)

previusly I make a post for Session Logic for User Verification in Rails Migration. Now the improvement version following advice of the comments is here. The problem was the use of `` for executing in ...
ZAMA's user avatar
  • 35
1 vote
1 answer
543 views

Update subscription

First, some background. I have a Payment model that has_many :subscriptions. When a user pays (creates a new payment), I have an ...
GorrillaMcD's user avatar
1 vote
2 answers
215 views

Removing duplicate hashes in an array while keeping count of the times the hash was present

I have an array of hashes (price_params['items']) where each item has a key called quantity what I'm trying to do is to clean ...
Sebastian Delgado's user avatar
0 votes
0 answers
1k views

Unit-testing authorization policies in Rails with RSpec

The following specs test the authorization setup of the Post resource in a Rails 4.2 application. The Pundit gem is used for authorization but I believe the specs ...
BrunoF's user avatar
  • 153