RoR Copy Devise Using Old Regex - ruby-on-rails

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?

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.

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.

My Rails Application doesn't update the localized strings in production mode

I have a standard Rails application running with the I18n support. I have extensive caching running for this app. I edited a few strings and confirmed it worked locally. I also confirmed I have the right strings on the file for the live site. Still for some weird reason I do not see these changes for my live site even though I have not fragment cached anything here.
Any ideas what is going on?
Another one with the same problem as me :)
I ended up with this solution:
http://szeryf.wordpress.com/2008/02/02/multilingual-page-caching-in-ruby-on-rails/
I couldn't change the structure to include the language identifier in the URL as suggested here:
http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/341bba9357bfc608
Depending on your structure and how fare you are down development, choose either one. However, it's probably easier if you have the cache either as part of your domain or your url.
I hope multilingual caching will be improved in future rails versions.

making a installer in rails

I have been working on this, very, small photo cms lately. And now i ready for setting it up to Github. So i will love to have some kind of installer, just as much for leaning it, I'm thinking something like you type a command and then it starts by copy all the files to the rails app, and then asking you for what your flickr_id is etc..
So i have to store all this information and call it down.. i.e if i should show some pictures, i have to use the flickr_id.
Hope you understood my question..
You can start by using rails-app-installer, it's not maintain completly but can works. It's use on the Typo project

How to use acts-as-commentable-with-threading in Rails

I am developing my first rails site (yup, i am a rails idiot).
I'm writing a blog, and i got to the comments part.
I installed acts-as-commentable-with-threading ( GitHub ), i made and ran the migration like the install instructions said.
I have added acts_as_commentable to my Posts model and i have a Comments controller
When i add
#comment = Comment.build_from(params[:id],1, params[:body] )
I get the error.
undefined method `build_from' for #
Clearly i am doing something terribly wrong, and i don't really get the example. What should i be feeding to build_from? Can somebody explain this plugin step by step? :)
Or is there an easier way to get simple threaded comments?
Did you by chance define your own comment model? If so that is going to completely override the model from the plugin that defines build_from in the first place. I ended up getting around this by creating a module with the extra stuff I wanted then creating an initializer to include it, which works perfectly.
As an aside, the first parameter to build_from needs to be the actual commentable object the comment is to be connected to, not just an id.
I'm currently using this plugin in production and can assure you it works :)
Besides the reason of not restarting server (btw you shouldn't use nginx + passenger for development, simple mongrel or thin will do the job better in this case) I can think of two more:
You didn't install plugin (or something wrong happened during installing). However this is unlikely as you could run migration ok right?
You have comment model in app/models and rails doesn't load it from plugin. In this case you might want to try requiring file with plain old require.

Resources