Controller edits in devise-token-api not recognized - ruby-on-rails

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.

Related

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?

why can't Codeigniterload Input class, and can't find the file either

Im trying to use codeigniters input class, to use the post method. Now then, I tried loading it in the controller and the autoloader but no luck! The error im getting is
Unable to load the requested file: helpers/input_helper.php
after I tried to find it by looking through my code looking for Input but the IDE couldn't find anything. I just want to essentially use
$this->input->post('varname');
nothing crazy. So, does this file not get included from codeigniter by default? I got the most recent release from github a few days ago. Im pretty new to codeigniter so if I say something stupid, please forgive me. An explanation would be very appreciated!
You should not need to load this helper at all: Input Class Docs
Note: This class is initialized automatically by the system so there
is no need to do it manually.
Try removing any of your attempts to autoload in the controller or elsewhere, then try again and see if that works.

MiniProfiler not showing up on the page

I’m having problems getting MiniProfiler to show me the reports. I’m just in the Dev environment, which should show it all the time. Adding ?pp=help does bring up the help page. In tmp/miniprofile, there are a ton of mp_timers_ files. Apparently something is happening back there.
At first I thought it was a weird CSS issue, like my navigation bar is covering it. I tried loading the page without CSS and the MiniProfile box still doesn’t show up.
In case it matters, I do not have a before_filter set up. When I use the simple one from their docs, though, it doesn't help anything.
My first thought is that it is disabled by default. If that is the case you will not be able to see the help page. From what you described it seams to be working. So my solutions is to type this into the browser and see what happens.
http://localhost:3000/?pp=enable
after that you should be able to get to help page.
http://localhost:3000/?pp=help
I know this is very late, but another potential issue that may cause this problem is JS errors.
If there are any unresolved JS errors, the badge likely won't show up.
So make sure to squash those before pulling your hair out.
I didn't have it show up either due to having an old version of the gem without the currently needed initializer.
To fix it, I just ran the generator which added an initializer to set up rack-mini-profiler in development:
bundle exec rails g rack_profiler:install
MiniProfiler can also be set hidden by default
# config/initializers/mini_profiler.rb
Rack::MiniProfiler.config.start_hidden = true

ruby on rails - open flash charts

I'm trying various ways to implement pretty graphs in my app. I followed http://pullmonkey.com/projects/open_flash_chart2 steps in my app, but instead of creating test_it, I just added to my own controller. In my routes.rb, I have
resources :my_controller_name do
collection do
get 'graph_code'
end
end
also, since I don't think it could find the action my_controller_name/graph_code otherwise (I'm kind of confused as to why most tutorials leave the routes part out? Am I doing something wrong?). (I also used #graph.html_safe in my views for Rails 3)
Anyway when I go to /my_controller_name, I get the error in the flash box:
Open Flash Chart
JSON Parse Error [Syntax Error]
Error at character 0, line 1:
0: #<OpenFlashChart::OpenFlashChart:0x000001043c4b78
I don't know why this is happening. I tried creating a new app and following the guide, generating a controller named test_it. It worked (provided I corrected the routing). I can't think of how my controller is any different than test_it, except I initially generated it using a rails scaffold (so it has all the MVC parts), whereas I only generated the test_it controller. (I've also tried using/not using the json gem conflict fix, but it didn't make a difference--https://github.com/klochner/open_flash_chart/commit/00cf531387880af8c49ed5118737f0492b437f75) Thanks for any insight, I'm stumped as to why it's easy to implement on a new app but I can't add it to mine...
Thanks.
Nevermind, it seems to work if I use the old lib/base.rb instead of the json gem fix. Ah well.
Don't waste your time with Flash based charting libraries. Highcharts is definitely the way go to. It works in pretty much any browser, including those that don't support Flash. Much better performance on OS X than Flash will ever provide.

Delete/Destroy method doesn't work anymore? (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!

Resources