Delete/Destroy method doesn't work anymore? (Rails) - ruby-on-rails

I'm encountering a very strange problem: my delete actions in rails don't work anymore.
Even if I create everything by the scaffold command, every click on delete just sends me to the show view of the object, which should be deleted.
script/generate scaffold myitem description:text
This isn't only in one project, but extends to new projects I create.
Any idea, where this is coming from? Or better: Any idea how to fix this?
(the only thing I can think of, is that some plugin broke my installation, I installed paperclip, but don't know how to uninstall it: where are my plugins?)

Removing link to jquery helped me.

You should be able to look in the log file to see what SQL is being generated for the delete, and what error it is being generated.

Actually the problem was probably Firefox. When I clicked on Answer you own question here on Stackoverflow, I had the very same problem: My request, wasn't processed properly. I was sent back to the normal question view, without having the ability to submit my own answer.
So after a restart of Firefox everything worked fine.
(I also reinstalled Ruby and Rails at the same time, so I can't be sure, if it was Firefox for sure).

I've seen this before (because I had the same problem). Perhaps this could help you:
Rails 3 :method=> :delete doesn't work in Internet Explorer

I follow this blog step by step and solve it!

Related

Issue with Rails Generator Building a Plugin

I am building a Rails plugin for an application at work.
I want to extract logic that was used in multiple locations, but implemented slightly differently, and add new features needed without doing it 2-3 times over.
I've never build a gem, but according to what I was reading it is possible to use rails generate.
However this has not been the case for me.
Running rails g model Something stuff:type:
First interesting thing is that it is generating mini test stuff when I explicitly told the plugin not to use mini test (using Rspec).
Then looking in my folder structure for the plugin, no db/ folder, nothing added to app/models/, and no test/ folder:
Running the command a second time reveals to me that the files are indeed created:
My questions are:
Where is this stuff going? Can I even find out?
Has anyone encountered something similar? Is it due to a misconfiguration, or bug? Essentially, what's happening?
I would truly appreciate any advice or suggestions!
EDIT #1
Forgot to mention that I checked within the spec/dummy application in case things were being created there, and it is still empty as I left it.
EDIT #2
So I found where the files were by using the find command:
And yeah it added the files to my home folder...
At least now I can just paste them in the right location, but obviously this is bizarre and I'd like to get this resolved, figure out what is going on.
Okay so turns out that yes you may use Rails Generators when building a gem. Also, the generated files will not be placed inside the dummy application unless you are in that directory.
Everything is working as expected on a different computer.
That stuff is going into dummy app that is usually located in test/dummy. In your case, it seems to be located in specs/dummy.
Yeap and nope. That's not misconfiguration.

RoR Copy Devise Using Old Regex

I'm not too savvy with Ruby on Rails, but I know enough that I was able to copy my app into a slightly altered duplicate. Almost everything is going fine with the new copy except that my user email regex is still using the older copy's user email regex.
I'm trying to figure out which part calls devise.rb in the initializers, but so far I have had no luck. I've also had a hard time finding if others have had this problem and solved it.
EDIT - I solved my own problem and answered it below.
Looks like I found the answer to my question. The problem is that copying the app meant that I didn't give the application its own application name. This caused the program to refer to the application with the old application name. All I did was rename it and now it functions the way I want.
I used the following post to help me rename: How to change a Ruby on Rails application name?

Controller edits in devise-token-api not recognized

I downloaded a devise example and got it working. When trying to edit a controller app/controllers/api/v1/sessions_controller.rb and test it, any changes I make are not recognized by rails.
Neither syntax errors nor legit ruby code have any effect on the app's behavior. The only source file I can successfully edit is app/controllers/application_controller.rb.
I am coming back to rails after a few years away and have never seen this behavior. Is there a controller cache, a pre-compiled module, or some other known issue causing this?
Thanks, in advance.
EDIT:
This problem has been avoided in my code. Answers are still welcome to get the gist of the explanation to the problem.

Turn on html_safe for the entire app in Rails 3

Rails 3 turns off the html_safe option by default. I want to revert this thing. I have a rails 2.3.8 app getting converted to rails 3. Almost every page breaks because of the rails3 default html_safe setting. Is there any way I can revert this to where it was in previous versions of rails ? Please help
No, there isn't and even if there is, you shouldn't.
It's a good habit to test (and update) your app using the rails_xss plugin in Rails 2.3.x before actually starting the conversion to Rails 3.
Also, you should have a valid test suite in place so that every error will be spotted by the test suite and you can easily fix it.
Don't try to upgrade unless you have completed these two simple steps. There are also a few other suggestions.
As a side note: Current versions of Rails 3 HTML-escape also non-HTML templates, which is a bug. See: https://rails.lighthouseapp.com/projects/8994/tickets/4858
I'm posting this here, because I found this question while investigating the bug mentioned above, but didn't fine that ticket or anything about this bug on the interwebs. (Bad google skills?) Hope it saves someone time.

Starting out with vote_fu

Trying my luck with the vote_fu rails plugin. The functionality looks like exactly what I need for a project of mine, but I have hit a roadblock. I have followed the github readme to the letter, installing it as a plugin.
I have put acts_as_voteable on my "Event" model and acts_as_voter on my User model.
In the console, when I try:
>> event.votes
or
>> user.votes
it successfully returns an empty array.
but when I try to do the following:
user.vote_for(event)
I get
"NoMethodError: undefined method `user_id' for #<Vote:0x7f5ed4355540>"
Any ideas? I'm probably just missing something obvious, but maybe something is missing from the plugin's readme.
Thanks.
[Update]
I created a blank application and the plugin works fine, so I think that this problem might be being caused by the use of the "desert" plugin, as my User class is split over two files. If I find the answer, I'll post it so that in the off chance someone else runs into this it may be some help.
Cheers.
Ok, I haven't found a definitive reason why this problem occurred, but I do have strong suspicions that it is due to the use of the "desert" plugin, as my User class is split over two files (the project is using the CommunityEngine plugin as a base),
Anyhow, I found a work around (something I should have tried before posting here). Instead of installing vote_fu as a plugin, I installed it as a gem. And now vote_fu seems to be humming along nicely.
So let that be a lesson to you all!
:-P

Resources