Hi,
I tried the sample program for AJAX from the following site.
http://www.theregister.co.uk/2007/01/15/ajax_rails_tutorial/
I created a table called catalogs and set the values.
I tried to load the data while entering the title of the book in the
text field,
I am getting the error messages
====SyntaxError in CatalogController#get_article_list
D:/ruby/Projects/catalog/app/models/catalog.rb:14: syntax error,
unexpected '')''
====
I tried to identify the cause of the error.
I colundn''t
This is the controller
======================class CatalogController < ApplicationController
def index
end
def get_article_list
@section=request.raw_post
@catalogList="<ol>"
Catalog.find_by_sql( "SELECT * from catalogs WHERE title
''"+@section+"''" ).each do|catalog|
@catalogList+="<li><a
href=\""+catalog.url+"\">" +catalog.title+
"</a></li>"
end
@catalogList+="</ol>"
render :text => @catalogList
end
end
==============================================================================
This is model
=============require ''rubygems''
require ''active_record''
class Catalog < ActiveRecord::Base
set_table_name "catalogs"
end
ActiveRecord::Base.establish_connection(
:adapter => "mysql",
:host => "localhost",
:database => "mydatabase",
:username => "root",
:password =>
)
==============================================================================
Please help me to figure out the reason for the error and give your
valuable suggestions.
Thanks in advance.
Ravi
--
Posted via http://www.ruby-forum.com/.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---
Ravikumar Ponraj
2008-Jul-21 12:05 UTC
Access denied for user ''root''@''localhost'' (using password: N
Thorsten Mueller wrote:> this line > > ActiveRecord::Base.establish_connection( > :adapter => "mysql", > :host => "localhost", > :database => "mydatabase", > :username => "root", > :password => > ) > > should have some value for the :password thing. > either use > :password => nil > or > :password => ""Hi, After I changed the above modification in the model, I am getting the following error. Access denied for user ''root''@''localhost'' (using password: NO) This is my database.yml content development: adapter: mysql encoding: utf8 database: mydatabase username: root password: password host: localhost The password also set as ''password'' for the database, eventhough i gave the password I couldn''t get the out put. what changes shoule be made. Thanks in advance, Ravi -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Ravikumar Ponraj
2008-Jul-22 04:44 UTC
Re: Access denied for user ''root''@''localhost'' (using password: N
srinivas reddy wrote:> Hi, > Just check this.. > ActiveRecord::Base.establish_connection( > :adapter => "mysql", > :host => "localhost", > :database => "mydatabase", > :username => "root", > :password => ""; > ) > > I hope this will work.Hi, I tried with the above changes... still I am having the problem... herewith I attached the application codes I am using. Please any one help me out this.. Thanks in Advance, Ravi Attachments: http://www.ruby-forum.com/attachment/2432/catalog.zip -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---