[Rails] Re: Creating a new record doesnt update the browser view

2012-07-06 Thread cyber c.
Hi Colin, Here we /do/ see the sql fetching the records. Very odd. There must be something going wrong with the caching. Have you changed anything in the the config directory other than database.yml and routes.rb? Specifically environment.rb or anything in config/environments? Are you

[Rails] Re: Creating a new record doesnt update the browser view

2012-07-06 Thread cyber c.
It is a bit suspicious that you have 3.2.6 of only some of these. I should have asked you to post Gemfile and Gemfile.lock too. Gemfile.lock GEM remote: https://rubygems.org/ specs: actionmailer (3.2.4) actionpack (= 3.2.4) mail (~ 2.4.4) actionpack (3.2.4)

[Rails] Re: Creating a new record doesnt update the browser view

2012-07-06 Thread cyber c.
Hi, I'm not using the back button , but refreshing the browser to see the updated list. I'm using Safari browser. Tried with a chrome too(from a windows machine, ofcourse my rails server is still running on my mac machine) and i see the same result. -- Posted via http://www.ruby-forum.com/.

[Rails] Re: Creating a new record doesnt update the browser view

2012-07-05 Thread cyber c.
Hi Colin, Please remember to quote the previous post when replying, I have just had to look back at the previous email to find what I suggested last time. This is a mailing list not a forum, though you may be accessing it via a forum style interface. Thanks for the response . I have spent

[Rails] Re: Creating a new record doesnt update the browser view

2012-07-05 Thread cyber c.
buggy. Started POST /trials for 127.0.0.1 at Thu Jul 05 10:26:19 -0700 2012 (1.2ms) commit transaction Completed 200 OK in 39ms (Views: 37.9ms | ActiveRecord: 0.2ms) Started GET /assets/trials.js?body=1 for 127.0.0.1 at Thu Jul 05 10:26:45 -0700 2012 Served asset /trials.js - 304

[Rails] Re: Creating a new record doesnt update the browser view

2012-07-05 Thread cyber c.
Now run the app, bring up the index and note the count shown (what is it and how many records do you see), add a record and then show the index again. Does the count change? Post the log for that complete cycle. The count shown is old , doesnt include the newly created one. Started GET

[Rails] Re: Creating a new record doesnt update the browser view

2012-07-03 Thread cyber c.
Hi Colin, Thanks for the response . I have spent enough time debugging my rails app and found that the default code generated by the rails itself is buggy. I have created a new scaffold for the resource Trial. After creating a new entry, the index page of the resource shows up stale data. (I

[Rails] Creating a new record doesnt update the browser view

2012-07-02 Thread cyber c.
Hi, I have a rails app. upon creating a new record from the browser(although it is being created successfully) it doesnt show up in the browsers view. Connecting to the DB , i confirmed that the record is created. I should do a Rake db:migrate inorder to make the record appear on the browser's

[Rails] Passing values between controllers

2012-06-27 Thread cyber c.
Hi, I have 2 controllers A and B. The create method in controller A is programmed to redirect to B#index method. I want to pass data between my controllers, so i have made use of the params hash. But i cannot access the params hash on the index method of B controller. what is the right way to

[Rails] Validations doesnt work with activemodel?

2012-06-26 Thread cyber c.
Hi, I have a form with 2 attributes/fields. As im not storing them in a database, i have used activemodel::validations for validations in my model class. In the views file i have 2 associated text fields (part of a form) with a submit button. I have used validates_presence_of for the 2

[Rails] Re: Validations doesnt work with activemodel?

2012-06-26 Thread cyber c.
Hi, Thanks for the suggestions. I have now included the code to display the error messages. Here is the code for my MVC model class Record include ActiveModel::Validations validates: :ipaddress, :name, :presence = true end View %= form_for :Record, :url = {:action = 'submit'} do |f| %

[Rails] Re: Validations doesnt work with activemodel?

2012-06-26 Thread cyber c.
I'm sorry, I dont know how it ended up in the post , but my code doesnt have the extra colon. Its actually this model class Record include ActiveModel::Validations validates :ipaddress, :name, :presence = true end -- Posted via http://www.ruby-forum.com/. -- You received this message

[Rails] Re: Validations doesnt work with activemodel?

2012-06-26 Thread cyber c.
Hi Walter, Thanks for your comments. def create - same for def submit too respond_to do |format| if PARAM matches so and so DEPENDING on params this gets routed to different page at any point here do you instantiate a new instance of your model, assign the params to it, and

[Rails] Re: Validations doesnt work with activemodel?

2012-06-26 Thread cyber c.
Hi, I'm using rails 3.2.4. I had referred to the activemodel episode from the rail casts and yes i included the initialize and persisted methods as specified. Still i dont see errors when i click the submit button with empty values model class Record include ActiveModel::Validations

[Rails] Re: Validations doesnt work with activemodel?

2012-06-26 Thread cyber c.
Hi Walter, Yah the : came from copy pasting my earlier comment. The result is the same(no errors) with one attribute or using validates_presense_of(tried with other validate* options too). I was wondering if that problem was to do with the view? Anyother way of displaying the errors? --

[Rails] Re: Validations doesnt work with activemodel?

2012-06-26 Thread cyber c.
Hi Walter, The validate* methods works fine on the console. The function object.valid? returns false if any of the validate method fails. For that case object.valid? returns false even in the controller function, but when i redirect to the same url, it doesn't show any errors from the code

[Rails] Re: Validations doesnt work with activemodel?

2012-06-26 Thread cyber c.
Hi Walter, Thanks for the detailed explanation. I am redirecting to different pages in both the cases(valid and not valid case). Now that i am rendering a new page incase of a validate failure and i see the errors. Thank you very much :) -- Posted via http://www.ruby-forum.com/. -- You

