I've got a Rails 3.2.3 app with the default_locale set to :nl. When I start the app using Thin or Unicorn, the app's locale is set to :en. When I use Webrick, the locale is correctly set to :nl.
This change is triggered by a commit that updates several third-party gems, although I have not been able to single out any one gem upgrade in particular -- I can reverse each of them individually and get the same result. However, when I checkout the offending commit's parent, all is well too.
When I run the app on a remote server in production mode, it all works fine, so it seems to be local to my machine.
I have removed every single installed gem and re-installed them all, which made no difference.
Does anyone have any idea what might trigger this behaviour? And especially why using webrick or unicorn would make a difference?
Edit: I have pinpointed the bug to be triggered by upgrading Draper from 0.11 to 0.12 (issue at Github). Not sure if it is also the cause.
http://labs.revelationglobal.com/2009/11/13/unicorn_and_i18n.html
This problem has occured to me before wich was triggered by the "active_admin" gem you might want to use an earlier version to prevent this, I do not really know wich one so you can play around with it a little.
another option would be to set the active_admin locale in a before_filter,
config.before_filter :set_admin_locale
And set_admin_locale is in the application_controller:
def set_admin_locale
I18n.locale = :nl
end
hope it helped
I managed to track this problem down to a bad practice in my own Rails app that caused a bug by upgrading the Draper gem. There's a full explanation in the Draper documentation.
Related
I have a Rails 4 app with Thoughtbot Administrate for the admin part.
Recently I tried to upgrade from version 0.1.2 to 0.1.4, but I got this error: cannot load such file -- administrate/fields/base.
It was triggered from a custom field file, so I tried to run rails g administrate:install, which asked me to overwrite all my administrate controllers and dashboards.
Now, I have made customizations to those files, so I opted not to overwrite them, but then I ended up with the same error as before.
Next, I made another branch to test and let administrate to overwrite my controllers and dashboards, and this time it worked!
So, I think the question is, what is the process to upgrade the gem without losing my customizations?
Is there any task I can run in order to "register" the updated gem, like rake administrate:upgrade or so?
Thanks!
Found out the error.
Seems that administrate/fields/base is now administrate/field/base, so this subtle update in the Administrate gem code is breaking my custom field.
Anyway, I think a potentially breaking update to the gem's code should be advertised and maybe even change the mayor version number, so I'll rise an issue in github for this one.
Right now I'm feeling really dumb but I can't find a way to personalize the color in the gem "bootstrap-generators" I've tried to edit the color in bootstrap-variables.scss but is not working.
Bootstrap is correctly installed because it works and I tried to delete the cache folder to force rails to rebuild it but it' pointless.
I'm using rails 4.2.0 and bootstrap-generators 3.3.1
Try to do the following things for investigate problem:
1) Shutdown Rails app, clear cache (use rake tmp:clear), change color variable and run application again.
2) Try to broke bootstrap-variables.scss file. If your application really using(compile) it you will see a error.
3) Try to change any other variable. Probably you a trying to change wrong variable.
I've tested this by running rails c both before and after git stash. On Rails 4.1 in Mavericks, after following the instructions to add the versions table and adding has_paper_trail to three models, whenever I run rails c I get
irb: warn: can't alias context from irb_context.
I've spent some time Googling without much luck, there's old threads talking about rspec, but I don't see how that's relevant since I'm not using it. Any ideas why this is happening?
RSpec used to polute provide Object top-level methods, e.g. describe, context, etc. Fortunately they've got rid of all the monkey patching in version 3, and now all these methods are namespaced under RSpec.
One can change this behaviour through the expose_dsl_globally config flag. For backwards compatibility, it defaults to true.
The warning shows up when you open the console because paper_trail automatically loads its rspec helpers when rspec is found. And it calls RSpec.configure before you have the chance to tweak your own configuration.
One possible solution would be paper_trail to disable the automatically loading and let users to load it themselves when they see fit. However, I am not aware of the internals of the library, so I can't guarantee this wouldn't break other things.
Best!
This is now fixed in papertrail 4.0.0, here's the commit.
i want to debug ROR without going through the effort of putting inspect method for every relevant object in the controller as well in the model.is there a better way as we have in Java (Run time debugger using eclipse).i know that I can Use Rails.logger and also make use of rails Console(irb`).i am even aware of debugging/inspecting elements in erb/rb file.Still is there a better,quick and reliable way to debug a Rails app.
There is much better, see this railscats.
It presents two great gems, especially Better Errors
Otherwise, you could use pry with rails, see this railscast.
you can also use pry-rails, pry-debugger and then use binding.pry method in your code and then while using your app you have Rails console available in rails server
Add this lines to your application's Gemfile
group :development do
gem 'ruby-debug19'
end
then run cammand
bundle install
add debugger within your controller or model method, stop the rails server and restart again. Whenever rails found word debugger it stops control at that point. You can easily debug your value or object.
Hope this will helps you.
I got these updates from rails:
I'd like to announce that 3.2.11, 3.1.10, 3.0.19, and 2.3.15 have been released. These releases contain two extremely critical security fixes so please update IMMEDIATELY.
link
as it says it's critical. I just updated my application with rails 3.1 to 3.11 and did bundle update rails. My questions are:
What was the actual loophole in rails that has now been fixed?
As a learner I'm eager to understand what the problem was and how has it been fixed. I couldn't get anywhere about this.
Is it really a big loophole, and is there any problem for all Rails application which haven't been updated?
Here's an explanation of the hack : http://charlie.bz/blog/rails-3.2.10-remote-code-execution
And the original post by tenderlove : https://groups.google.com/forum/?fromgroups=#!topic/rubyonrails-security/61bkgvnSGTQ
Basically, anyone can inject XML and instantiate any kind of Ruby object using YAML ... it's complicated, but works on all apps (except the patched one of course, and Rails 1.X) and can even execute system commands ...
Anyone having Rails apps around should already have upgraded ... if not, do it NOW!