It gives me the creeps,i'm done, i need some help here, i reverted multiple times back but i can't find the error.
Simple controller (customers),a simple form for adding a customer via :remote => true and the controller does respond_to do |format| { format.js } . Works fine, renders my create.js.rjs template.
I work for a few hours without making any javascript changes or changes to my controllers or authorization etc.. and when i try it again it's not working anymore.
What i mean with not working: Controller gets called, record saved, all partials rendered. But no javascript evaluated, not even a simple alert(1) at the beginning of the file.
I tried with different prototype.js versions and different rails.js versions, but nothing helped. I hope someone has a clue about this or already experienced this.
It's not that i don't want to post code. But it won't help. Its basic code that works and, after some changes where i don't know what i really changed (some locales here, some css there, html templates from a completely different controller a bit..)..
Currently developing with: ruby 1.9.2, rails 3.0.3, prototype 1.7 RC3, rails.js from github.
SOLVED
How stupid, I missed the part where the template naming changed. My application templace was named "application.rhtml". It worked until now. As it stopped to work, I changed it to "application.html.erb" and now it's working.
Related
I am trying to use paperclip 3.5.1 with devise 3.1.0 in a Rails 4 application.
I wanted to be able to add an avatar for my User devise model, so I generated the required fields but I have problem in the showing and saving the picture.
I tried the solution given here but when I try to load a url now I get for every controller that I have the following error. It even appears for the RegistrationController.
undefined method `devise_controllers?' for #<__Some__Controller:_____>
Why does this happen and how can I solve it? I couldn't find any solutions online and since it is my first rails application I'm not so familiar with it yet.
This is just a typo: the name of the helper is :devise_controller?, notice the extra "s" you have there: rubydoc reference
I've built a Rails 3 app and I'm trying to get it working with JQueryMobile. I've gone ahead and required query_mobile_rails and that works just fine, but I need to disable the AJAX loading as it seems to get in the way of many things. Looking at the jquerymobile docs, they recommend adding the following javascript after loading JQuery, but before loading JQueryMobile:
$(document).bind("mobileinit", function(){
$.mobile.ajaxEnabled = false;
});
I've been reading through the docs on the Asset Pipeline, but I cannot figure out how I can manage to get my code (the above) inserted after JQuery and before JQueryMobile. Where do I place such a .js file so that it will be loaded at the proper time?
Any help would be greatly appreciated!
Nevermind. I got it. I created a file called app/assets/app_lib.js with the code above and then added a require app_lib between require jquery and require query.mobile in my application.js file.
I found a weird bug in Rails 3.0.? that I want to report to the Rails team, but I have no idea how to do it.
Does anyone here know how to do this? Where is the open source project hosted? Do they have have ticket system?
Actually, I am going to share the issue I found, maybe it really isn't a bug. I am using Rails 3.0.7 and Ruby 1.8.7.
I created some static pages and I have two pages that are named very similar one named "holiday" and the other named "holidays". First, I created the singular "holiday" page and everything worked as it should. Then I created the plural version of it and when I tried to test it didn't work, I kept getting redirected to the not found or 404. Just to be clear, yes I restarted the server but that didn't fix the problem. The only way this weird issue went away in when I cleared the browser cache.
Here are the code snippets.
In the routes I added this:
match '/holiday' => 'pages#holiday' , :as => 'holiday'
match '/holidays' => 'pages#holidays' , :as => 'holidays'
in the controller I just added empty actions
def holiday(); end
def holidays(); end
somewhere in the views folder I have the corresponding pages "holiday.html.erb" and "holidays.html.erb".
When I visit the first page (/holiday) it works. The page gets served.
When I visit the second page (/hoidays) it doesn't work. I get redirected to the not found / 404 page.
Has anyone encountered this weird issue in Rails 3?
Here's the bugs/issues system:
https://github.com/rails/rails/issues
You can search for the bug before submitting it. Maybe someone already reported it.
I found a tutorial here https://github.com/plataformatec/devise/wiki/How-To:-Migrate-from-restful_authentication-to-Devise-, however it seems like it is missing pieces of what to do, for example the restful_authentication plugin is still there...how do I remove it? Then how does Devise know what to get for my App...I've tried it but it just keeps breaking my App.
Erase everything in the user.rb controller (or your controller)
Make Sure all of Restful_Authenication is gone (there is quite a bit of includes that may be presnet)
Make sure devise_for :users is present in the routes.rb file
Look for method errors and replace them back in the User.rb controller.
Think that fixed it.
Until now I was using rc6 and I decided to upgrade, but it's totally
breaking my app ? Maybe I am doing something wrong, but I believe I
followed the documentation.
I have a model Content that embeds_many Localized_Content.
Once I have a content created and wanted to added a localized content
I would do the following:
#content = Content.find('xxx')
#new_content = #content.localized_contants.build()
#new_content.save
This is working perfectly fine under rc6 and updates correctly all the
timestamps in localized_contant (using include Mongoid::Timestamps)
But doing the same thing in rc7 break with the following error:
"Access to the collection for LocalizedContent is not allowed since it
is an embedded document, please access a collection from the root
document."
Ok, maybe I need to save directly from the parent content then ok.
Doing a
#content.save
works but will not trigger all the timestamping
and this breaks the logic of my apps... what should I do ?
#content.save is the way to go. You should refactor your code to call save() on the parent object instead of the embedded document.