Rails 4 Ubuntu ignoring concerns folder - ruby-on-rails

I've been developing a Rails 4 app on Windows. I recently switched to Ubuntu (13.10) and brought my project over. I'm suddenly encountering a new error.
I have several controllers that use the same authentication logic, so I moved that code to a concern called "Authenticating.rb" and put it in my app/controllers/concerns folder. I then put
include Authenticating
at the beginning of each controller. This worked perfectly under Windows, but in my new Ubuntu version it throws this error:
Routing Error
uninitialized constant UsersController::Authenticating
When I comment out the include line it works just fine. Additionally it works if I explicitly require the concern file (require "#{Rails.root}/app/controllers/concerns/Authenticating.rb"). However I don't want to have to do this for every controller, and I shouldn't have to--Rails is supposed to load this automatically.
Thanks in advance for your help and advice.
EDIT: I should add that on Windows I was using ruby 1.9.3 and on Ubuntu I've moved to 2.0.0. Might this have something to do with it?

rename Authenticating.rb to authenticating.rb

Related

How to fix the warning: "DEPRECATION: action_cable.js has been renamed to actioncable.js – please update your reference before Rails 8"? (Rails 7.0.4)

I have a Ruby on Rails single page application using React as the front-end, and since we upgraded from Rails 6.1 to Rails 7.0, the warning "DEPRECATION: action_cable.js has been renamed to actioncable.js – please update your reference before Rails 8" appears on the browser console in almost every page of the application, except for static views (without forms or such) such as e-mails and the home page.Warning on the browser console
I've tried reviewing my Gemfile to make sure they are up-to-date, ran bundle update hoping that the problem was caused by an outdated gem, but the warning is still there. I've checked the project folder, and there is no "action_cable.js" or "actioncable.js" file, nor are there any references to those files/paths in any part of the code.
Does anybody have an idea on how to fix this warning? I couldn't find any information on how to do it, or other people that are having the same issue.
This is my first time posting here, so if there's any information missing, I'll be more than happy to share it!

Rails host app doesn't see engine layout

