Rails 3 Contact form - ruby-on-rails

I recently followed a tutorial on a how to add a contact form in rails 3 for a site I am building. I already had a contact controller and view from when I created that page and was trying to implement the form. I coming to realize maybe the tutorial isn't in rails 3 when it says it is. I keep getting an error( undefined method `deliver_contact' for Notifications:Class. ) that I can't seem to figure out. I tried changing some thing around from the tutorial but nothing is working. Any guidance would help me out? I am thinking about just deleting what I did and starting over fresh with the contact form but wanted to check and see if anybody has an idea. Thanks! The link to the site is below and I followed exactly what was there.
http://metatroid.com/article/How%20To:%20Contact%20Form%20in%20Rails

Use
Notifications.contact(params[:email]).deliver
More info

Related

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.

Blogit is not routing in rails 4

Hi guys,
I have just installed blogit into my Rails 4 application. When I go to /blog I get routing error of every single route I have got. I get "undefined local variable or method". It is like that it won't load my routes at all.
Not sure if it make sense though. Please let me know what you want me to put here so you guys can have a look.
I have current_user defined in ApplicationController.
In the installation what I didn't understand is "declare which of your models acts as blogger in your app". That might be the issue.
Thanks in advance.
In case someone is looking for this.
Answer trail is in here. It is Explained fully
So just to sum it up, I added main_app to all of the links in the view and all are good.
Basically when you are in the /blog you will be in the engine, and you need to tell the app the correct path. Thanks to emaxon.

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.

acts_as_ferret multi model search not working in rails app

I am trying to solve a strange issue with ferret/acts_as_ferret
Of course I have googled and posted the question:
http://www.ruby-forum.com/topic/188570
Basically aaf works on single models with no issue. It also works on single models using the config/aaf.rb file I have setup. It even works when I do a multi-model search in the console, but within the rails app itself I get:
undefined method `ferret_rank=' for <object that has a match>
If anyone has had the same experience/problem and can shed any light I would appreciate it.
PS: I followed the following tutorial to get where I am now.
http://opensoul.org/2008/4/29/using-shared-indexes-with-acts_as_ferret
Do you have the plugin installed or just the gem? You might want to install the plugin.
I would also try rebuilding the index.
For my purposes, I switched to Solr and life is a lot easier. Sphinx is missing a lot of stuff that I need.

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