Re: [Rails] [Rails Guides] Getting Started 7.4 - Array Output Problem
On 7 March 2012 12:04, NoobyOnRails satchillana...@web.de wrote: When I want to show the comment I get the following output under my comment: [#Comment id: 1, commenter: Tester, body: This is a test comment, post_id: 1, created_at: 2012-03-07 11:48:02, updated_at: 2012-03-07 11:48:02] You're possibly doing this: %= @my_object.comments.each do |comment| % # and then code to output the comment % end % rather than: % @my_object.comments.each do |comment| % # and then code to output the comment % end % The equals sign before the iterator will output to the browser the result of the iterator (which will be the collection that's iterated). You can see the Comment displayed has square brackets around it, which indicate it's a single element array - so probably a collection that's being rendered by mistake. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: the naming of STI tables
Robb Kidd wrote in post #1050675: class Fruit ActiveRecord::Base belongs_to :basket end class Apple Fruit end class Basket ActiveRecord::Base has_many :fruits end Ref: Single Table Inheritance http://api.rubyonrails.org/classes/ActiveRecord/Base.html Robb: Pardon -- Although my code shows it, I should have stated explicitly that I am sticking all the STI sub-classes in a Fruit module and app/model/fruit subdirectory. I envision enough Fruit sub-classes that I don't want them all in the toplevel app/model directory. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Rails 3.0 Invalid Date Error in Production
On 8 March 2012 03:44, yellowreign ryanac...@gmail.com wrote: On Wednesday, March 7, 2012 7:37:58 AM UTC-8, Colin Law wrote: On 7 March 2012 15:33, Ryan Chin ryanac...@gmail.com wrote: Please don't top post, it makes it difficult to follow the thread, insert you reply into the previous post at appropriate points. Thanks. They're using different environments - development is on my PC, production is on Heroku. And the answers to my other questions? Colin Hi Colin, I think you're right. I'm running 1.8.7 locally, but my Heroku stack is 1.9.2. So my next newbie questions is how do I get my current local app to use the 1.9.2 that I installed (downloaded from http://rubyinstaller.org)? Is there some place to map my development environment to the new 1.9.2 install? After I installed Ruby, I went into the command prompt to run rails s, and I got this message, report_activate_error: Could not find RubyGem rails =0 I tried searching, but couldn't find anything except this: http://stackoverflow.com/questions/2741180/how-do-i-upgrade-from-ruby-1-8-6-to-1-8-7-on-windows Sorry, if you are on Windows I can't help. Most Rails developers use Linux (I use Ubuntu) or Mac. You will have to hope someone here who uses Windows can help, or alternatively (which would be my suggestion) set up your machine to dual boot Win and Ubuntu, or run Ubuntu in a virtual machine using VirtualBox or VMWare. There is however the question of why you are using american_date_monkey_patch (which I know nothing about) since it seems to be that that is causing the problem. Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: [Rails Guides] Getting Started 7.4 - Array Output Problem
On 8 Mrz., 09:15, Michael Pavling pavl...@gmail.com wrote: You're possibly doing this: %= @my_object.comments.each do |comment| % # and then code to output the comment % end % rather than: % @my_object.comments.each do |comment| % # and then code to output the comment % end % Thats the point! Thank you so much! -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: YODA-LIKE RUBY ROCKSTAR NEEDED -- $75 bucks per session
Firstly I hope whoever takes this gig spends some time teaching you not to double post and that ALL CAPS IS SHOUTING Be honest here, your job is to develop an e-commerce site (without spree) and you lied to get the work so you want someone to build it for you at $50 per hour under the pretence of tuition. I dont know what the contracting rate is around your parts but I suspect that it will be higher and your dishonesty does not help. There are plenty of work for hire sites out there where you can contract people to do this, you would be better off looking there. Anyone able to recommend a good site for contract developers for Kisha, we only contract out the graphics work. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] rails 3.1.3 : Unknown key: page
On 7 March 2012 09:57, kingston.s jenorishs...@gmail.com wrote: Hi all, I used following query users = User.find(:all, :page = {:size=100},:conditions = ['created_at between ? and ?', from_date.to_time, to_date.to_time] ) I have not come across the use of :page in this way. What do you think it will do and can you point me to the docs where its use is documented? By the way if you are using Rails 3 I would have expected you to be using the newer techniques for finding, such as User.where() rather than find. Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: At least one entry for DB
Hey, The @video.id you are referring to is not yet existing as the @video object is not yet persisted into the db. You have to first save the @video before accessing the id, that is when the after_create or after_save is triggered. In your Video class, the after save has access to the @video instance through the self keyword (self.id in your case). Another solution to your problem would be to use nested attributes (see accepts_nested_attributes_for in the rails docs) I hope this helps. Regards Geoffroy Op donderdag 8 maart 2012 03:41:40 UTC+1 schreef Ruby-Forum.com User het volgende: Thanks for your answer. I will try after_create. I have put after_create :create_first_script def create_first_script @video = Video.new(params[:video]) @script = Script.new(:video_id = @video.id, :startp = 0, :text = 'ToDo: ') end in video.rb. But I need to pass params[:video] somehow... /videos/_form.html.erb (generated by scaffold) should do it, correct? %= form_for(@video) do |f| % div class=field %= f.label :title %br / %= f.text_field :title % /div div class=field %= f.label :url %br / %= f.text_field :url % /div div class=actions %= f.submit % /div % end % I am not sure how to pass the video object from here. Could anyone give me tips? soichi -- 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 view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/h-vGTdmMb8IJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Is there a way to redirect from one controller action to another without a server trip?
Hi I want one controller action to invoke another action in another controller, but I don't want the overhead of a redirect_to response which then generates another request to the correct action and controller. Any suggestions? Pieter -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Is there a way to redirect from one controller action to another without a server trip?
Create object for that controller then call. class A def a1 * invoke=B.new** invoke.action(args)* end end class B def action(args) something end end regards, Loganathan On Thu, Mar 8, 2012 at 5:17 PM, Pieter Hugo li...@ruby-forum.com wrote: Hi I want one controller action to invoke another action in another controller, but I don't want the overhead of a redirect_to response which then generates another request to the correct action and controller. Any suggestions? Pieter -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Is there a way to redirect from one controller action to another without a server trip?
something like render :controller = othercontroller, :action = :otheraction, :params = params ? (preserving the params would be a sweet bonus :) -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Is there a way to redirect from one controller action to another without a server trip?
On Thu, Mar 8, 2012 at 5:25 PM, Pieter Hugo li...@ruby-forum.com wrote: something like render :controller = othercontroller, :action = :otheraction, :params = params * Nope, I hope you cant call another controller action like this.* ? (preserving the params would be a sweet bonus :) -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: getting find_by_sql to return the numeric value rather than an object that contains the value as an attribute
Using this technique: Report.where(unit_id=? AND id = ? AND id = ?, unit_id, report1, report2).sum('distance') was ultimately the best solution for me, because using find_by_sql and then calling sum on it would behave unexpectedly, like sometimes the sum would have to be invoked twice: find_by_sql(...).sum.sum And I replaced id with time to select within time frame -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Best Book for starting
Ok, hi people, I am new on this forum. Umm, I am and Experienced Java programer. And I know Ruby. But, I have never used Ruby On Rails. I have found few books for rails.. can you tell me which one is the best to start. Once again, I must say, I know ruby language itself.. Here are the books: 1. Ruby on Rails 3 Tutorial: Learn Rails by Example (Addison-Wesley Professional Ruby Series) http://www.amazon.com/Ruby-Rails-Tutorial-Addison-Wesley-Professional/dp/0321743121/ref=pd_cp_b_0 2. Agile Web Development with Rails (Pragmatic Programmers) http://www.amazon.com/Agile-Development-Rails-Pragmatic-Programmers/dp/1934356549/ref=pd_sim_b_2 3. Learning Rails: Live Edition http://www.amazon.com/Learning-Rails-Simon-St-Laurent/dp/1449383130/ref=sr_1_1?s=booksie=UTF8qid=1331213995sr=1-1 ok, which one is the best for absolute begginer in rails? -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Best Book for starting
On 8 March 2012 13:40, Igx Ma li...@ruby-forum.com wrote: Ok, hi people, I am new on this forum. Umm, I am and Experienced Java programer. And I know Ruby. But, I have never used Ruby On Rails. I have found few books for rails.. can you tell me which one is the best to start. Once again, I must say, I know ruby language itself.. Here are the books: 1. Ruby on Rails 3 Tutorial: Learn Rails by Example (Addison-Wesley Professional Ruby Series) http://www.amazon.com/Ruby-Rails-Tutorial-Addison-Wesley-Professional/dp/0321743121/ref=pd_cp_b_0 2. Agile Web Development with Rails (Pragmatic Programmers) http://www.amazon.com/Agile-Development-Rails-Pragmatic-Programmers/dp/1934356549/ref=pd_sim_b_2 3. Learning Rails: Live Edition http://www.amazon.com/Learning-Rails-Simon-St-Laurent/dp/1449383130/ref=sr_1_1?s=booksie=UTF8qid=1331213995sr=1-1 I don't know about those books, but if you want to learn online then have a look at railstutorial.org, which is free to use online, or you can pay and download the pdf and get access to other stuff. If you know about Ruby you likely know about rvm, which is definitely worth using with Rails. In fact I would say that it is obligatory. Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Can't find the PostgreSQL client library (libpq)
On Mar 7, 2012, at 2:10 PM, Craig White wrote: If you installed Postgres on your system using the binaries downloaded directly from postgresql.org website, the following should fix this issue... Point of clarification: there are no Mac binaries available directly from postgresql.org. The are 3 links there which all lead to external sites with installers maintained external to the postgres project, which are built with who knows what options, and installed into unusual locations. Also, ./configure, make, make install work perfectly well on OS X. -- Scott Ribe scott_r...@elevated-dev.com http://www.elevated-dev.com/ (303) 722-0567 voice -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Sharing session variables across Controllers?
I have a couple of session parameters set in a Controller which I want to use in a different Controller. Which is the cleanest way to do this? I did quite a bit of Googling but could not come up with anything substancial. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/E5-CFAhjTXQJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Best Book for starting
+1 for railstutorial On Thu, Mar 8, 2012 at 7:49 AM, Colin Law clan...@googlemail.com wrote: On 8 March 2012 13:40, Igx Ma li...@ruby-forum.com wrote: Ok, hi people, I am new on this forum. Umm, I am and Experienced Java programer. And I know Ruby. But, I have never used Ruby On Rails. I have found few books for rails.. can you tell me which one is the best to start. Once again, I must say, I know ruby language itself.. Here are the books: 1. Ruby on Rails 3 Tutorial: Learn Rails by Example (Addison-Wesley Professional Ruby Series) http://www.amazon.com/Ruby-Rails-Tutorial-Addison-Wesley-Professional/dp/0321743121/ref=pd_cp_b_0 2. Agile Web Development with Rails (Pragmatic Programmers) http://www.amazon.com/Agile-Development-Rails-Pragmatic-Programmers/dp/1934356549/ref=pd_sim_b_2 3. Learning Rails: Live Edition http://www.amazon.com/Learning-Rails-Simon-St-Laurent/dp/1449383130/ref=sr_1_1?s=booksie=UTF8qid=1331213995sr=1-1 I don't know about those books, but if you want to learn online then have a look at railstutorial.org, which is free to use online, or you can pay and download the pdf and get access to other stuff. If you know about Ruby you likely know about rvm, which is definitely worth using with Rails. In fact I would say that it is obligatory. Colin -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Sharing session variables across Controllers?
Session variables should be shared, unless I'm not understanding the question. You can set a session variable in one controller like so: session[:my_key] = 'my value' Then access it in another controller by simply calling session[:my_key] -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/p226gFvWNjwJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Sharing session variables across Controllers?
In my application once I call an action on a different controller all my session variables seem to disappear also the login session seems to expire. Even if I start a new request from browser I need to authenticate again. On Thursday, March 8, 2012 8:28:47 PM UTC+5:30, Tim Shaffer wrote: Session variables should be shared, unless I'm not understanding the question. You can set a session variable in one controller like so: session[:my_key] = 'my value' Then access it in another controller by simply calling session[:my_key] -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/G91C6M2c0XAJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Sharing session variables across Controllers?
On 8 March 2012 15:06, Myth17 nitishupr...@gmail.com wrote: In my application once I call an action on a different controller all my session variables seem to disappear also the login session seems to expire. Even if I start a new request from browser I need to authenticate again. Something is clearing the session then. Do a global search in the code for session and see if you clear it anywhere. If you find it cleared anywhere, even if you think that code should not be called, then put some debug in to check (or just comment out the clear for temporarily). Colin On Thursday, March 8, 2012 8:28:47 PM UTC+5:30, Tim Shaffer wrote: Session variables should be shared, unless I'm not understanding the question. You can set a session variable in one controller like so: session[:my_key] = 'my value' Then access it in another controller by simply calling session[:my_key] -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/G91C6M2c0XAJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- gplus.to/clanlaw -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Can't find the PostgreSQL client library (libpq)
On Mar 8, 2012, at 7:17 AM, Scott Ribe wrote: On Mar 7, 2012, at 2:10 PM, Craig White wrote: If you installed Postgres on your system using the binaries downloaded directly from postgresql.org website, the following should fix this issue... Point of clarification: there are no Mac binaries available directly from postgresql.org. The are 3 links there which all lead to external sites with installers maintained external to the postgres project, which are built with who knows what options, and installed into unusual locations. Also, ./configure, make, make install work perfectly well on OS X. sorry - you're correct - it was the one-click installer from EnterpriseDB site. Craig -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Sharing session variables across Controllers?
Its actually weird then, I did a search to double check but I am not clearing the session anywhere. :| On Thursday, March 8, 2012 8:59:01 PM UTC+5:30, Colin Law wrote: On 8 March 2012 15:06, Myth17 nitishupr...@gmail.com wrote: In my application once I call an action on a different controller all my session variables seem to disappear also the login session seems to expire. Even if I start a new request from browser I need to authenticate again. Something is clearing the session then. Do a global search in the code for session and see if you clear it anywhere. If you find it cleared anywhere, even if you think that code should not be called, then put some debug in to check (or just comment out the clear for temporarily). Colin On Thursday, March 8, 2012 8:28:47 PM UTC+5:30, Tim Shaffer wrote: Session variables should be shared, unless I'm not understanding the question. You can set a session variable in one controller like so: session[:my_key] = 'my value' Then access it in another controller by simply calling session[:my_key] -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/G91C6M2c0XAJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- gplus.to/clanlaw -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/8NOJZMxFjXAJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Sharing session variables across Controllers?
I can see message WARNING: Can't verify CSRF token authenticity on the rails console. Could this be the reason? On Thursday, March 8, 2012 9:17:08 PM UTC+5:30, Myth17 wrote: Its actually weird then, I did a search to double check but I am not clearing the session anywhere. :| On Thursday, March 8, 2012 8:59:01 PM UTC+5:30, Colin Law wrote: On 8 March 2012 15:06, Myth17 nitishupr...@gmail.com wrote: In my application once I call an action on a different controller all my session variables seem to disappear also the login session seems to expire. Even if I start a new request from browser I need to authenticate again. Something is clearing the session then. Do a global search in the code for session and see if you clear it anywhere. If you find it cleared anywhere, even if you think that code should not be called, then put some debug in to check (or just comment out the clear for temporarily). Colin On Thursday, March 8, 2012 8:28:47 PM UTC+5:30, Tim Shaffer wrote: Session variables should be shared, unless I'm not understanding the question. You can set a session variable in one controller like so: session[:my_key] = 'my value' Then access it in another controller by simply calling session[:my_key] -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/G91C6M2c0XAJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- gplus.to/clanlaw -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/c9d1Cdc7BgYJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Safari Version 5.1.3 (7534.53.10) Browser problem --- removing cookie on OS X Lion 10.7.3 (11D50b) when still valid
Hi All, Hope this note helps the newbies to Rails As I'm new to Rails, I'd like to share how I tracked down Safari's dropping of my cookie. My Applebug no: 11003492 registered 7 March/2012 My development platform: MacPro running rails 3.1.1 on OS X Lion 10.7.3 (11D50b) Problem: Firefox worked as programmed but switching to Safari my current_user_token kept in the cookie[:remember_user_token] became nil. Later in the debug sessions, this value returned was due to the cookie being removed by Safari --- not present! The steps leading to Safari dropping of the cookie 1) signin and set the cookie[:remember_user_token] to User.id 2) get /index_stats for user --- cookie still valid 3) get /show_stats : rendering the view showed that the cookie value returned was nil How to debug the problem?: 1) Use the Ruby method set_trace_func to see the source code being executed a) U must be judicious in turning on / off the set_trace_func method as it blows out a lot of source tracing. b) Use of Unix split utility helped at the beginning to pare down the size of file to edit as u could blow up your editor due to size 2) from the above output it lead me to look at the Ruby source code: /usr/local/rvm/gems/ruby-1.9.2-p290/gems/actionpack-3.1.1/ lib/action_dispatch/middleware/cookies.rb 3) By reading the ruby code and to modify it to output some of its values to STDOUT this allowed me to refine the next debugging steps to catch the problem . Note use of logger.debug in the above source will not work as the logger method is not defined! 4) I refined my tracing output strategies and ran it against both browsers: Firefox and Safari for a comparison analysis. 5) Running the Unix diff utility against the 2 browser outputs homed in on Safari missteps --- niled cookie 6) By inspecting the cookie for both browsers, it showed that Safari had removed the cookie[:remember_user_token] I sent to Apple these 2 traced outputs as evidence of the Safari problem. Recap: I found set_trace_func a good starting point to see what is happening. I experimented with ruby-debug but this was too fined-grained for my current problem at hand. Hope this helps to your programming efforts. Dave -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Sharing session variables across Controllers?
On 8 March 2012 15:53, Myth17 nitishupr...@gmail.com wrote: I can see message WARNING: Can't verify CSRF token authenticity on the rails console. Could this be the reason? Yes, probably. Rails is clearing the session because it detects the problem. Google for the message and you will find lots of hits. Colin On Thursday, March 8, 2012 9:17:08 PM UTC+5:30, Myth17 wrote: Its actually weird then, I did a search to double check but I am not clearing the session anywhere. :| On Thursday, March 8, 2012 8:59:01 PM UTC+5:30, Colin Law wrote: On 8 March 2012 15:06, Myth17 nitishupr...@gmail.com wrote: In my application once I call an action on a different controller all my session variables seem to disappear also the login session seems to expire. Even if I start a new request from browser I need to authenticate again. Something is clearing the session then. Do a global search in the code for session and see if you clear it anywhere. If you find it cleared anywhere, even if you think that code should not be called, then put some debug in to check (or just comment out the clear for temporarily). Colin On Thursday, March 8, 2012 8:28:47 PM UTC+5:30, Tim Shaffer wrote: Session variables should be shared, unless I'm not understanding the question. You can set a session variable in one controller like so: session[:my_key] = 'my value' Then access it in another controller by simply calling session[:my_key] -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/G91C6M2c0XAJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- gplus.to/clanlaw -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/c9d1Cdc7BgYJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- gplus.to/clanlaw -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: YODA-LIKE RUBY ROCKSTAR NEEDED -- $75 bucks per session
Oh WOW! -- I didn't even know this existed. THANK YOU very much Javier. Certainly going to check this out. Again, thanks for for the help :-) Sincerely, Kisha On Thu, Mar 8, 2012 at 8:58 AM, Javier Quarite jquari...@gmail.com wrote: I know you're searching for a teacher (and you'll pay for the classes), but have you seen this page? http://www.railsmentors.org Maybe it's an option for you :) Javier Q. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- Sincere Regards, Kisha Richardson -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: YODA-LIKE RUBY ROCKSTAR NEEDED -- $75 bucks per session
I know you're searching for a teacher (and you'll pay for the classes), but have you seen this page? http://www.railsmentors.org Maybe it's an option for you :) Javier Q. -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] how to reject from this array?
I have: array = [this ends in log, this ends in dog, this is a log] I want to discard strings that end in the same word. How far off is my attempt? array.reject { |i| i[0] =~ /\s\w$/ == i[1] =~ /\s\w$/ } -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/lPOGHXmhnwIJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Rails 3.0 Invalid Date Error in Production
On Thursday, March 8, 2012 1:11:16 AM UTC-8, Colin Law wrote: On 8 March 2012 03:44, yellowreign wrote: On Wednesday, March 7, 2012 7:37:58 AM UTC-8, Colin Law wrote: On 7 March 2012 15:33, Please don't top post, it makes it difficult to follow the thread, insert you reply into the previous post at appropriate points. Thanks. They're using different environments - development is on my PC, production is on Heroku. And the answers to my other questions? Colin Hi Colin, I think you're right. I'm running 1.8.7 locally, but my Heroku stack is 1.9.2. So my next newbie questions is how do I get my current local app to use the 1.9.2 that I installed (downloaded from http://rubyinstaller.org)? Is there some place to map my development environment to the new 1.9.2 install? After I installed Ruby, I went into the command prompt to run rails s, and I got this message, report_activate_error: Could not find RubyGem rails =0 I tried searching, but couldn't find anything except this: http://stackoverflow.com/questions/2741180/how-do-i-upgrade-from-ruby-1-8-6-to-1-8-7-on-windows Sorry, if you are on Windows I can't help. Most Rails developers use Linux (I use Ubuntu) or Mac. You will have to hope someone here who uses Windows can help, or alternatively (which would be my suggestion) set up your machine to dual boot Win and Ubuntu, or run Ubuntu in a virtual machine using VirtualBox or VMWare. Hi Colin, To be honest, this is the first time I developed something - I only started learning because my developer left me. I did some research and it seems like the purpose is to parse the date fields considering it is entered in an American format (and then saving to the database). However, I dug around and found this gem https://github.com/jeremyevans/ruby-american_date which I could probably use instead. There is however the question of why you are using american_date_monkey_patch (which I know nothing about) since it seems to be that that is causing the problem. Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/n8EVZVaV9GQJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] how to filter this array?
I have an array called *headlines* with lots of strings in it. Each string has a #rhyme_keys methods available on it which essentially gives it one of let's say 100 types. I want to remove all strings from the array who's #rhyme_key type is unique to the array (i.e. if 2 or more strings both have the same of any of the 100 types, they can stay). I've tried starting off here: #store all possible types in a new array rhyme_keys_array = [] headlines.map{|i| i.rhyme_keys } #convert it to a hash so that the 100 types are mapped as keys, and their frequency is mapped as values rhyme_keys_array.flatten.inject(Hash.new(0)){|i,c| i[c]+=1; i} #Now I don't know how to check against this new hash. Theoretically I think it's like the idea below, but I don't know how to express it syntactically: hrk = headlines.map{|i| i.rhyme_keys } if hrk.count 2 (in the value of the corresponding rhyme_key in the hash) then remove i from headlines. Does this make sense? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/3KQz1BdhnXsJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: the naming of STI tables
On Thursday, March 8, 2012 9:00:53 AM UTC, Ruby-Forum.com User wrote: Robb: Pardon -- Although my code shows it, I should have stated explicitly that I am sticking all the STI sub-classes in a Fruit module and app/model/fruit subdirectory. I envision enough Fruit sub-classes that I don't want them all in the toplevel app/model directory. I did notice this. You can still stick fruit.rb, apple.rb and your other fruit classes in app/models/fruit and prevent automatic namespacing which you are working around with your module. It involves explicitly adding app/models/fruit to Rails' autoload paths. Find the following line in config/application.rb: config.autoload_paths += %W(#{config.root}/lib) ...and change it to... config.autoload_paths += %W(#{config.root}/lib #{config.root}/app/models/fruit) I am not entirely certain this is the cleanest, most Railsy way, but it was the poison I picked over the complexity of unnecessary modules or namespaces. I can live with a path added to config. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/AAwomsz2ulEJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] What do I need to write a small game in ruby?
Hi, I am very, very new to programming and i started to learn ruby as a first language from the excellent book 'Learn to program by Chris Pine'. Now that I finished the book I would like to study a little bit about something that does not running in the command pompt, but has an interface like a game. Basicly I set out a little project for myself: I would like to display a 2D sqare on the screen and be able to move it around with the cursor buttons. The problem is that i have no idea about where to start as everything i wrote before was running in the shell. Do i need to add a GUI framework to the basic ruby installation to be able to do that like Green Shoes by _Why or do I have to use something like the GTK2? Also if you can, could you please recommend some study material on the subject, preferably books but if you know of any, some simple online tutorial would be good too. Thanks in advance for everyone who taken the time to answer this, Kind Regards, Loren -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] What do I need to write a small game in ruby?
As far as I know http://rubygame.org/ or this http://www.libgosu.org/ -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Include Advanced
Hi, As I can do Include with parameters?? Example Modelo.find(:all,:include = [otroModelo(param,param)]) -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] What do I need to write a small game in ruby?
http://www.rubyinside.com/video-game-ruby-tutorial-5726.html 2012/3/8 Javier Quarite jquari...@gmail.com As far as I know http://rubygame.org/ or this http://www.libgosu.org/ -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- * Francesco Rodríguez * ** * @frodsan http://twitter.com/#!/frodsan https://github.com/frodsan http://www.frodsan.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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Ruby Developer for our client in Seattle, WA
Hi, Good Day. We are looking for a Ruby Developer for our client in Seattle, WA Duration : 6+ Months Start Date : ASAP JOB PURPOSE This position participates in a team environment for the delivery and maintenance of application systems. Responsible for programming, debugging and testing of applications in a development environment. Generally responsible for database design and system testing. This position provides technical, interpersonal and administrative skills in performing day to day work. This position will work with a team utilizing one or more of the following premium technologies: Ruby on Rails/Java, MacOS, and MySQL/ PostGres. Expected deliverables include but are not limited to requirements analysis, system analysis, system design, data models, program design, source code development, test case development, testing, and documentation. In this position it is essential that RITS departmental policies and procedures be adhered to. Those include, but are not limited to; technical and architecture standards, production implementation standards, regular status reporting, regular participation in team meetings, regular one on one meetings with supervisor and team lead, and providing work estimates and regular time tracking. Minimum Job Qualifications and Technical Competencies * Bachelor’s degree in Computer Science, Mathematics, Business Administration, Engineering or a related field. Appropriate additional experience beyond the minimum required experience may be substituted for education. * A total of 5 years relevant experience in a multi-platform environment, including, but not limited to application development or database development. Experience must include significant involvement with one or more of the following premium technologies: Java/Perl/PHP/ Python, J2EE, .NET, Unix Infrastructure, Oracle, DataStage, Salesforce.com and/or SQLServer/MySQL technologies used in a development environment. * Communicates clearly in a timely manner in both verbal and written communication. * Able to work well with, and potentially lead, groups of business customers and IT partners. * Able to provide direction to others in analyzing and solving program and system issues and problems. * Technically proficient in core technologies and methodologies used by the team. * Able to effectively adapt to rapidly changing technologies and methodologies and apply them to technological and/or business needs of mid-level scope. * Able to analyze, diagnose and resolve complex programming problems and system coordination issues. * Able to provide technical direction and solutions to other team members. * Able to plan and manage his/her own work, as well as 1-2 other team members * Able to lead multi-discipline teams for work efforts which includes estimating, coordinating, tracking progress, inspiring others to complete tasks on time, assisting with resolving issues and creating status reports. * Able to mentor and coach other junior team members in technical matters. ESSENTIAL FUNCTIONS * Develops efficient and maintainable program code. * Develops efficient and effective program and system solutions in solving complex business problems. * Provides consulting support for IT and Business partners by researching, identifying and resolving complex technical problems. * Continuously seeks to improve job skills. Actively participates in the company's learning environment. Works on compensating for personal limits in both technical and professional soft skills. * Meets established deadlines while maintaining a high level of quality. Negotiates changes to delivery dates. * Develops complex programs and systems in support of business processes and objectives. * Prepares and/or directs the creation of system test plans, test criteria, and test data. * Develops innovative solutions to problems. * Understands and participates in deliverables required by approved client Development Lifecycles. * Determines system design and prepares work estimates for development or changes for multiple work efforts. * Takes initiative and seeks out work. * Prepares and/or directs the creation of program, system, operational and User documentation. * Performs and/or directs testing and documents the results. * Adheres to policies, procedures, and standards in place within IT as well as all corporate policies, procedures and standards created by the client. If you are interested in the above opening please respond with your MS Word formatted resume and provide us the following details. •Full Name: •Rate Expectation: •Citizenship / Visa Status: •Availability for Interview: •Contact Number (s) : •Email id: •Start Date: •Current City and State: Warm Regards, Preeti Rao Bridge Technologies and Solutions Direct: 609 363 0590 Email : preeti@bridgetechsolutions.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] Re: At least one entry for DB
Thanks for you answer. You have to first save the @video before accessing the id, that is when the after_create or after_save is triggered. In your Video class, the after save has access to the @video instance through the self keyword (self.id in your case). I need to clarify this point. When videos_controller.rb calls for 'create' action, a new instance gets persisted, correct? When doing so, 'after_create' is called as well. It seems to me that when 'after_create' is called, the new video instance is already created. Please correct me, if I'm wrong. I tried this. but no good ( I knew it! ) after_create :create_first_script def create_first_script @script = Script.new(:video_id = self.id, :startp = 0, :text = 'ToDo: ') end soichi -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Include Advanced
On 8 March 2012 22:49, Rogelio A. RogeX li...@ruby-forum.com wrote: Hi, As I can do Include with parameters?? Example Modelo.find(:all,:include = [otroModelo(param,param)]) Modelo.find(:all,:include = :otro_modelo, :conditions = [otro_modelos.param1 = ? and otro_modelos.param2 = ?, param, param]) -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Nested Attributes not Working in Form
I have a form that uses two models - badge and badge winners. The user_id and community_id fields are needed for badge_winners which is nested in badges. I was trying to learn from Ryan Bates' Railscast ( http://railscasts.com/episodes/196-nested-model-form-part-1) The error I'm getting is: ActiveRecord::UnknownAttributeError in BadgesController#create unknown attribute: user_id app/controllers/badges_controller.rb:42:in `new' LIne 42 corresponds to this line in :create @badge = Badge.new(params[:badge]) *here's the controller:* def new @badge = Badge.new badge_winner = @badge.badge_winners.build respond_with(@badge) end def create @badge = Badge.new(params[:badge]) if @badge.save flash[:notice] = Badge was successfully created. redirect_to home_path else flash[:notice] = There was a problem creating your badge. redirect_to home_path end end *Here's the form (both community_id and user_id are populating fine):* %= form_for(@badge) do |f| % %= f.label :Description % %= f.text_area :description % %= f.fields_for :badge_winners do |builder| % %= builder.hidden_field :user_id ,:value = user_id % %= builder.hidden_field :community_id ,:value = community_id % % end % %= f.submit Give Badge % % end % *The models (user_id and community_id are fields in the BadgeWinner table):* class Badge ActiveRecord::Base belongs_to :community has_many :badge_winners, :dependent=:destroy accepts_nested_attributes_for :badge_winners end class BadgeWinner ActiveRecord::Base belongs_to :user belongs_to :badge end I'm hoping someone's able to help. I just know it's a newbie error somewhere. Thanks in advance for any assistance! -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/V1kKNdUcaU4J. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] CSV problem with migration but working fine in controller
I'm getting problem with csv. When I use below code in my Controller method then it works but when I put this in my migration then this don't work. Why so In My Controller's index method. It works. require 'csv' CSV.foreach(#{Rails.root}/db/adwords_location_data/languages.csv) do |row| obj_language = Language.new obj_language.name = row[1] obj_language.adwords_id = row[0] obj_language.save end === But When I write this in my migration this doesn't work. No error come but data didn't inserted in the tables. Below is the migration code. require csv class LoadLanguageData ActiveRecord::Migration def self.up CSV.foreach(#{Rails.root}/db/adwords_location_data/languages.csv) do |row| obj_language = Language.new obj_language.name = row[1] obj_language.adwords_id = row[0] obj_language.save end end def self.down Language.destroy_all end end -- 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 rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.