What I want to do works on my OSX dev machines and on a staging server. However, I encounter problems on the production server.
I have a Rails Engine which I have created, maintained, and used over the years: https://github.com/allesklar/tkh_admin_panel
It works fine on many apps and I have been porting it to this new website as of late. For admin views, my controllers render the 'admin' layout which is located on this engine.
Everything has gone great until I tried to deploy to the site's production server. I get the following error:
ActionView::Template::Error (no implicit conversion of nil into String):
This exception occurs in the line with the following code:
render layout: 'admin'
I can't pinpoint any differences in gems, rbenv ruby versions, or any other factor from one setup to the next.
I've tried to reset the binstubs and done a number of other things.
No matter what I do, it works on the staging server and not on the production server.
Please point me to some directions where I can investigate further.
UPDATE ---
The scope of the problem has changed entirely since now I'm experiencing the same issue on my development machines.
I therefore think the problem lies in the host app/gem relationship. The same version of this gem works fine with some other Rails host sites of mine.
Any ideas welcome.
Try to recompile all assets. If you can (it's a prod server) delete all assets and manifest and re-deploy.
Try to delete all cache, if you are using page or fragment caching, perhaps your deploy system is not cleaning it correctly.
Simply reboot the system (simple action that fixed a lot of problems in the past).
And if nothing works, try to display the full backtrace to see where this is happening

Rails 4.2 + Ember => unexpected identifier

I'm following Vic Ramon's tutorial. I tried to use the latest version of Rails and Ember-source and I get the following error when visiting home page:
After clicking on link next to error I get this:
How can I fix that?
I ran the following commands:
rails g ember:bootstrap -n App --javascript-engine coffee
rails g ember:install
I removed turbolinks. I also created home controller and an empty view for home#index. Root is set to home#index. Also created following view file:
// app/assets/javascripts/templates/application.js.emblem
h1 Hello World
outlet
Ember gems im using:
Using emblem-source 0.3.18
Using ember-data-source 1.0.0.beta.14.1
Using ember-rails 0.16.1
Using emblem-rails 0.2.2
This could be due to some version incompatibilities between your versions of ember-related gems, as there were quite substantial changes in recent versions of ember (e.g. introduction of HTMLBars, etc.)
Your best bet is to clone the original repo and then try to upgrade individual gems and check if it still works after each upgrade. This way you will be able to identify the troubling gem.
I have verified that the original repo code indeed works with the versions of gems in its current Gemfile.lock.
If you are starting a new Rails + Ember app, ember-cli-rails is probably the way to go, giving you the best of both worlds.
Emblem was the culprit. Replacing .emblem with .handlebars fixed the problem. I tried the tip from emblem-rails git page and icluded
gem "emblem-source", github: "machty/emblem.js"
but that didn't change anything.
I also followed this tutorial (alongside a few others) and I encountered several issues alongside the way ranging from handling templates to setting up the JSON API. I don't see your entire source code so I cannot pinpoint the exact problem. However, it seems that we have similar projects, so you can compare your code to my blog project source code and see what is causing these issues. Comparing to Ramon's tutorial, my blog has implemented everything until chapter 15.
https://github.com/Deovandski/Fakktion/tree/Ember-Rails
If you are a beginner like myself, then I recommend avoiding CoffeeScript and Emblem and sticking to Javascript as much as possible for the first months because you will find more resources and examples. Also, let me know if you need assistance in setting up the project as I used .gitignore to hide things like secrets.yml

Two almost identical Rails projects, missing gem helper file in one but not the other

I have two rails projects under the same parent within my home directory with the same environment. Both use the authorize-net (1.5.2) gem. I'm using ruby 1.8.7 (2012-02-08 patchlevel 358) [i686-darwin11.4.0], Rails 2.3.14, and rvm 1.14.3 on Mac OS X 10.8.1. Both have config.gem 'authorize-net', :lib => 'authorize_net in their config/environment.rb, both have helper :authorize_net at the top of their relevant controllers, both have helper :all at the top of their application_controller.rb. Yet one works fine and the other gets a MissingSourceFile (Missing helper file helpers/authorize_net_helper.rb) error. The helper file is in fact located at ~/.rvm/gems/ruby-1.8.7-p358#global/gems/authorize-net-1.5.2/lib/app/helpers/authorize_net_helper.rb
I cannot for the life of me figure out why one works but not the other. Can anyone point me in the right direction? How can I figure out what path Rails is using to find this helper in each case?
One thing I've learned over the years of using the StackExchange universe is that when I have a weird problem and don't get an answer within a couple of days, it's something stupid I did that no one else did or probably ever will do. I imagine this is one of those things, but I'll never know because the problem has gone away and I don't know why.
Realizing that the working project came from authorize.net's example and the non-working one didn't, I discovered that the authorize-net gem had a generator that I had not used. So I went thru the generator code and realized I was missing an initializer that I was sure I had already created. This initializer just loads some constants (api_login_id and api_transaction_key) from a YML file and has nothing having to do with paths, but I created it anyway before realizing I had in fact created it before but put it in controllers instead of config/initializers. Anyway, when I restarted WEBrick, everything worked, no path issues. Now I have restarted WEBrick MANY times before, including just before posting this question. But this time the problem went away.
I HATE when this happens.

Rails 2.3.9, adding ActiveScaffold, getting in `alias_method': undefined method `number_of_pages' for class `Paginator'

I have AS (as a plugin) working in another app just fine (I dont remember this
issue...) - its also using Rails 2.3.9, on same dev box.
Now trying to add it to a new app and getting this error when running
the webrick, script/server:
/Users/kimptoc/.rvm/gems/ruby-1.8.7-p302/gems/activesupport-2.3.9/lib/
active_support/core_ext/module/aliasing.rb:33:in `alias_method':
undefined method `number_of_pages' for class `Paginator' (NameError)
from /Users/kimptoc/.rvm/gems/ruby-1.8.7-p302/gems/
activesupport-2.3.9/lib/active_support/core_ext/module/aliasing.rb:
33:in `alias_method_chain'
from /Users/kimptoc/Documents/ruby/borisbikestats/vendor/plugins/
active_scaffold/lib/extensions/paginator_extensions.rb:9
I couldn't find any previous references to this error.
Embarassingly I dont know which version of AS I am using successfully... it says 1.2RC1 in the CHANGELOG file, but I seem to remember trying a few of the forks...(is there somewhere I can see which fork is in use...). I have tried using the the 'main' activescaffold in the new project, but it fails as above, but so does using the same plugin that is in the working project :(
Thanks in advance for any pointers as to what I am doing wrong.
Thanks,
Chris
PS Just realised that new Rails was using Rails 3 and old/working one was 2.3.9. It seems you need to use an alternate branch of AS for Rails 3, like this : https://github.com/vhochstein/active_scaffold/wiki
This is just a guess, but built in pagination was removed in Rails 2 as I recall, and you needed to install the classic_pagination plugin to get that functionality back.
I only used ActiveScaffold once, but the error there says paginator_extensions.rb ... it's probably monkey patching the old Rails paginator? Therefore the class exists but the number_of_pages method doesn't.

Resources