Category "ruby-on-rails-4"

How to check the sidekiq queue

In a separate tab, I'm running bundle exec sidekiq and in another tab I'm running: SendWithUsInviteeMailerJob.perform_async(invitee.id) which kicks off a jo

Rails: validate uniqueness of two columns (together)

I have a Release model with medium and country columns (among others). There should not be releases that share identical medium/country combinations. How would

Rails: rendering a partial for a nested resource

# routes.rb resources :topics do resources :bookmarks, except: [:index] end The view files for my Bookmark model live in app/views/topics/bookmarks: I re

Adding styling to rails react component wrapping div

I'm using react_component in my Rails project. This inserts a wrapping div for the react.js component, e.g. <div data-react-class="ButtonSwitchToTab" data-r

Opening ruby app from Rubymine terminal

I just got Rubymine and getting used to ruby on rails on mac , Im wondering if there is any command to open a ruby app on Rubymine 7 , from terminal would th

Change the default value for table column with migration

I try to change the default column value from false to true. But when I run rake db:migrate VERSION=904984092840298 I got the following ERROR. StandardError: A

Empty file_field on submit: param is missing or the value is empty

I have a application with dragonfly to manage my image uploads: ruby 2.1.3 rails 4.1.6 The upload works but on update action, when the file is empty, I have the

How do I drop a foreign key if it exists in Ruby on Rails?

There's a function called index_exists? in ActionRecord, but no foreign_key_exists? on Rails 4.2.7. So when I call remove_foreign_key :parties, :franchise_gr

Errno::ENOENT: No such file or directory @ rb_sysopen - /tmp/

I'm trying to push my app to Heroku, however I'm getting this rather arbitrary error: Errno::ENOENT: No such file or directory @ rb_sysopen -\ /tmp/buil

Rails public folder items not available in production

I have a few items that are accessible just fine in development mode within the /public directory of my app: favicon.ico, robots.txt. I can view these in devel

RegExp \A \z doesnt work, but thats what Rails 4 requires

I recently switched to Rails 4 and the security requirements no longer seem to allow the use of regular expressions in the style of /^..$/. The error states th

Rails STI query all subclasses using base class

Imagine I have this STI table called living things with these such subclasses: class LivingThing < ActiveRecord::Base end class Animal < LivingThing end

Multiple route aliases in Rails 4

I have a Rails 4 application with some routes: resources :users resources :notifications resources :comments ... My client asked me to have urls in english a

Rails 4 stylesheet_link_tag sometimes uses relative paths?

I have this weird problem, where sometimes, stylesheet_link_tag links to the relative path to the wrong path? The exact same code works whenever I try to debug

How do I add an uncountable inflection for a non-word character in Rails

In a Rails app I have a number of measurements to display in a human readable form that include both a value and units. Sometimes the units string needs to be

An error occurred while installing unf_ext (0.0.7.2), and Bundler cannot continue

I was trying to install diaspora into localhost. I removed the Gemfile.lock file and tried bundle install and am seeing this. These are the things I already tr

enum option "new" not working

I am trying to create an enum on my model and I would like one of the states to be "new" e.g. enum status: { stale: 0, new: 1, converted: 2 } It seems rails

Parametrized join in Rails 4

I am doing manual join and I need to pass a parameter to its ON clause: Foo.joins("LEFT OUTER JOIN bars ON foos.id = bars.foo_id AND bars.baz = #{baz}") Is t

Parametrized join in Rails 4

I am doing manual join and I need to pass a parameter to its ON clause: Foo.joins("LEFT OUTER JOIN bars ON foos.id = bars.foo_id AND bars.baz = #{baz}") Is t

Parametrized join in Rails 4

I am doing manual join and I need to pass a parameter to its ON clause: Foo.joins("LEFT OUTER JOIN bars ON foos.id = bars.foo_id AND bars.baz = #{baz}") Is t