[Rails] Problem with submit button

2012-06-22 Thread cyber c.
Hi, I wanted to create some static pages using rails and used rails g controller Staticpages main movie song book Which has created a controller file static_pages_controller.erb and view files under /views/static_pages/main.html.erb etc I have created a form using form_for on my main page which

[Rails] Re: Problem with submit button

2012-06-22 Thread cyber c.
routes.rb have only these get staticpages/main get staticpages/movie get staticpages/book How do i add a route to post method? -- 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

[Rails] Re: Problem with submit button

2012-06-22 Thread cyber c.
I can specify the controller using :url = {:action = 'XYZ'} But since I don't have ( nor need) a model file for the form , so what should i write here ? %= form_for (?) do |f| % -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google

[Rails] Rails command for creating static pages

2012-06-21 Thread cyber c.
Hi, How do we create static pages using rails(shud have only buttons, some text and upon clicks the appropriate controller should be called)? -- 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

[Rails] Re: Is activeresource broken in rails 3.2.4?

2012-06-20 Thread cyber c.
Found a solution to the problem , the default index methods of the controller should be modified to return records according to the params -- 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

[Rails] Re: Is activeresource broken in rails 3.2.4?

2012-06-19 Thread cyber c.
Hi Ryan, Where is not an activeresource method. Here are the list of activeresource methods http://api.rubyonrails.org/classes/ActiveResource/Base.html Also i will be using find to look for records that match multiple conditions like if name = XYZ, build = ABC etc -- Posted via

[Rails] Re: Problem with exists? method

2012-06-19 Thread cyber c.
Hi Frederick, Activeresource exists doesnt support conditions i think . Even i got confused by activerecord and activeresource exists method. -- 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

[Rails] Problem with exists? method

2012-06-18 Thread cyber c.
Hi, I have a DB with table TABLENAME, column COLUMN and an active resource client trying to connect to the DB. When i do Tablename.find(:all) = i get all the entries from the table But Tablename.exists?(:column = value) always returns false I verified that the above command works from rails

[Rails] Re: Problem with exists? method

2012-06-18 Thread cyber c.
Im sorry i have looked at wrong documentation. I have to use find(:all, :params) -- 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

[Rails] Is activeresource broken in rails 3.2.4?

2012-06-18 Thread cyber c.
Hi, I see that Person.find(:all) and Person.find(:all, :params = {id = '2'}) returns all records irrespective of conditions. Is activeresource broken? PS: Im using rails 3.2.4 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google

[Rails] Re: Is activeresource broken in rails 3.2.4?

2012-06-18 Thread cyber c.
I dont have a column with params. Person.find(:all, :conditions = [ id = ?,9]) generates a request Started GET /persons.json for 127.0.0.1 = hence returns all the records Where as Person.find(:all, {:id = '2'}) generates a request Started GET /persons.json?id=2 for 127.0.0.1 But *returns all

[Rails] Re: Is activeresource broken in rails 3.2.4?

2012-06-18 Thread cyber c.
Seems like this has been a problem/bug from earlier versions. http://www.rornoob.com/a/active-resource-find-with-conditions-problem/ Is there a work around for this? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby

[Rails] Problem with active resource(500 internal server error)

2012-06-15 Thread cyber c.
Hi, I have a rails server running. I wanted to connect to this using activeresource. Executing this code Class Buildclient ActiveResource::Base self.site = http://localhost:3000/builds; end builds = Buildclient.find(:all) puts builds (## printed nil) On the rails server terminal i see

