Questions tagged [ruby-on-rails-4]

For issues specific to version 4 of Rails. If your question applies to Ruby on Rails in general, use the tag [ruby-on-rails].

Ruby on Rails 4.0, "an open-source web framework that's optimized for programmer happiness and sustainable productivity." Rails 4.0 brings a bunch of new features and improvements over older Rails versions.

See Ruby on Rails 4.0 Release Notes for more information.

Multiple sub-versions have been released, namely 4.0, 4.1 and 4.2. Questions regarding specific sub-versions of Ruby on Rails 4.0 can also be asked on the appropriate tags:

Resources

Related tags

36770 questions
7
votes
1 answer

Rails actionmailer, send mail at a specific time

I have a rails app with actionmailer that sends reminders to customers. So I want to have emails sent at specific datetimes. How can I do that, or any action from the controller?
7
votes
4 answers

Bootstrap 3 Glyphicons not showing on rails production server

I am unable to load Bootstrap 3 Glyphicons fonts on my live server which are working perfectly on my local server but not on live server. I have tried each and everything from SO to everything but it still didnt work for me. Here is what I am…
user5084534
7
votes
1 answer

Devise: iOS “Add to Home Screen”

When I open my web app on my iOS device, login and restart Safari, I am still logged in. But when I add this page with "Add to Home Screen", each time I click the icon for that page, I have to login again. Is there a workaround for this with the…
karlingen
  • 13,800
  • 5
  • 43
  • 74
7
votes
2 answers

How to make helper methods available in a Rails integration test?

I have a helper file in app/helpers/sessions_helper.rb that includes a method my_preference which returns the preference of the currently logged in user. I would like to have access to that method in an integration test. For example, so that I can…
Marty
  • 2,132
  • 4
  • 21
  • 47
7
votes
1 answer

How do I hide "Save and Add Another" button from edit form in rails_admin?

I applied a rails_admin gem in my Rails app. I want to remove some unnecessary buttons in a specific model edit form, and add my own custom button instead. Please see the screenshot for what I'd like to remove.
ashvin
  • 2,020
  • 1
  • 16
  • 33
7
votes
1 answer

jQuery File Upload "Error - Empty file upload result" - Rails Application

I don't get why I'm getting this error? I've copied exactly from the source code example. I'm able to get everything loaded, and then when I try to upload (by clicking start), I get this error. But even if I'm getting this error, it still uploads…
hellomello
  • 8,219
  • 39
  • 151
  • 297
7
votes
2 answers

Push to Heroku fails: Could not find net-ssh-2.10.0 in any of the sources. Failed to install gems via Bundler

I tried pushing my app to heroku but get the following error: remote: -----> Using Ruby version: ruby-2.2.2 remote: -----> Installing dependencies using 1.9.7 remote: Running: bundle install --without development:test --path vendor/bundle…
Nick
  • 3,496
  • 7
  • 42
  • 96
7
votes
2 answers

Rails validating that a Has Many relationship has at least 1 entry

I have an event model. Each event can have multiple sessions. I want to ensure that no model can exist without it having at least 1 session associated with it. validates :sessions, :length => { :minimum => 1 } The problem is - when I go to try to…
RenegadeAndy
  • 5,440
  • 18
  • 70
  • 130
7
votes
1 answer

Routing concerns defining different param for resources

Recently I got to know about rails concerns in routes from this discussion How to have one resource in routes for namespace and root path altogether - Rails 4. Now in my application I have routes like this: namespace :admin do resources :photos …
Deepesh
  • 6,138
  • 1
  • 24
  • 41
7
votes
1 answer

How to load a conditional js file using modernizr now that yepnope is deprecated?

What are some good practices for loading a conditional javascript file using modernizr now that yepnope and .load are deprecated in the latest version of modernizr. Used to be able to use the .load…
MicFin
  • 2,431
  • 4
  • 32
  • 59
7
votes
1 answer

How to drop all schemas in PostgreSQL with SQL query?

I need to drop all the schemas in my database except public, information_schema and those LIKE 'pg_%'. Here's what I've found: (this variant doesn't seem to work) CREATE OR REPLACE FUNCTION drop_all () RETURNS VOID AS $$ DECLARE rec…
7
votes
1 answer

Ruby on Rails: Dropzone js, getting [object Object], but why?

I'm getting [object Object] on my thumbnails (the background image is the area where you can click on to upload photos... I'm not sure how to load up the normal box similar to the example in http://www.dropzonejs.com/) View <%= simple_form_for…
hellomello
  • 8,219
  • 39
  • 151
  • 297
7
votes
5 answers

Static 404 page Rails 4: how to use the asset pipeline?

I'm using Rails 4.2.3 and am trying to customize the 404 error page in public/404.html. How can I include images from the asset pipeline? There's an excellent post how to build dynamic custom error pages. However, as described there, it requires a…
Marty
  • 2,132
  • 4
  • 21
  • 47
7
votes
1 answer

Rake Assets Precompile without Gems in Development or Test Groups

Okay, so I've got an error while building my Docker image (think of it as similar to a deploy step, or Heroku deploy if you're unfamiliar with Docker). Gems that are in the :test and :development groups are being looked for when the precompile step…
Alex Lynham
  • 1,318
  • 2
  • 11
  • 29
7
votes
4 answers

Why is devise not displaying authentication errors on sign in page?

I'm using rails 4.2 I have a helper file called devise_helper.rb module DeviseHelper def devise_error_messages! return "" if resource.errors.empty? messages = resource.errors.full_messages.map { |msg| content_tag(:li, msg) }.join …
WhyAyala
  • 647
  • 7
  • 29