[Rails] Reading a file using File.read

2012-06-14 Thread cyber c.
Hi, File.read(VALID_PATH_TO_FILE) works on ruby console but not as a rails application. I dont understand why it fails saying No such file or directory. Even File.exist? returns false from rails application output but returns true from rails console. It has readable permissions for the current

[Rails] Re: Reading a file using File.read

2012-06-14 Thread cyber c.
Im using absolute path. Actually i mounted a directory from remote server anddo a find for a specific file and then try reading it. The cmd find passes and returns a valid path to the file. But only the read cmd fails. -- Posted via http://www.ruby-forum.com/. -- You received this

[Rails] Re: Reading a file using File.read

2012-06-14 Thread cyber c.
I think i understood the problem -- 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@googlegroups.com. To unsubscribe from this group, send email

[Rails] Cmd line interface for ruby on rails app

2012-06-13 Thread cyber c.
Hi, I have a rails app running which provides an interface to create/update data stored in a DB. How do i develop a cmd line interface to do the same i.e i should be able to retrieve/update data to a DB. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are

[Rails] Re: Cmd line interface for ruby on rails app

2012-06-13 Thread cyber c.
Hi Miguel, I think that wont serve my purpose, as i'm building a tool which will help clients to update/create entries in the DB. You mean to say every client has to use rails console and connect to the rails server? -- Posted via http://www.ruby-forum.com/. -- You received this message

[Rails] Re: Cmd line interface for ruby on rails app

2012-06-13 Thread cyber c.
I dont know how it works with out rails server. But what i have now is a) browser based interface to DB to edit/view the records b) Clients can access this remotely What i want is a) cmd line interface (using a ruby script ?) , so that remote clients can use this app/script to interface with the

[Rails] Using activeresource for client/server model

2012-06-08 Thread cyber c.
Hi, i have a rails app running which has a DB of records. I wanted to develop a client app which can 1) view the records 2) edit them So i have created a new rails app (for this client) and edited the model file record.rb class Record ActiveResource::Base self.site = http://0.0.0.0:3000; end

[Rails] Can't mass-assign protected attributes:

2012-06-07 Thread cyber c.
Hi, i added a column to my DB using rails g migration AddAttrToTablename attr:string rake db:migrate I didnt change the model file. Should i? Now when i create a new record to the table assigning values to existing attrs and newly added attribute i get this error Can't mass-assign protected

[Rails] Problem with array of hashes

2012-06-05 Thread cyber c.
Hi , I have created an array of hashes using Model file class Class A ActiveRecord::Base def fill_paths paths = Array.new for file in @files path = {} path[a] = file path[b] = DATA2(assume data2 is valid) paths path end return paths end in controller class

[Rails] Re: Problem with array of hashes

2012-06-05 Thread cyber c.
Jeremy W. wrote in post #1063195: On 5 Jun 2012, at 18:58, cyber c. li...@ruby-forum.com wrote: for file in @files @paths = A.fill_paths for path in @paths puts path.a end I cant access path.a, which says undefined method 'a' for{a=value1,b=value2}:Hash //value1, value2

[Rails] Re: Re: Problem with array of hashes

2012-06-05 Thread cyber c.
Michael Pavling wrote in post #1063197: On 5 June 2012 19:19, cyber c. li...@ruby-forum.com wrote: Yah i get it. I wanted to convert this array of hash into an array of class objects. How do i do that in ruby? They are class objects - hashes are instances of Hash class

[Rails] Re: Problem with array of hashes

2012-06-05 Thread cyber c.
Hi Jeremy, Thanks for the reply. I want to populate my DB during init one time by crawling through a set of directories with filenames and paths. How do i do this? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on

[Rails] Re: Problem with array of hashes

2012-06-05 Thread cyber c.
@jeremy Thanks alot. -- 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@googlegroups.com. To unsubscribe from this group, send email to

[Rails] Beginner's:Problem with populating database

2012-06-04 Thread cyber c.
Hi, I wanted to populate the DB with (name,data) pairs based on some rules. I have created a scaffold with name and data as attributes. In the controller file under the def for index, i have changed the line @data_pairs = DataPair.all to @data_pairs = DataPair.get_all_pairs and in the

[Rails] Re: Beginner's:Return database records in ruby

2012-06-04 Thread cyber c.
Thanks for the reply. But i have changed the message along back but it still shows old message. My actual post was How do we deal with database records in ruby? I wanted to return a list of records from a model func to controller. Please help me. -- Posted via http://www.ruby-forum.com/. --