Re: [Rails] How to define virtual attribute for date_select drop menu using active model
I have never done this. Just trying to help. I think the problem you're having is that your field doesn't have a date compatible value. If you check it's class it might be NilClass. Since the fields does not belong to a table date_select probably has no idea what to do with it because it doesn't have a 'type'. Have you tried to give the field a Date compatible value before your view is executed, just to try if the view works? Also, maybe type_cast (in ActiveRecord::ConnectionAdapters::Quoting: http://api.rubyonrails.org/ ) would help? On Tuesday, August 14, 2012 4:40:52 AM UTC-4, Loganathan Sellappa wrote: My model* doesn't use Activerecord* ORM, I need to do validation on the table less model, so I am using the Activemodel library, also I hope the virtual field are needs to be mentioned as attr_accessor and I am sorry to mention that the model is table less in previous mail, since I thought people will understand when I say Activemodel. regards, Loganathan ViewMe http://vizualize.me/loganathan On Tue, Aug 14, 2012 at 1:30 PM, Colin Law cla...@googlemail.comjavascript: wrote: On 14 August 2012 08:44, Loganathan Sellapa logana...@gmail.comjavascript: wrote: I thought it would create getter and setter methods for card_expiration_date and the active model library would do the rest(such as creating virtual attributes card_expiration_date(1i),card_expiration_date(2li),card_expiration_date(3li) for date time attribute(card_expiration_date), let me know if I am wrong. Please don't top post, it makes it difficult to follow the thread. Insert your reply inline in the previous message. Thanks. You don't need to specify att_accessor for fields in the database, ActiveRecord will supply them automatically. By providing them yourself you have disabled the automatic ones. I guess you are a beginner with Rails so I suggest that you work through some tutorials to understand the basics. railstutorial.org is good and is free to use online. Colin regards, Loganathan ViewMe On Tue, Aug 14, 2012 at 1:06 PM, Colin Law cla...@googlemail.comjavascript: wrote: On 14 August 2012 07:50, Loganathan Sellapa logana...@gmail.comjavascript: wrote: Hi All, I am using active model for payment process in my application , i am not able to add field for date field, since it throws error as below undefined method `card_expiration_date(3i)='. In model: include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming attr_accessor: card_expiration_date What is the purpose of the line above? Check the docs for attr_accessor to see what it does. Colin In view: %=f.date_select :card_expiration_date, :add_month_numbers = false,:discard_day = true, :start_year = (Date.today.year-10), :end_year = (Date.today.year+10),:order=[ :month,:year] % -- 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 rubyonra...@googlegroups.comjavascript: . To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- 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 rubyonra...@googlegroups.comjavascript: . To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- 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 rubyonra...@googlegroups.comjavascript: . To unsubscribe from this group, send email to rubyonrails-ta...@googlegroups.com javascript:. For more options, visit https://groups.google.com/groups/opt_out. -- 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. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/EL0Qv8uCIVkJ. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: Best practice on Javascript and rails
This might not be what you're looking for but I'd start by reading up on the Asset Pipeline http://guides.rubyonrails.org/asset_pipeline.html. Then there are useful railscasts http://railscasts.com/ on both subjects. On Thursday, June 28, 2012 8:03:40 AM UTC-4, Ruby-Forum.com User wrote: Hi, I get constantly nervy whenever trying to implement any javascript / jquery in rails, basically because I'm not sure where to put things in the project! I know the people at rails have thought long and hard about how to best structure an app, so I'd like to learn the correct way. I'm using rails 3.2, ruby 1.9.3 / 1st situation - using a gem to include a javascript package : By default now I notice this is included in the gemfile : gem 'jquery-rails' there's also these lines in application.js //= require jquery //= require jquery_ujs and there's this in my layout view %= javascript_include_tag application % do I have to do anything at all to use jQuery in my application? If I want to use some jQuery on a page, where's the place to put it? in the controller.js.coffee? Or on the page between script and /script can I use js / jquery in this strange .coffee file? // 2nd situation - now I want to use JQUery-UI What is the best way to use jQuery UI, and where should I put it. I downloaded the minimised version from jQuery website, but which folder do I put it in? public/...? What am I meant to add to application.js? and do I need to add anything extra to the layout? // 3rd Situation - now I want to use the jQuery-ui CSS to make it look nice Do I link to the online page at http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.21/themes/base/jquery-ui.css in my layout, pulling in the css dynamically or copy and paste that to a file and include it in the project? if I include this in the project where do I put it? Do I need to add anything to application.css, and or my layout? That's enough for now! I know these questions might seem a bit pointless, but I want to know the right way to do this. I had an app looking and functioning perfectly on my local system, but then when I uploaded it to heroku all jquery-ui stuff and some of the css didn't work, even after a 'rake assets:precompile' I've now got a project with lots of extra includes, and js / css files repeated in different places just to get it to work on heroku. Very annoying, and I'm sure if I just knew the right way to organise everything it'd be much easier. Thanks -- 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/-/4imuFJ-xuKkJ. 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-US.
[Rails] Re: RoR 2.3.5
If you can, upgrade, especially if your app is developed for Windows. I have developed several apps in 2.x and they are increasingly becoming a nightmare to maintain. Most of the better gems I've wanted to use work only under Rails 3 and the alternatives are usually not good. I am currently upgrading an app from 2.3.5 to Rails 3 and although there are challenges there has been nothing I couldn't do easier and better in Rails 3, which has helped to clean up the code quite a bit. On Wednesday, June 13, 2012 12:36:04 AM UTC-4, Rick Bychowski wrote: I am evaluating an application that runs on RoR 2.3.5. What are the liabilities of an application that is based on this older version of RoR? I am concerned about security and ease of development. How common is this in the Rails world? TIA -- 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/-/liWGKBv8YygJ. 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] Recommend an image gallery with shopping cart
Hi all Anyone can recommend a web applicaiton or a CMS to manage images and videos that : • Accepts payments, needs a shopping cart based on PayPal • Mobilized, displays properly on Android, iPhone, Nokia, and others • Handles security access -- 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.
[Rails] Re: Rack Middleware or after filter
If you are letting the request go through the Rails stack already I don't see how you can make the response go any faster either way. If you were catching the request in the middleware on its way to the Rails stack and returned right away without going through Rails then it would be a different story and the response would be faster. On May 31, 4:20 am, Muruga murugu2...@gmail.com wrote: Hi All I need an solution that i should catch response and based on some conditions i have to modify response body and send back to client. I have tried with a Middleware and got a solution.Can i use a Middleware or simply one after_filter. On performance wise which is best.Or is there any other ways to do it. thanks in advance. -- 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: Errno::ENOENT: No such file or directory
It might not have anything to do with your problems but when I develop/ test in Windows I get the same type of error when the log files get big. The only thing I have to do to keep going is clear them up. On Apr 30, 8:28 am, Amir Z. li...@ruby-forum.com wrote: I am working with Agile Web Development Book. I create complete app but when I am trying to test my first unit testing. Its showing following error. 1) Error: test_truth(ProductTest): Errno::ENOENT: No such file or directory - rails.png C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:814:in `readlines' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:814:in `read_fixture_file' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:768:in `initialize' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:712:in `new' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:712:in `read_yaml_fixture_files' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:707:in `each' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:707:in `read_yaml_fixture_files' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:706:in `each' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:706:in `read_yaml_fixture_files' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:676:in `read_fixture_files' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:549:in `initialize' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:509:in `new' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:509:in `create_fixtures' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:508:in `map' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:508:in `create_fixtures' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/connection_adapters/mysql_adapter.rb:234:in `disable_referential _integrity' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:505:in `create_fixtures' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/base.rb:1198:in `silence' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:504:in `create_fixtures' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:1000:in `load_fixtures' C:/Users/Amir/Downloads/IR/ruby/lib/ruby/gems/1.8/gems/activerecord-2.0.2/li b/active_record/fixtures.rb:934:in `setup' 1 tests, 0 assertions, 0 failures, 1 errors Please help me out. Your inputs and suggestions are welcome. Thanks Amir -- Posted viahttp://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.
[Rails] Re: autocomplete word by word
I think what Guillem is saying is that you can still do it with jQuery/ Javascript like you did before and that you'll need to control the logic yourself. On May 6, 5:02 pm, rubix Rubix li...@ruby-forum.com wrote: Hi, I am trying to implement an autocomplete form with rails, I used jquery in a first version, to suggest phrases to user and it worked Now I am trying to have a service of autocomplete word by word, it means when the user it typing in the text area, I suggest only words and not phrases and when he finishes the word and starts a new one I do the same suggestion for the new word Is there a way to do this easily in rails regards, -- Posted viahttp://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.
[Rails] Re: Is there a way to redirect from one controller action to another without a server trip?
Without thinking too much about it, how about if you create another class that both your controllers can use? # This class processes your actions class YourActionClass def your_action(params) # here you process your request end end # This is the controller you want to process the redirect. class ControllerA ApplicationController def your_action your_action_instance = YourActionClass.new your_action_instance.your_action(your_parameters) end end # This is the controller you want to recognize your special cases and redirect them. class ControllerB ApplicationController def action if special_case your_action_instance = YourActionClass.new your_action_instance.your_action(your_parameters) # maybe you can render something here? else # your regular stuff goes here. end end end On Mar 8, 6:47 am, 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 viahttp://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.
[Rails] Re: System-wide db-driven config
I use a DB table but store one value per setting. Then in my code I just access whichever record I need to gain access to the value. This gives me great flexibility to maintain the setting values. Then I access the table only when needed. It might not be as fast as having all values retrieved at once but in my case it does not make any real difference in the performance of the application. On Sep 20, 7:29 am, paulo paul.a.taylo...@gmail.com wrote: Hi folks, Just after a 'best-practise' pointer with this one really; I have a 'setup' model for my application which only has a single record, holding the current settings of the app e.g. its mode (maintenance, normal, readonly) etc I need to check the app's settings, at least once per page-load, sometimes more. I know I could do this easily by pulling the record each time but was wondering if using global variables or something like a helper would be better? I do need to make these calls in both the controllers and views however. Thanks in advance, Paul -- 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: RUBY on Rails CMM level company does not have much employees
Me, I'm betting on the mammals. -- Hassan Schroeder hassan.schroe...@gmail.comhttp://about.me/hassanschroeder twitter: @hassan -- 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: RUBY on Rails CMM level company does not have much employees
Me, I'm betting on the mammals. Good one! :D -- 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: Maths with in Rails
Without the code used in the display action it's difficult to know what's going on but I'd guess you're using an integer at some point and that causes loss of precision. On Sep 8, 4:37 am, Eugene de Winnaar edalb1...@gmail.com wrote: Hi All I have a idea that I am doing and it is working so far but when it comes to displaying the data that I am getting with the maths that I am doing I am not getting the same result. This is what I have @arrived = @worksheet.time_arrived_customer @left = @worksheet.time_left_office @left_cust = @worksheet.time_left_customer @travel = ((@arrived - @left) * 2) @worked = (@left_cust - @arrived) @total = (@travel + @worked) / 60 So what I did was in the DB I am saving the hours in their minute form. 08:00 = 480 min 08:15 = 495 min And so on. I am 100% sure the maths is working as I firstly did it on paper and took those steps and put them into the action. When it comes to the display I am superpose to get 2.75 but I only see 2 why is that I have looked at number_with_precision but rather then getting 2.75 I get 2.00 Any Ideas would be appreciated. Regards -- 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] high volume write DB
Hi, At my job we're using Cassandra (no-SQL) for a project that is estimated to have a real high level of DB access, especially writes. The numbers are supposedly to be easy in the millions of transactions but I don't really have an estimate of transactions per minute/hour, probably hundreds of thousands at least per hour. I was wondering if anybody has had experience with such a volume of transactions (especially writes, obviously) with SQL type DBs and if you guys have any suggestions. Thanks for the input. -- 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] rspec post with file
Hi, I am working on a mobile app that sends a post with a file (a picture) embedded in the body of the request. It is not inside a parameter, it is inside of the body. A simplified example of a curl statement to simulate what the request does could be this: curl -X POST my_path --data-binary my_file When the request gets to the controller the contents of the file can be retrieved like this: str = self.request.body.read I can run my tests running a server and outside of rspec and directing curl requests to localhost but that slows down the tests considerably. I need to reproduce what the curl statement does from within my tests and using only the server that rspec starts but I don't know how. Nothing that I have tried has worked and I am kind of running out of time. My latest idea (not fully explored yet) is to work with the request object itself before running the POST statement but I have not found a way to load the body with the binary contents of a file yet and I am not sure this will actually even work. Any help would be greatly appreciated. Thank you -- 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: rspec post with file
What does that mean? Are you saying that the html element for the file upload doesn't have a name attribute? Well, then give it one. There is no HTML element for the file upload The request is built by a cell phone application, not a browser, it has parameter values (e.g.: the file name) but the file contents don't have a name associated to it. I don't control what the phone is sending so I can't just give it a name. I can run my tests running a server and outside of rspec and directing curl requests to localhost Huh? What are you trying to test specifically? What I am trying to test is the upload of the file itself from within rspec, without the use of curl. Currently I need to start a rails server as localhost and use curl to send the request to it, instead of using rspec's started server. I am yet to find a way to 'load' the file in the request that I want to send to rspec's server the same way the cell phone does. -- 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: rspec post with file
Thanks a lot Fred, I'll look into that. On Sep 2, 11:38 am, Frederick Cheung frederick.che...@gmail.com wrote: On Sep 2, 2:46 pm, pepe p...@betterrpg.com wrote: Hi, I am working on a mobile app that sends a post with a file (a picture) embedded in the body of the request. It is not inside a parameter, it is inside of the body. A simplified example of a curl statement to simulate what the request does could be this: curl -X POST my_path --data-binary my_file When the request gets to the controller the contents of the file can be retrieved like this: str = self.request.body.read Looking at the code in action pack, looks like you'll have to setup the contents of request.env['rack.input'] (not entirely sure what with) Fred I can run my tests running a server and outside of rspec and directing curl requests to localhost but that slows down the tests considerably. I need to reproduce what the curl statement does from within my tests and using only the server that rspec starts but I don't know how. Nothing that I have tried has worked and I am kind of running out of time. My latest idea (not fully explored yet) is to work with the request object itself before running the POST statement but I have not found a way to load the body with the binary contents of a file yet and I am not sure this will actually even work. Any help would be greatly appreciated. Thank you -- 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 do I change the name of a label in a form?
Hi, Instead of having on the labels the field name I would like to change it some customized values. How can I change that ? Regards %= form_for(@client_workout) do |f| % div class=field %= f.label :client_name %br / %= f.text_field :client_name % /div div class=field %= f.label :trainer %br / %= f.text_field :trainer % /div div class=field %= f.label :duration_min %br / %= f.text_field :duration_min % /div div class=field %= f.label :date_of_workout %br / %= f.date_select :date_of_workout % /div div class=field %= f.label :paid_amount %br / %= f.text_field :paid_amount % /div div class=actions %= f.submit % /div % 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.
[Rails] Re: How do I change the name of a label in a form?
Thanks!! -- 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.
[Rails] Re: iphone and android with RoR 3.x
Hi all Finally I think that I am going to continue working with XCode and MonoTouch for iPhone applications thank you for your advice -- 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.
[Rails] iphone and android with RoR 3.x
Hi all Any advice in how to build applications for smartphones with RoR ? Regards Jose -- 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.
[Rails] Re: Pagination doesn't work with will_paginate. Could anyone help with this?
Going by memory here, but don't you have to also add something to the model to let Rails know that it can be paginated? On Aug 19, 3:30 am, Rahul rahulratz...@gmail.com wrote: I missed that part initially, then added the following in my environment.rb config.gem 'will_paginate', :version = '~ 2.3.16 and tried running rake gem:install from the project directory.But I ended up with the following error rake aborted! Don't know how to build task 'gem:install' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:1720:in `[]' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2040:in `invoke_task' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `each' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in `top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in `run' D:/Program_Files/Ruby192/bin/rake:31:in `main' But my rake -T has gem:install configured in it. I am operating behind a proxy server, is that the reason? If so what am i supposed to do? On Aug 19, 12:10 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Aug 19, 7:49 am, Rahul rahulratz...@gmail.com wrote: I am currently using Rails 2.3.5. I installed will_paginate gem 2.3.16 as suggested in the will_paginate github page. But will_paginate is not being recognized when I use it and I always end up with an error.The following are the error when used from the project console and have also included my gem list. Are you actually loading the will_paginate gem (i.e. by adding it to your environment file or (if you are using bundler) by adding it to your Gemfile and running bundle install ? Fred --- --- Loading development environment (Rails 2.3.5) paginate_test = Product.paginate(:page=1) NoMethodError: undefined method `paginate' for #Class:0x2bcee70 from D:/Program_Files/Ruby192/lib/ruby/gems/1.9.1/gems/ activerecord-2.3.5/lib/active_record/base.rb:1959:in `met hod_missing' from (irb):1 from D:/Program_Files/Ruby192/bin/irb:12:in `main' --- --- *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.9, 2.3.5, 2.3.4) actionpack (3.0.9, 2.3.5, 2.3.4) activemodel (3.0.9) activerecord (3.0.9, 2.3.5, 2.3.4) activeresource (3.0.9, 2.3.5, 2.3.4) activesupport (3.0.9, 2.3.5, 2.3.4) arel (2.1.4, 2.0.10) Ascii85 (1.0.1) builder (2.1.2) bundler (1.0.15) erubis (2.6.6) hoe (2.10.0) mail (2.2.19) mime-types (1.16) minitest (1.6.0) mysql (2.8.1 x86-mingw32) pdf-reader (0.10.0) polyglot (0.3.1) prawn (0.11.1) rack (1.2.3, 1.0.1) rack-mount (0.6.14) rack-test (0.5.7) rails (2.3.5, 2.3.4) railties (3.0.9) rake (0.8.7) rdoc (3.8, 2.5.8) sqlite3 (1.3.3 x86-mingw32) test-unit (2.3.0, 1.2.3) thor (0.14.6) treetop (1.4.9) ttfunk (1.0.1) tzinfo (0.3.29) will_paginate (2.3.16) --- --- What am I doing wrong? Should i include any more configuration? or is there a better way of doing pagination? -- 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: Pagination doesn't work with will_paginate. Could anyone help with this?
Do you have in the model something like this: cattr_reader :per_page @@per_page = your-per-page-value On Aug 19, 3:30 am, Rahul rahulratz...@gmail.com wrote: I missed that part initially, then added the following in my environment.rb config.gem 'will_paginate', :version = '~ 2.3.16 and tried running rake gem:install from the project directory.But I ended up with the following error rake aborted! Don't know how to build task 'gem:install' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:1720:in `[]' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2040:in `invoke_task' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `each' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in `top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in `run' D:/Program_Files/Ruby192/bin/rake:31:in `main' But my rake -T has gem:install configured in it. I am operating behind a proxy server, is that the reason? If so what am i supposed to do? On Aug 19, 12:10 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Aug 19, 7:49 am, Rahul rahulratz...@gmail.com wrote: I am currently using Rails 2.3.5. I installed will_paginate gem 2.3.16 as suggested in the will_paginate github page. But will_paginate is not being recognized when I use it and I always end up with an error.The following are the error when used from the project console and have also included my gem list. Are you actually loading the will_paginate gem (i.e. by adding it to your environment file or (if you are using bundler) by adding it to your Gemfile and running bundle install ? Fred --- --- Loading development environment (Rails 2.3.5) paginate_test = Product.paginate(:page=1) NoMethodError: undefined method `paginate' for #Class:0x2bcee70 from D:/Program_Files/Ruby192/lib/ruby/gems/1.9.1/gems/ activerecord-2.3.5/lib/active_record/base.rb:1959:in `met hod_missing' from (irb):1 from D:/Program_Files/Ruby192/bin/irb:12:in `main' --- --- *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.9, 2.3.5, 2.3.4) actionpack (3.0.9, 2.3.5, 2.3.4) activemodel (3.0.9) activerecord (3.0.9, 2.3.5, 2.3.4) activeresource (3.0.9, 2.3.5, 2.3.4) activesupport (3.0.9, 2.3.5, 2.3.4) arel (2.1.4, 2.0.10) Ascii85 (1.0.1) builder (2.1.2) bundler (1.0.15) erubis (2.6.6) hoe (2.10.0) mail (2.2.19) mime-types (1.16) minitest (1.6.0) mysql (2.8.1 x86-mingw32) pdf-reader (0.10.0) polyglot (0.3.1) prawn (0.11.1) rack (1.2.3, 1.0.1) rack-mount (0.6.14) rack-test (0.5.7) rails (2.3.5, 2.3.4) railties (3.0.9) rake (0.8.7) rdoc (3.8, 2.5.8) sqlite3 (1.3.3 x86-mingw32) test-unit (2.3.0, 1.2.3) thor (0.14.6) treetop (1.4.9) ttfunk (1.0.1) tzinfo (0.3.29) will_paginate (2.3.16) --- --- What am I doing wrong? Should i include any more configuration? or is there a better way of doing pagination? -- 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: Pagination doesn't work with will_paginate. Could anyone help with this?
It's been a while since I have setup anything with will_paginate but if I have it in my models it is because I followed some instructions from somewhere, probably either railscasts or the gem's documentation itself. It could be that things have changed since I used will_paginate for the last time but I am pretty sure that your model should 'know' somehow that it can be paginated. On Aug 19, 1:32 pm, Rahul rahulratz...@gmail.com wrote: I was trying out the tutorials from railcast (http://railscasts.com/ episodes/51-will-paginate) Nothing of that sort was mentioned... On Aug 19, 5:24 pm, pepe p...@betterrpg.com wrote: Do you have in the model something like this: cattr_reader :per_page @@per_page = your-per-page-value On Aug 19, 3:30 am, Rahul rahulratz...@gmail.com wrote: I missed that part initially, then added the following in my environment.rb config.gem 'will_paginate', :version = '~ 2.3.16 and tried running rake gem:install from the project directory.But I ended up with the following error rake aborted! Don't know how to build task 'gem:install' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:1720:in `[]' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2040:in `invoke_task' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block (2 levels) in top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `each' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2019:in `block in top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2058:in `standard_exception_handling' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:2013:in `top_level' D:/Program_Files/Ruby192/lib/ruby/1.9.1/rake.rb:1992:in `run' D:/Program_Files/Ruby192/bin/rake:31:in `main' But my rake -T has gem:install configured in it. I am operating behind a proxy server, is that the reason? If so what am i supposed to do? On Aug 19, 12:10 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Aug 19, 7:49 am, Rahul rahulratz...@gmail.com wrote: I am currently using Rails 2.3.5. I installed will_paginate gem 2.3.16 as suggested in the will_paginate github page. But will_paginate is not being recognized when I use it and I always end up with an error.The following are the error when used from the project console and have also included my gem list. Are you actually loading the will_paginate gem (i.e. by adding it to your environment file or (if you are using bundler) by adding it to your Gemfile and running bundle install ? Fred --- --- Loading development environment (Rails 2.3.5) paginate_test = Product.paginate(:page=1) NoMethodError: undefined method `paginate' for #Class:0x2bcee70 from D:/Program_Files/Ruby192/lib/ruby/gems/1.9.1/gems/ activerecord-2.3.5/lib/active_record/base.rb:1959:in `met hod_missing' from (irb):1 from D:/Program_Files/Ruby192/bin/irb:12:in `main' --- --- *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.9, 2.3.5, 2.3.4) actionpack (3.0.9, 2.3.5, 2.3.4) activemodel (3.0.9) activerecord (3.0.9, 2.3.5, 2.3.4) activeresource (3.0.9, 2.3.5, 2.3.4) activesupport (3.0.9, 2.3.5, 2.3.4) arel (2.1.4, 2.0.10) Ascii85 (1.0.1) builder (2.1.2) bundler (1.0.15) erubis (2.6.6) hoe (2.10.0) mail (2.2.19) mime-types (1.16) minitest (1.6.0) mysql (2.8.1 x86-mingw32) pdf-reader (0.10.0) polyglot (0.3.1) prawn (0.11.1) rack (1.2.3, 1.0.1) rack-mount (0.6.14) rack-test (0.5.7) rails (2.3.5, 2.3.4) railties (3.0.9) rake (0.8.7) rdoc (3.8, 2.5.8) sqlite3 (1.3.3 x86-mingw32) test-unit (2.3.0, 1.2.3) thor (0.14.6) treetop (1.4.9) ttfunk (1.0.1) tzinfo (0.3.29) will_paginate (2.3.16) --- --- What am I doing wrong? Should i include any more configuration? or is there a better way of doing pagination? -- 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: difference between %= and %
Thank you all for your answers! -- 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.
[Rails] difference between %= and %
Hi all what is the difference between %= and % in a view file? thanks -- 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.
[Rails] Re: Question about rails generate controller
Thanks! -- 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.
[Rails] Question about rails generate controller
Hi all Is there a way to run 2 or more times the controller command to add methods to a specific controller? can I run: rails generate controller ControllerName index rails generate controller ControllerName add rails generate controller ControllerName update thanks -- 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.
[Rails] Re: Question about link_to
I understand now! To generate a link in my RoR application I just need to prefix the word _path with a controller name and it finds it. Thanks -- 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.
[Rails] New field does now show in browser
Hi all I just added a new field phone to form _form.html.erb created with: rails generate migration AddPhoneTotickets phone:string added with rake migraiton and the new field does not show in the browser new div class=field %= f.label :phone %br / %= f.text_field :phone % /div old p %= f.label :phone %br / %= f.text_field :phone % /p -- 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.
[Rails] Question about link_to
Hi all I am working on the first application from the book Head First Rails called tickets. What I do not understand is where the variable new_ticket_path gets populated in the view index.html.erb %= link_to 'New Ticket', new_ticket_path % Please advise -- 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.
[Rails] Re: Question about link_to
Walter, So if I understand correctly new_ticket_path, edit_ticket_path, ticket are like constants that RoR assigns to them specific values. If I want to create a new link on my RoR Application to a new page called for example myblog, and add it to the index page, which will be the right syntax? link_to myblog, ?? Thanks jose -- 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.
[Rails] Re: Duplicate Record Detection
validate_uniqueness_of might be of help? On Jul 10, 6:21 pm, Justin Stanczak rizen...@gmail.com wrote: How are others doing duplicate record detection? I'm not finding very many solutions, or methods online. I found one called SimString, but not much else. I was wondering how others are detecting duplicates. Similar to suggested items, I would like to show records that may match or have similar attributes. -- 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: Duplicate Record Detection
I don't believe you're going to find a magic formula for what you're suggesting. The same thing could be said about last or first names as you are suggesting could happen with SSNs. What if somebody misspells Smith for Smit, for example? But worse yet, what if it is not a misspelling situation and the Smit is actually Smit? The same is true for SSNs, switching the last 2 digits does not mean it was a misspell, it could just be that 2 different people have the same name and very similar SSNs. You have to draw a line somewhere, I think. You could use auto-complete fields and then provide options based on records found using the 'LIKE' option in the where clause using the information currently being entered. That might help but I think you'll find it's not worth the effort. On Jul 11, 12:42 pm, Justin Stanczak rizen...@gmail.com wrote: That would help slow the duplication, but if someone fills out a form and submits fname, lname, ss#, and they typo the ss# I would have a duplicate. I would like to display to admin users that this record has a related link, or is similar. Similar to how Google finds duplicates in your contacts and merges them. On Mon, Jul 11, 2011 at 12:25 PM, pepe p...@betterrpg.com wrote: validate_uniqueness_of might be of help? On Jul 10, 6:21 pm, Justin Stanczak rizen...@gmail.com wrote: How are others doing duplicate record detection? I'm not finding very many solutions, or methods online. I found one called SimString, but not much else. I was wondering how others are detecting duplicates. Similar to suggested items, I would like to show records that may match or have similar attributes. -- 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: Duplicate Record Detection
Whenever I have worked on similar projects in ended up being the customer's idea of what a close approximation was that made a possible duplicate. It was usually something like: same birth date same last name same city (optional) same state (optional) Since there is not such a thing as a tried and true method for what a duplicate record is I believe you'll just need to do some manual work. My advise would be to ask your customer/boss for what the rules are. On Jul 11, 4:29 pm, Justin Stanczak rizen...@gmail.com wrote: Yes, this is all very true. I was thinking if a comparison was done on multiple attributes that would help with just one name being wrong. I'm not looking for magic, just wondering how others find duplicated records. I could see this being used to detect data that links or is similar in nature. Found this as well.http://en.wikipedia.org/wiki/User:Ipeirotis/Duplicate_Record_Detection On Mon, Jul 11, 2011 at 4:17 PM, pepe p...@betterrpg.com wrote: I don't believe you're going to find a magic formula for what you're suggesting. The same thing could be said about last or first names as you are suggesting could happen with SSNs. What if somebody misspells Smith for Smit, for example? But worse yet, what if it is not a misspelling situation and the Smit is actually Smit? The same is true for SSNs, switching the last 2 digits does not mean it was a misspell, it could just be that 2 different people have the same name and very similar SSNs. You have to draw a line somewhere, I think. You could use auto-complete fields and then provide options based on records found using the 'LIKE' option in the where clause using the information currently being entered. That might help but I think you'll find it's not worth the effort. -- 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: Sorting Text in ROR
If I were you I would add a new column PLAIN_NAME or similar and I would strip everything out everything you don't want in the name and then sort by it. I think it would remove the complexity. You can populate the new column with a before_save callback. On Jun 10, 10:59 am, Runa roonadan...@gmail.com wrote: While sorting /ordering text it considers space first, then '.' then characters e.g. @user = User.find(:all,:order='name') it outputs A Sharma A. Bansal ---with dot Aarti Dev Is there any way to sort, so that i get the output as Aarti Dev A. Bansal A Sharma -- 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: Ruby Metaprogramming
On May 13, 1:41 am, Mike Disuza li...@ruby-forum.com wrote: Hi, I am working with a project where I am writing the following code:- store_fb_other_information(profile_obj, activity, fb_activities, provider, :activity, profile_obj.activity_information, ActivityInformation) #Book Information store_fb_other_information(profile_obj, book, fb_books, provider, :book, profile_obj.book_information, BookInformation) [...] Can I refactor the above code using metaprogramming If yes how? Hi there. I hope this helps... I think you could make this work several ways but in any case it looks to me that you only need to pass to store_fb_other_information a couple of things to make this whole thing work. For example: store_fb_other_information(profile_obj, provider, model) # where model could be an instance of Activity, Book, etc. if you have them or store_fb_other_information(profile_obj, provider, ModelName) # where ModelName could be the class name for Activity, Book, etc. if such models exist or store_fb_other_information(profile_obj, provider, ModelInformation) # where ModelInformation could be the class name for ActivityInformation, BookInformation, etc. which seems to exist or store_fb_other_information(profile_obj, provider, model_name) # where model_name is a string such as 'activity', 'book' My preferred option would be the first one (if those models actually exist and you instantiate them) because it would be the easiest in my opinion. Any other option would be a slight variation on this one, though. So say you have an activity object: store_fb_other_information(profile_obj, provider, activity) def store_fb_other_information(profile, provider, model) # if you need the second parameter as a string model_name = model.class.to_s.downcase # if you need to get to fb_activities model.send(fb_#{model_name.pluralize}) # you already have provider # if you need the model name as a symbol model_name.to_sym # if you need to get to the profile_object.model_information profile_obj.send(#{model_name}_information) end -- 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 null value when it's assigned
I'm assuming the problem happens when creating new records. Can we see the new and create actions in your controller and the full form in the view? Also, are there any before/after/around filters and/or callbacks that could be affecting the behavior of the application? On May 10, 8:19 pm, Tomas R. li...@ruby-forum.com wrote: I have my articles migration create_table :articles do |t| t.integer :category_id, :null = false etc.. and my form Select a category %= f.select :category_id, Category.all.collect {|category| [category.name, category.id ]} % But everytime im sending that info im getting a nil value for category_id -- Posted viahttp://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.
[Rails] Re: Autocomplete plugin
If I understand well the question the answer should be yes. If what you mean is if it is possible to use one field on a page to find data in more than one column in the table it should be possible the only thing you would need is to query the table by the columns you desire to query on. On May 10, 7:23 pm, Mlle emsto...@gmail.com wrote: Hi Is it possible to use the autocomplete plugin to search using a keyword on more than one field of a model? How can I do that? -- 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: Constants and Configurations
I believe I know what you are trying to ask. I had to setup something similar for an application of mine. I have one table with one column for each value type (boolean_value, string_value, integer_value, decimal_value and datetime_value) and a 'code' column for values such as 'timeout minutes'. In my maintenance pages I have the code field and 5 other fields, one for each column type. So far I have not used the datetime_value field but you never know. I validate that one and only one of the value fields is entered and make sure that if the chosen field is the boolean_value one it is either true or false to avoid mistakes such as the user not entering any values on the screens and pressing Enter. Another thing I am doing for security purposes is that once the record has been created the user must 'unlock' the code field in the editable pages to be able to change it and when he/she does an alert is displayed saying that if the code value is changed the application might stop working. I hope this helps. On May 8, 6:08 am, Tiago Veloso ti.vel...@gmail.com wrote: Hi, Right now I have some Constants in my application that serve as configurations for my application. I would like to make these configurations editable by the users/admins through views. What is the best strategy to do this? -- 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: Devise - Authenticate based on IP
Just a question... I am assuming the IP addresses will always be static? On May 3, 4:09 am, jack koh li...@ruby-forum.com wrote: I want restrict only certain IPs can to access my App. After authenticate IPs, username and password just allows user to access. -- Posted viahttp://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.
[Rails] GEMFile gem 'mysql2' and mysql version is 4.1.2
Hi all I have a Gemfile with this value gem 'mysql2' but when I run this command '$ bundle install' on my host they said that The command bundle install --local seems to be returning mysql2 dependency error now. Unfortunately mysql2 gem requires mysql 5.1+ ( refer: https://github.com/brianmario/mysql2/issues/109 ) whereas the server mysql version is 4.1.2. Since you are on a shared server, it is not possible to upgrade mysql version as it may affect many other users in the same server. how can I replace the expression gem 'mysql2' created by default when I run 'rails new mystore -d=mysql' to run with mysql 4.1.2? I am trying to install Spree following this link http://spreecommerce.com/documentation/getting_started.html Please advise! -- 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.
[Rails] Re: Communication between two apps?
On Mar 30, 10:10 am, Heinz Strunk li...@ruby-forum.com wrote: Hey folks, I have two different Rails apps and I would like t o sync the user databases. What's the best way to do that? I thought of whenever someone registers with one app the user information is posted to the other app and vice versa. What would you use for that? JSON? Sinatra? Thanks for the help! -- Posted viahttp://www.ruby-forum.com/. Are you talking about the whole database or just the users table? The way I read your post it looks like you just want to validate users and keep only one table for all users. If that is the case why not set up a connection in the application that does not own the users table that is only used by the User model? That should be enough to give you access to the user information you might need. -- 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: How to deserialize an array from XML
On Mar 27, 10:18 am, pepe p...@betterrpg.com wrote: On Mar 26, 1:24 pm, Gustavo de Sá Carvalho Honorato gustavohonor...@gmail.com wrote: Hi, to serialize an array to xml we can use: an_array = [ 1, 2, 3] an_array.to_xml But to I can't find a way to convert back XML to array. I didn't find a method Array.from_xml like Hash.from_xml. Any ideas? I have never done what you are trying but I know there is a way of converting a hash to an array (http://ruby-doc.org/core/classes/ Hash.html#M000722) so you could do a double conversion. If you need a simple array then you could just flatten the resulting array of arrays. I have looked again at this and I actually couldn't find a 'to_xml' method for Array or for anything else in Ruby. The method exists in Rails, though but for ActiveRecord instances, though, not for arrays. If what you are trying to do is converting a model instance to xml and backthis is how you could do: # Converting to XML my_model_instance = MyModel.find my_id xml = my_model_instance.to_xml # Generating instance from XML my_new_model = MyModel.new my_new_model.from_xml xml -- 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: How to deserialize an array from XML
On Mar 26, 1:24 pm, Gustavo de Sá Carvalho Honorato gustavohonor...@gmail.com wrote: Hi, to serialize an array to xml we can use: an_array = [ 1, 2, 3] an_array.to_xml But to I can't find a way to convert back XML to array. I didn't find a method Array.from_xml like Hash.from_xml. Any ideas? I have never done what you are trying but I know there is a way of converting a hash to an array (http://ruby-doc.org/core/classes/ Hash.html#M000722) so you could do a double conversion. If you need a simple array then you could just flatten the resulting array of arrays. -- 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: how to rescue this exception
[...]but i do not know why nearly all the examples in the book programming ruby re-raise the exceptions.i think i have misunderstood the exception in ruby.if an exception raises in the end used method,we generally do a final capture,and no need to reraise,am i right? You are right. Catching and re-raising the exception is used if you want to do something when the exception happens but you don't want to fully handle the exception. For example, if you would like to log it but you don't want to be responsible for handling the problem. If in your case catching the exception to update the flash is enough then that's all you need and you don't have to re-raise. thank you,i have further understood exception under your help,which makes me happy. You're very welcome. Glad I could help. -- 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: how to rescue this exception
[...]but i do not know why nearly all the examples in the book programming ruby re-raise the exceptions.i think i have misunderstood the exception in ruby.if an exception raises in the end used method,we generally do a final capture,and no need to reraise,am i right? You are right. Catching and re-raising the exception is used if you want to do something when the exception happens but you don't want to fully handle the exception. For example, if you would like to log it but you don't want to be responsible for handling the problem. If in your case catching the exception to update the flash is enough then that's all you need and you don't have to re-raise. -- 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] CMM based on RoR
hi all What CMM based on RoR do you recommend that will allow me to add my own RoR forms? thanks -- 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.
[Rails] Re: CMS (Content Management System) based on RoR
Sorry I means CMS (Content Management System) -- 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.
[Rails] Comment creer un formulaire maitre-detail
Salut a tous! Est-il possible de creer un formulaire maitre-detail? J'ai besoin de creer une fenetre ou l'utilisateur rentre un commande et les differents produits associaes a cette commande. Puis-je afficher le tout dans une seule page? Faut-il un minimum de 2 pages Comment visualiser le detail de la commande avec tous les produits commandes, et l'imprimer si necessaire. Merci -- 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.
[Rails] Re: Comment creer un formulaire maitre-detail
Sorry! I made a mistake, I should write this post in the French forum. Please remove it from this group!!! -- 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.
[Rails] Master detail forms and reports
Hi all I need to create a data entry form that will follow the master-detail structure and then I need to show a report where the user selects a record and it displays a parent/child relationship between two tables on the screen. Any suggestions of where I can find a template or an application that could help me? Please advise! -- 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.
[Rails] Re: Hide/Show Div and link_to_remote
Lets ignore the 'editable' form part. In general how would I hide/ show a div on a button click for instance? In addition to what Walter mentioned there is the 'toggle' function: http://api.prototypejs.org/dom/Element/toggle/ -- 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: how to set default_scope for the whole application?
I want is to set default_scope :order = 'created_at ASC' for all models on default. How is that done? If you want to do this no matter what I think there should be a way to do it at initialization. If you are using Rails 2.3.x you might be able to do it in 'new_rails_defaults.rb' in folder config/ initizializers. I have not used Rails 3 yet so I don't know where I would make the change in that version, there is a comment in 'new_rails_defaults.rb' saying that the contents of that script will be default in Rails 3 and the script can be removed when Rails is upgraded to 3 so maybe the script will not run, but you can always try anyway. -- 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: how to set default_scope for the whole application?
On Feb 2, 2:00 pm, Slava Mikerin mikerin.sl...@gmail.com wrote: I want is to set default_scope :order = 'created_at ASC' for all models on default. How is that done? I might be wrong but unless you don't have IDs in your tables what you are trying to do is equivalent to leaving things as they are since the IDs are created in ascending order and retrieve in the same way (maybe I read somewhere that Postgre might be an exception), the same thing that happens with the values of created_at. That is, unless you are planning on changing the value of created_at manually after the record has already been created or the computer clock is reset or... pick your choice of strange stuff here. -- 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: has many through and STI
Not fully understanding your problem, have you tried named_scope? On Jan 26, 9:50 am, Rodrigo Pavano rodrigopav...@gmail.com wrote: Hello! Im using ruby 1.9.2 and Rails 3.0.3. I have the following models class Property ActiveRecord::Base class Feature ActiveRecord::Base class DefaultFeature Feature class CustomFeature Feature class PropertyFeature ActiveRecord::Base One Property can have many Features, and one Feature is associated with many Properties (joined through PropertyFeature model). There are two kinds of Features: DefaultFeatures and CustomFeatures, for what Im using single table inheritance. Both kinds of Features have exactly the same fields, but i need to differentiate them in my application. What i want to achieve, if possible, is being able to access Features from a Property instance like this: a_property.features a_property.custom_features a_property.default_features And also add features to a property: a_property.custom_features CustomFeature.new a_property.features CustomFeature.new The closest solution i could think of is this one:http://pastie.org/1499280 The problem I'm having is that when i call a_property.custom_features it brings all features from the property: custom AND default ones. I've already tried making polymorphic the belongs_to :feature association in the PropertyFeature model, but it raised an ActiveRecord::HasManyThroughAssociationPolymorphicError exception, so i assume rails is not supposed to work like that. I'd appreciate any help on how to do this (i've tried everything i could think of). Maybe my approach is wrong to begin with, in which case i'd love to hear a better way to to this. thanks! -- rodrei -- 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: Developing on Win7?
I have been developing in Windows for a while now and it's true that there is no much support or love for it in the RoR world. If you really want to keep going with Windows, though, if I were you I would get the rubyinstaller and DevKit right away from http://rubyinstaller.org/downloads. To install DevKit follow instructions at https://github.com/oneclick/rubyinstaller/wiki/Development-Kit. Most of the problems I have had working with Windows were because of the DB adapters. To work with MS SQL you will need 2 gems: activerecord-sqlserver-adapter ruby-odbc Working with MS SQL you will probably want to stick to ODBC so you will need to create a System DSN. In Windows 7 first try to create it the regular way but it probably will not work. If it does not work then you will need to delete what you just created and then use the executable at C:\Windows\SysWOW64\odbcad32.exe. This is the 32-bit version. To work with Oracle you will also need 2 gems: activerecord-oracle_enhanced-adapter ruby-oci8 Good luck On Jan 21, 7:06 pm, Ben Giordano benjamintgiord...@gmail.com wrote: Looking to learn Rails but hoping to stick with Win7/xp as all of the machines I work on run one of those two OSs. Would hate to be stuck to my laptop for development b/c its the only machine I have running ubuntu. Am I shooting myself in the foot by trying to learn rails on windows? -- 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: find_or_create : how to know the resulting operation ?
Just a thought. Maybe you can use a call back before the record is saved to set up a virtual attribute based on the result of new_record? On Jan 5, 3:52 am, Fabrice Fabrisss li...@ruby-forum.com wrote: hello, find_or_create_by has a different behaviour according to the existence of the instance in the database, is it possible to know the resulting operation (find or create) which has been actually executed ? thank you, Fabrice -- Posted viahttp://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-t...@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: Saving records from multiple tables
I see 2 things that might help you. On one hand you could use accepts_nested_attributes_for in your person model and fields_for in your view, then you would only need to save the person and that would take care of the client as well but based on what I see in your code that might not be feasible. On the other hand you could wrap the code for your save commands in a transaction and if there is any type of error during any of the saves Rails will roll back the transaction and you're golden. On Dec 22, 8:30 pm, giorgio george.pever...@gmail.com wrote: I hav page where I am saving a client record and a person record. Sometimes the person is an existing record and sometimes it is a new record. The client is always new. Here is some code: class Person ActiveRecord::Base has_many :clients class Client ActiveRecord::Base belongs_to :person validates_presence_of :person_id def create @client = Client.new(params[:client]) begin #check if the person already exists @person=Person.find(params[:person][:id]) rescue #otherwise create new person @person=Person.new(params[:person]) end @client.pers...@person begin Client.transaction do @person.save! @client.pers...@person @client.save! flash[:notice] = 'Client was successfully created.' redirect_to :action = 'edit', :id = @client.id end rescue render :action = 'new' end end Im not really sure what the best way and order to do the saves is. If I try to save client first then it wont have a person_id yet and will fail validation. If I save the person first and then the client fails validation for some other reason the code sort of works in that it rolls back but the @person record has an id set even though the save failed. It also appears to return false for @person.new_record? Is there a tidier way to do this? I have tried @client.person.save and various other combinations but it is not really clear what actually gets saved. Any comments appreciated. George -- 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-t...@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: Saving records from multiple tables
You say to use a transaction... I already am using a transaction! Sorry about that. I obviously didn't read carefully your post. The issue is that if the person save succeeds and the client save fails then the transaction is rolled back fine. However the person record now has a person.id and subsequent code assumes that the record is saved and tries to refind the record which of course does not exist. I have got around this by saving the original value of the person.id and then resetting it in the rescue clause but it is a bit messy. One other issue is that the only validation errors that get set are the errors from the first record (person) that is saved so the user may fix these up only to find new validation errors from the second record... I have not tried before what you are trying to do but I will as soon as I have some time to spare. I don't understand why Rails would not clear the ID value of the record and reset the record in order for new_record? to return true. I'm sure there must be a tidy way! If you use acceptes_nested_attributes_for and field_for the validations will work just like you want them to work, however you will need to change your form to be based on your person model, which based on what you have explained would be pretty much impossible since the person is selected in the form and you don't have a person object to base the form on. -- 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-t...@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: unpacking ruby-odbc
Bundler might help here. I don't know bundler but for what I read in the web site it would only help with the list of gems not with unpacking ruby-odbc. -- 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-t...@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: unpacking ruby-odbc
I need to install my application to a Windows server My goodness, why? That's just asking for trouble. We've had this conversation more than once. Right. Gems with native extensions generally can't be frozen usefully. Well, that does not help me much. If it can be done I'd like to try it. If it can't be done then I'd move on and go with the install approach I currently have. -- 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-t...@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: unpacking ruby-odbc
What 'native extensions' means is that parts of the gem are not written in Ruby but are (generally I think) in C. These need to be compiled to generate code suitable for the OS the app is being run on. Yes, I learned that by working with ruby-odbc. The gem cannot therefore be frozen as it would be frozen with code compiled for the wrong OS. I think therefore you must install such gems on the target machine in the normal way. Thanks Colin. I was afraid that would be the case. -- 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-t...@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] unpacking ruby-odbc
Hello, I need to install my application to a Windows server (using MSSQL as the DB) and to make my life easier I am freezing the application. I have been able to freeze rails and unpack all the gems I need (including activerecord-sqlserver-adapter) except for one: ruby-odbc I can install the gem the regular way, which DevKit builds correctly. I can run the application with the gem in the open. Then when I unpack the gem everything seems to work, I get the message Unpacked gem: ‘C:/Pepe/Code/RoR/afm/vendor/gems/ruby-odbc-0.2’, but after I uninstall the 'regular' gem and try to start Mongrel: C:\Pepe\Code\RoR\afmruby script/server = Booting Mongrel = Rails 2.3.5 application starting on http://0.0.0.0:3000 C:/Pepe/Code/RoR/afm/config/../vendor/rails/railties/lib/rails/ gem_dependency.rb :119:Warning: Gem::Dependency#version_requirements is deprecated and will be rem oved on or after August 2010. Use #requirement The following gems have native components that need to be built ruby-odbc = 0.2 You're running: ruby 1.8.7.302 at C:/Ruby187/bin/ruby.exe rubygems 1.3.7 at C:/Users/bob/.gem/ruby/1.8, C:/Ruby187/lib/ruby/ gems/1.8 Run `rake gems:build` to build the unbuilt gems. I then try to build: C:\Pepe\Code\RoR\afmrake gems:build (in C:/Pepe/Code/RoR/afm) rake aborted! ERROR: Failed to build gem native extension. C:/Ruby187/bin/ruby.exe extconf.rb checking for version.h... no checking for sql.h... no *** extconf.rb failed *** Could not create Makefile due to some reason, probably lack of necessary libraries and/or headers. Check the mkmf.log file for more details. You may need configuration options. Provided configuration options: --with-opt-dir --without-opt-dir --with-opt-include --without-opt-include=${opt-dir}/include --with-opt-lib --without-opt-lib=${opt-dir}/lib --with-make-prog --without-make-prog --srcdir=. --curdir --ruby=C:/Ruby187/bin/ruby --with-odbc-dir --without-odbc-dir --with-odbc-include --without-odbc-include=${odbc-dir}/include --with-odbc-lib --without-odbc-lib=${odbc-dir}/lib ERROR: sql.h not found Gem files will remain installed in C:/Pepe/Code/RoR/afm/vendor/gems/ ruby-odbc-0. 2 for inspection. Results logged to C:/Pepe/Code/RoR/afm/vendor/gems/ruby-odbc-0.2/ ext/gem_mak e.out (See full trace by running task with --trace) I have even successfully installed the gem in the gems directory, just in case it would work: C:\Pepe\Code\RoR\afm\vendor\gemsgem install ruby-odbc -i C:\Pepe\Code \RoR\afm\v endor\gems Temporarily enhancing PATH to include DevKit... Building native extensions. This could take a while... Successfully installed ruby-odbc-0.2 1 gem installed Installing ri documentation for ruby-odbc-0.2... Installing RDoc documentation for ruby-odbc-0.2... But it doesn't: C:\Pepe\Code\RoR\afmruby script/server config.gem: Unpacked gem cache in vendor/gems has no specification file. Run 'ra ke gems:refresh_specs' to fix this. config.gem: Unpacked gem cache in vendor/gems not in a versioned directory. Givi ng up. config.gem: Unpacked gem doc in vendor/gems has no specification file. Run 'rake gems:refresh_specs' to fix this. config.gem: Unpacked gem doc in vendor/gems not in a versioned directory. Giving up. config.gem: Unpacked gem gems in vendor/gems has no specification file. Run 'rak e gems:refresh_specs' to fix this. config.gem: Unpacked gem gems in vendor/gems not in a versioned directory. Givin g up. config.gem: Unpacked gem specifications in vendor/gems has no specification file . Run 'rake gems:refresh_specs' to fix this. config.gem: Unpacked gem specifications in vendor/gems not in a versioned direct ory. Giving up. = Booting Mongrel = Rails 2.3.5 application starting on http://0.0.0.0:3000 C:/Pepe/Code/RoR/afm/config/../vendor/rails/railties/lib/rails/ gem_dependency.rb :119:Warning: Gem::Dependency#version_requirements is deprecated and will be rem oved on or after August 2010. Use #requirement The following gems have native components that need to be built ruby-odbc = 0.2 You're running: ruby 1.8.7.302 at C:/Ruby187/bin/ruby.exe rubygems 1.3.7 at C:/Users/bob/.gem/ruby/1.8, C:/Ruby187/lib/ruby/ gems/1.8 Run `rake gems:build` to build the unbuilt gems. I am probably missing something obvious but I haven't been able to figure it out. How can I unpack ruby-odbc correctly? Any clues? Thanks in advance. -- 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-t...@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: ORA-12514: TNS:listener d oes not currently know of service requested in connect descriptor (OCIEr
ORA-12514: TNS:listener d oes not currently know of service requested in connect descriptor (OCIError) Just a guess... Is it possible that your database name is misspelled compared to the contents of TNSNAMES.ORA? -- 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-t...@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: ORA-12514: TNS:listener d oes not currently know of service requested in connect descriptor (OCIEr
after some search related to the error I happen to check this link http://www.ruby-forum.com/topic/96884; and followed the procedures but now I am stuck with the below error C:\Documents and Settings\SawanKumar.Thammadi\RubyOnRails\datamangerrake db:migrate (in C:/Documents and Settings/SawanKumar.Thammadi/RubyOnRails/datamanger) rake aborted! OCI Library Initialization Error oci8lib.c:98:in oci8lib_191.so C:/Ruby192/lib/ruby/gems/1.9.1/gems/activesupport-3.0.3/lib/active_support/dependencies.rb:239:in `r equire' Have you installed the ruby-oci8 gem? (http://ruby-oci8.rubyforge.org/ en/InstallBinaryPackage.html) -- 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-t...@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: created_at, updated_at and MSSQL
So there is never any ambiguity about timestamps in the database. For example, suppose you move to a server in another timezone, it can get very messy if you have timestamps in EST or whatever happens to be your local timezone today. By keeping all timestamps in the db in UTC you will always know what they mean. I understand the benefits of UTC, however... Normally Rails will do the conversion to local time for you so the fact that it is UTC in the db is not something you need normally worry about. This is the reason why I noticed. I have to display on screen the date and time from updated_at and I saw that while my local time was around 4:00 PM the screen was displaying around 9:00 PM. In other words, there is no 'conversion' going on. I don't know if it makes a difference but when I display the values I am not displaying the full value of updated_at, I have to break it down in 2 values, date and time, and I am using strftime to do the job. Should I be using something different and/or converting the values to local time first somehow? -- 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-t...@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: created_at, updated_at and MSSQL
Use created_at.localtime.strftime( ) Couldn't have been any easier. Thanks 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-t...@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] created_at, updated_at and MSSQL
Hello, I am running into a little issue. There is a considerable time difference between the time that the console is giving me and the time I am seeing in the created_at and updated_at column in the DB. The difference is about 5 hours. I don't think the problem is in the DB, but I could be wrong. Am I missing something obvious? Any clues? -- 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-t...@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] created_at, updated_at and MSSQL
Hello, Sorry if this is a double post. I think I did something wrong with the original one. I am running into a little problem with the fields mentioned above. The difference between what Rails is saving in the DB and what I can see in the console is of about 5 hours. Am I missing something obvious? Anybody has a clue about what might be going on? Thank you. -- 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-t...@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: created_at, updated_at and MSSQL
Thanks, the time_zone value in environment.rb is the reason this is happening. On Dec 13, 5:05 pm, Anton Anykeyev li...@ruby-forum.com wrote: check timezone settings in your environment configs -- Posted viahttp://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-t...@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: created_at, updated_at and MSSQL
The value in the db should be UTC, so may be correct, dependent on where you are. Thanks Colin, I am in the US, EST. UTC is 5 hours ahead of me (rake time:zones:all). For a multiple time zone application I understand that having UTC would be the option. Is there a reason I am not aware of why I should still use UTC for a single time zone application? -- 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-t...@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: Which RoR to run on Mac OS X for a particular RoR app.
RobsMacAir:~ rob$ gem uninstall my_gem -v=2.3.8 ERROR: While executing gem ... (Gem::InstallError) Unknown gem my_gem = 2.3.8 Sorry, I forgot to tell the group to e-mail me updates on the post. I'm sorry, Colin is right, what I wrote was just an example. I expected after deinstalling rails 2.3.8 gem list local would find the other rails versions. But did this blow away all rails? The gem command is being cautious. It doesn't want to delete anything but the absolutely necessary. I personally would not want to remove a gem and find out that the command blew away 10 other gems just because they are either required by the one I just deleted or compatible with it. What if I wanted to keep them because they serve me for other purposes? Removing gems is a little boring but it shouldn't take you more than 10 or 15 minutes to remove all the ones you need to remove once you get the hang of it. I admit I am in learning mode. I thought this was a place to help out beginners. Absolutely. I have had great help in this forum from day 1. I have been programming in Assembler, C, and tons of SQL and now some PHP and writing shell scripts since the late 70s, and the complexity and impreciseness of the books and tutorials are amazing RoR, I can't say that I agree with you here. What _is_ confusing is that there are so many out of date tutorials and mailing list archive entries that are found when searching for data on rails. This is inevitable unfortunately if you want to experiment with fast moving technologies like Rails. All the ones you mention have been little changed for decades so the documentation is stable. +1 with Colin here Is there a way to just go into the file system, and delete all the directories for Rails and just do a fresh reinstall. I cannot figure out rvm, After reading an entry on the internet I tried just that a week or so ago as the entry specified that it _might_ be possible. However, after I blew away all folders in the gem directory and asked for the gem list all the gems were still there and I had to run the commands manually anyway to make sure everything was gone as it should. I didn't want to have problems during re-installation. You're going to need to uninstall the gems manually and probably selectively I'm afraid, but if you find a way to do it all at once, please let me (us) know. -- 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-t...@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: Proper way to back out a bad migration?
Typically I do rake db:migrate VERSION=0 But that also gave me the same error about Primary key is not allowed in a has_and_belongs_to_many join table So I then fired up dbconsole and manually dropped the table. But now I even if I run rake db:migrate the join table isn't created - probably because it 'think' it had run it previously. I believe the problem you've been running into is that your schema migrations table still has the number of the migration(s) you removed manually. When the rake task runs it sees the numbers there and says OK, that one is done so it skips the migration. I think the best thing to do in that case is to manually delete the record(s) in the schema migrations table in order to be able to rerun them. -- 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-t...@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: Which RoR to run on Mac OS X for a particular RoR app.
How, I tried the RobsiMac:~ rob$ sudo gem uninstall rails -v 2.3.8 Select gem to uninstall: 1. rails-2.3.8 2. rails-2.3.8 3. All versions 3 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 Remove executables: rails in addition to the gem? [Yn] Removing rails Successfully uninstalled rails-2.3.8 RobsiMac:~ rob$ rails -v -bash: /usr/bin/rails: No such file or directory I seem to have messed up somehow. (i.e. I expected after running sudo gem uninstall rails -v 2.3.8 I would get rails -v saying the next most current version.) I believe the problem might lie in leaving the '=' sign out of the command: gem uninstall rails -v=2.3.8 (what I would have typed) vs. gem uninstall rails -v 2.3.8 (what you actually typed) I'm not sure, but *maybe* you had 2 different versions of 2.3.8 installed (if that is possible)? I guess it's possible that when you answered with option 3 it went out and blanketed out the rails versions and now you don't have any of them. :( If that is the case and since you need rails installed you can install it by just specifying the version you want: gem install rails -v=x.x.x (replace the x.x.x with the version you need). That should install any other dependencies it might need if you still don't have them. If you have problems or more questions I think it might be helpful if you post the list of gems you have now to give us a better idea about what mismatches you could have. There is something you should know I am not sure you are aware of. Different versions of Ruby and Rails have different dependencies. For example, a given version of rails might need a minimum (and maybe maximum) version of activerecord. Just having _any_ version of activerecord will not do. In my opinion the best thing you could do if you want to have a clean environment is remove everything you have and install what you need. The process *shouldn't* be difficult. I believe the prior mentions to RVM were meant to indicate to you that there are ways of keeping separate environments if you need them. For example, you might have an application that runs under Ruby 1.8.6 and Rails 2.3.5 and another one under the latest Ruby and Rails versions. The activerecord and related gems you need are going to be different for sure for between both environments. RVM will help you to keep those 2 environments separate. -- 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-t...@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: Which RoR to run on Mac OS X for a particular RoR app.
Never, this is the one and only rails app ever. I do want to get 1.8.7 on this machine and rails 2.2.2 to match the source machine. I would actually like to eventually find a programmer to convert it off rails. If you are thinking about getting a programmer anyway maybe it might be wiser if you get one now to get your RoR environment straight and your application running as it should. If what you are unhappy about is the trouble you're having with it, you not being an expert, but the application is doing what it is supposed to at your satisfaction when the setup is correct I think converting the application might be a mistake. You probably will end up spending a lot more money rewriting the application than paying somebody to get your application environment straight. That's your call, though, of course. -- 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-t...@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: Which RoR to run on Mac OS X for a particular RoR app.
Is there a way to run gem in verbose mode to see what is going on? maybe gem (un)install your_gem_here -V? The flag -V (that's the uppercase letter) tells the command to be 'verbose'. -- 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-t...@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: Which RoR to run on Mac OS X for a particular RoR app.
One remaining glitch. About your application’s environment: MissingSourceFile in Rails/infoController#properties no such file to load -- sqlite3 RAILS_ROOT: /Users/rob/hello222 Is this a missing sqlite gem? I believe it could be. Try loading the gem and see what happens, you can always remove it. Is your application using sqlite as a DB? -- 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-t...@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: Which RoR to run on Mac OS X for a particular RoR app.
That probably means that you need a C compiler or DevKit so the install command can build the gem. On Dec 7, 6:27 pm, Rob Th li...@ruby-forum.com wrote: Shoot. What the heck is this sudo gem install sqlite3-ruby -v 1.2.4 Password: Building native extensions. This could take a while... ERROR: Error installing sqlite3-ruby: ERROR: Failed to build gem native extension. /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.2.4 for inspection. Results logged to /Library/Ruby/Gems/1.8/gems/sqlite3-ruby-1.2.4/ext/sqlite3_api/gem_make.out RobsiMac:~ rob$ -- Posted viahttp://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-t...@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] Windows new installation - Always problems
I would like to know if there is a way to 'package' an application with all the associated gems and ship it to a new server and having it to just work in a Windows environment. Although I have never done it I know that Rails can be frozen into the application. I am wondering if I can do the same thing with other gems. I have found this (http://gemsonrails.rubyforge.org) that seems to be what I need, although it's from 2007 and I was wondering if anybody is using it and/or there are other or better alternatives. Since I can't use RVM I have looked into Pik but that, I believe, will not help me since it's a way to keep environments separate, not 'package' the application as I need it. Also, would it be possible to include Ruby and Mongrel in the 'package'? That would be just great. Any help would be greatly appreciated. Thank you. -- 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-t...@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: Windows new installation - Always problems
Rails doesn't ever just work on Windows, does it? :) Although I have never done it I know that Rails can be frozen into the application. I am wondering if I can do the same thing with other gems. I have found this (http://gemsonrails.rubyforge.org) that seems to be what I need, although it's from 2007 and I was wondering if anybody is using it and/or there are other or better alternatives. Rails 2: rake gems:unpack Rails 3: Bundler (which you can also install for use with Rails 2 if you like) Will look into that. Thanks. Mongrel is a gem, but it's got compiled bits IIRC. Yes, I know it's a gem. I'm guessing I'm wrong but I thought it would be easier/best if I have it installed in the open and use Windows services if I am running more than one application on the same server. Can I start a Windows service if I have Mongrel frozen under the application? Investigate JRuby and Glassfish. I looked into JRuby some time ago. What would that buy me in relationship to 'packaging' the application? Better yet, don't deploy on Windows. You couldn't resist, could you? :D -- 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-t...@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: Windows new installation - Always problems
I looked into JRuby some time ago. What would that buy me in relationship to 'packaging' the application? Well, you could compile the whole thing as a WAR file and deploy it as a Java servlet. Glassfish supposedly gets you similar benefits without needing to compile. I don't use JRuby for Rails, but I understand it tends to be the easiest way to get things working on Windows. Thanks Better yet, don't deploy on Windows. You couldn't resist, could you? :D No. Why do things that are painful if a known non-painful way is available? Some clients impose the infrastructure and that's what we have to work with. I've been told We want Oracle because we already have it and we don't want to have to learn to maintain MySQL/PostgreSQL/ other. They prefer Windows for the same exact reason. Learning Linux is something they just don't want to do. It's unfortunate but it's reality. -- 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-t...@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: Windows new installation - Always problems
Many will dis it but I have found Instant Rails well suited to exactly that (if you have to work in windows). The latest version of Instant Rails is old and uses Rails 2.0 or so it can be upgraded using gems (look on this list for problems with that other have had) to at least 2.3. I do not know the score on 3.0 as I have not gotten there yet. IR integrates all of the stuff for ROR including Ruby, the db server (mysql) and mongrel (I think, if not you can install it using gem install) You can just freeze all of your gems and away you go. I had not thought about IR but it actually would not work in this case, I think. To make the whole picture even better the client will not only use Windows but MSSQL as well, which is how the whole mess started actually (ODBC problems). In order to use MSSQL I have to install some gems that need the DevKit and DevKit needs Ruby to be installed with the Rubyinstaller (if I remember the name well). That would probably not work (I could be wrong) with Ruby installed from IR. Also the Rails version will probably need to be upgraded to make all our applications compatible. Manually installing Ruby and Mongrel and then freezing gems into the application might be the way to go here. I'll be trying out Marnen's suggestions for that and I will also try to replace the ODBC dependency with something like 'tiny_tds' and see how that works. Thanks though. -- 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-t...@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: Windows new installation - Always problems
Then do what we're doing here: use a separate *nix server for the Rails app, and connect with TinyTds. That way Rails and MSSQL both get the environment in which they're happiest. That's exactly the idea I had in mind but... it was not well received. -- 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-t...@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: Which RoR to run on Mac OS X for a particular RoR app.
To uninstall a gem version you have 2 options: a) Declare the version at the end of the uninstall command: gem uninstall my_gem -v=x.x.x (You replace the 'x.x.x' with the version you want to remove, OR b) Run the uninstall command without version specified: gem uninstall my_gem Option b) will prompt you which version you want to remove out of all the versions you have loaded but if you only have one version it will go ahead and remove just that one without asking. Just a note about the 'what you wants'. I don't know if it will be your case but I'm not a native English speaker and when I first talked to native speakers it bothered me a lot the 'no, what you want is...', then I realized that it's just their way of saying 'what you probably should do is...', or I take it that way. It has never bothered me since I saw it that way. -- 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-t...@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] fields_for and one out of many from association
class Person ActiveRecord::Base has_many :addresses has_one :primary_address, :class_name = 'Address', :order = 'preferred desc, id' accepts_nested_attributes_for :addresses, :allow_destroy = true accepts_nested_attributes_for :primary_address, :allow_destroy = true end class Address ActiveRecord::Base belongs_to :person end In the view: % f.fields_for :primary_address do |address_builder| % %= render 'addresses', :f = address_builder % % end % The 'addresses' table has a boolean column named 'preferred' and there should be only one address for the person that is the preferred one. Testing on the console the 'has_one' definition gives me the 'preferred' address if there is one, otherwise it gives me the first one it finds or returns nil if there are no addresses for the person. All this is working as expected. If my association has 2 addresses (I'm making sure one of them is 'preferred' and the other one is not), when the view code runs it does not output just one address (which is what I need), it outputs 2 addresses, actually the same (preferred) address twice. Is there a way to make fields_for do what I need it to do? Thanks in advance. -- 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-t...@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: fields_for and one out of many from association
Never mind. I think I got it. -- 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-t...@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: Update div with Prototype
Hi, I have not used Rails 3 yet and I see by your link_to helper that's what you are using. Sorry if I can't be of much help, but I'll try to point out what I see here that _could_ be wrong. div class=menu_activado % = link_to Link, about_path,: remote = true% /div!-- fin sub_cabecera -- I am assuming the first div is missing the opening '' because of a mistake while copying the code? A quick look at the Rails 3 API does not show how to indicate that you want to update an HTML element's contents. Compare the link above with the following, based on Rails 2.3.5: %= link_to_remote 'Get Time', :update = 'current_time', :url = {:action = 'get_time' }, :complete = visual_effect(:hightlight_shake, :current_time) % div id=current_time/div Notice the :update line? It indicates what HTML element to update with the contents returned by the server. I can't see in the Rails 3 API how to do that. Maybe it's explained somewhere else but not in the link_to helper docs, as far as I could see. div class=container %= render 'layouts/header' % div class =datos id=datos %= yield % /div %= render 'layouts/footer' % /div I am not sure you really want to replace the contents of 'datos'. That would replace the contents of the whole page except for the header and the footer. class PagesController ApplicationController def about @title = About end end From the link_to_remote Rails 2.3.8 API: Returns a link to a remote action defined by options[:url] (using the url_for format) that’s called in the background using XMLHttpRequest. The result of that request can then be inserted into a DOM object whose id can be specified with options[:update]. Usually, the result would be a partial prepared by the controller with render :partial. The last sentence is the important one. Your 'about' action does not render anything, it only assigns a value to a variable. The returned value of your action will be the string 'About' and that should be what you get in 'datos' after the code executes, supposing that the div gets updated. -- 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-t...@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: Update div with Prototype
The title variable is to change the title when the page is refreshed. I believe you are a little lost about how the whole thing works. At first you said you wanted to change the contents of 'datos' but now you say you want to change the contents of the tag title. I'll assume from now on it is the later. head title%= title %/title /head I think there is a typo in your code. Shouldn't it be %= @title %?. Besides that, I have never tried to replace the contents of an element in the header section so I'm not sure it will work. I'd appreciate if you let me know when you get your code working. For your code to work you would have to give an id to the element you want to replace, as in: title id=title%= @title %/title Then it might be a good idea to create a partial and render it to replace the contents of the tag title, although returning just a string might be OK. You would also need to tell your 'link_to' helper which HTML element to replace ('title' in this case) and as I explained before I couldn't see how to do that by looking at the API with Rails 3. Somebody else already using Rails 3 might be able to help better than me there. -- 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-t...@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: Dependency Problem
Do you remember the version of the gem(s) you had before you updated them? There is a way to install specific gem versions by adding the version at the end of the install command. Something like this: gem install rails -v=2.3.5 # This would install Rails 2.3.5 You can also check the dependencies of the other installed gems to try to figure out the version you might be missing. Check the documentation at http://docs.rubygems.org/read/chapter/10#page78 On Nov 29, 3:01 pm, John joben...@gmail.com wrote: I've seen people post similar issues at various places, but I have yet to find an explanation on how to resolve this issue. I'm a new Rails user, so I need a little adult supervision please. I carelessly ran a gem update this morning and it updating a couple gems. Since that point, I've been unable to use rails. When I attempt to, I get the error: /Library/Ruby/Site/1.8/rubygems.rb:779:in 'report_activate_error': RubyGem version error: builder(3.0.0 not ~ 2.1.2) (Gem::LoadError) There were a few additional lines. If those would be helpful in troubleshooting this error, please let me know. As far as I can tell, this is a dependency issue. I tried uninstalling the builder gem and reinstalling it. That didn't fix the error. I tried uninstalling the rails gem and it's dependencies and reinstalled them all. That also didn't fix it. I'm at a loss for what to do. Your suggestions and guidance are appreciated. -- 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-t...@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: how to 'delete' an object from an association collection in-memory only
If I understand you correctly you only need to remove the association's array element. That will not delete the underlying DB record if there is one. On Nov 30, 3:13 pm, Lille lille.pengu...@gmail.com wrote: Hi, My Rails app offers opportunities to try out models on a 'what-if' basis, where dependent associations can be modified to obtain alternative results for the parent. Is there a way to delete/destroy the member of a collection so that I can play around with the accordingly modified parent in memory, without actually committing the destruction of the collection member to the data store? Based on my read of the docs, there is no 'delete' counterpart to 'collection.build' for association members. Thanks for any comment, Lille -- 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-t...@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: How Rails handles database connection in the background??
A quick search for 'rails database timeout' brought this, but it's from 2006. Check the final answer: http://wooga.drbacchus.com/rails-and-mysql-timeouts On Nov 30, 12:28 pm, Anusuya R. li...@ruby-forum.com wrote: I am trying show controller specific pages in my rails app when the database connection goes away. I do this by catching the Mysql::Error in the rescue_action method and rendering appropriate pages. When the mysql service alone is stopped , i get the Mysql::Error exception really quickly and i could render the pages without any delay. But when the server itself is shut down, rails takes 3 mins to throw the Mysql::Error and after 5-6 request the whole website becomes unresponsive. I tried to figure out, which method in rails framework takes such a long time , when the mysql server is shut down. It was a method connection.real_connect (in the active record mysql_adapter file),which took 3 mins to return with an exception when there is no connection with the database server. so i decided to timeout out this method using systemTimer gem. This monkey patch worked perfectly, when i start the website with database connection and immediately shutdown the database server. But when i start the website with database, and access the website for sometime and then shut down the database server, it doest work at all. and the whole website becomes unresponsive as before. I wonder what is the difference between the two scenarios. I think i need to know more in detail about how rails handle database connection . how it reacts when the database connection goes off. so that i could identify exact places where i can put monkey patches and make it work for my specif requirement. I havent seen any relevant article explaining this. Any help will be very useful for me Thanks, -- Posted viahttp://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-t...@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: Update div with Prototype
I might be blind, but I can't see a div tag anywhere. I think your snippet should also contain controller code to be able to see what might be going on. On Nov 30, 5:33 am, Alberto B. li...@ruby-forum.com wrote: I want to update a div on my page with prototype (new Ajax.Updater ('my_div', 'page.html')). What I do is: . . % = csrf_meta_tag% % = javascript_include_tag: defaults% . . % = yield% . . % = link_to Link, page_path,: remote = true% Without the :remote = true the div is updated but it does nothing. Anybody can help me? Thanks. -- Posted viahttp://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-t...@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 get all models,controller,action and method names
Answering the following post that I could not (did not know how to) re- open: http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/6d9a5679d73b0a6b/d17adc61119d2acc?lnk=gstq=All+controllers%27+action+names#d17adc61119d2acc I have been working on getting a list of all actions in every controller of my application to automate certain process. I found a couple of links with some useful information that lead me to write this code: code # This produces an array with subclasses names. ApplicationController.subclasses.sort.each do |subclass| # This creates a new instance of a controller based on the subclass name. controller = subclass.constantize.new # This creates an anonymous singleton class in which I declare # a public method that accesses private method 'action_methods', # which returns the controller actions class controller def my_action_methods action_methods end end /code I hope this helps somebody. -- 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-t...@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: How to create a mail service like gmail using ror
Actually i am a bit new to the development side. and new to ror as well.but i want to learn Ruby on Rails and start my web development. i want to build a real time application while learning..can u guide me pls... Hi there, First of all I would get familiar with Ruby, which is VERY important and you don't need to know any Rails to have some fun with it. Pay special attention to blocks. Then I would try to understand the MVC design pattern, Rails is based on it and will help you tremendously in understanding how things work and why the application looks so 'spread out' in different folders and files. Then I would try to build something really simple like a Hello World type of application, there are many tutorials out there. If you're happy and want to keep going then I would try to learn how to use activerecord, which will be immensely helpful working with any DB. Then you should have enough information to start building your real time application. IMHO, if you miss any of the above you're in for a rough start (personal experience ;) ). -- 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-t...@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: select helper with boolean and null/nil values
At that point, you *did* need it. Ugly or repetitive code is an example of a need -- in this case, for refactoring or generalization. There might have been a 'personal' need but I don't think that makes it a *real* need. The ugly code was just the way it is done. Changing it was like saying I don't like the way Ruby lets me assign strings to a variable so I am going to change it. and then you come up with something that replaces my_var = 'my string'. -- 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-t...@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: select helper with boolean and null/nil values
Hi David, Can you post your application in a different format? I need a C compiler to install bzip2 and I'd rather not go into all that. Thanks. -- 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-t...@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: select helper with boolean and null/nil values
I believe your problems are coming from the fact that you allow something different than true/false in your DB column. If the column is supposed to contain a boolean value, why are you allowing it to contain the null value? A boolean value is either true or false, not null. If I were you I would force the value to be one or the other and make the column not null capable. You can enforce the rule with one of the validation helpers. This is extracted from the 'validates_presence_of' documentation: If you want to validate the presence of a boolean field (where the real values are true and false), you will want to use validates_inclusion_of :field_name, :in = [true, false]. If you don't want to display errors and just control the issue silently you can always use before_save to change the value to false if needed. Something like: code def before_save self.my_boolean_column = false unless self.my_boolean_column == true end /code You should check against the value true (meaning that you shouldn't leave the equality comparison out) because otherwise you could run into problems if the value is ever something other than true/false/ null. A simple empty string would return true on the condition otherwise as this example shows: # This works in all cases a = true = true puts 'true' if a == true true = nil puts 'true' if a true = nil # This works only when comparing against 'true' a = '' = puts 'true' if a == true = nil puts 'true' if a true # Notice how this would make the code above work incorrectly on the before_save = nil On Nov 18, 3:59 pm, David Cross dcrosst...@gmail.com wrote: I have a boolean column that I would like to modify with a select helper element, and have :include_blank map to (database) null. This *almost* works. On the create/edit/update page, if you select true/yes it sets the column to true, if you select No/false it sets it to false, and if you set it to blank, it sets it to (database) null. fantastic. Now you edit the record. If it is True in the database the select box picks the correct value. If it was set to 'no' or (database)null however the selection is set to the blank value. This is especially problematic if you edit any other field on the form, as it resets *everything* back to 'null', regardless of if it was false or null to beginwith. I have constructed a trivial test application to demonstrate this: http://www.cs.rpi.edu/~crossd/selecttest.tar.bz2 Fire it up in 'rails server' and go tohttp://127.0.0.1:3000/testings (I've included a sqlite3 db there with 2 rows in it). edit one, set it to 'Yes', check the 'show' page, edit it again, set it to 'No', check the 'show' page, edit it again, set it to blank (you won't have to, its already there), and save it and check the show page. notice all 3 edits work correctly, but the initial value is NOT set correctly for for the 'False' case. Is this a bug? am I doing something wrong? -- David E. Cross -- 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-t...@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: select helper with boolean and null/nil values
[...]It's perfectly OK to have Boolean columns (or any columns) be null-capable if the semantics of the data dictate that. Sure. However, in my experience most people make boolean columns null capable just because or because it's the default behavior of the DB when defining columns and after a while problems arise because the returned value is expected to be either true or false, not null: It is a boolean column, right? Why doesn't it return true or false? Why do I have to worry about the value being null?. IMHO boolean columns are just a little different because of their very nature. Sure, they can be set to be null but I really don't see the advantage in it. In my experience, if I set the column to default to either true or false (probably false all the time) and change it as needed things work much better and things get easier. -- 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-t...@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: select helper with boolean and null/nil values
IMHO boolean columns are just a little different because of their very nature. I don't see the difference. Where do you see it? Sure, they can be set to be null but I really don't see the advantage in it. I've run across cases where something was best modeled by SQL-style 3-valued logic (for example, yes/no/maybe sorts of things). Why *wouldn't* I use a nullable boolean field for that? Certainly not very 'academic' but from Wikipedia's page http://en.wikipedia.org/wiki/Boolean_data_type: In computer science, the Boolean or logical data type is the most primitive data type, having one of two values (true or false), intended to represent the truth values of logic and Boolean algebra. Why do I think boolean columns are a little different? You could interpret that null is 'similar' to false because it is not true, but that could also be the case the other way around. If you look a the issue from the perspective of well, a boolean column is just a column, yes, I agree, there is no difference. However if you look at boolean columns from the perspective of their most likely reason to exist they are different because they imply that they will always contain a value, either true or false and null is neither. That is different IMO than, for example, a date column, which could very possibly be conceived to contain either a date or no date at all. Could a boolean column be conceived to be null? Certainly, but again, not the most likely case in my experience. Although an interesting proposition I don't think I would ever use a boolean column to store true/false/maybe sort of things. Of course, the column could be created to allow it but that, IMO, would defeat the purpose of the boolean column. I would rather use a different type because, as it happened to me in the past, a 'true/false/maybe' sort of scenario can quickly become a 'true/false/maybe/likely/not that likely/very likely' sort of scenario and then I would need to change my DB and code. -- 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-t...@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: select helper with boolean and null/nil values
Why do I think boolean columns are a little different? You could interpret that null is 'similar' to false because it is not true, But I'm not. I think SQL has it right: null is neither false nor true. Out of context. I never said it was and 'you' meant 'anybody'. Sorry if it was misleading. Don't take things so personally. But that's not even true if we ignore the true 3-valued yes/no/maybe case. The intent of SQL null is to represent *unknown* data. Imagine storing data about your friends, including whether they own a car. You might have a 'has_car' column, which would of course be boolean. Now, you may not know (because you haven't asked) whether some of your friends own a car or not. That is the first thing I ask my friends. Don't you? ;) So what to put in has_car? You can't put true. You can't put false. Guess what, you put null! I'd put I didn't ask but that wouldn't fit in the boolean column... ;) Very true, though. That is different IMO than, for example, a date column, which could very possibly be conceived to contain either a date or no date at all. Could a boolean column be conceived to be null? Yes, absolutely. See above. You have certain ability to repeat yourself. Certainly, but again, not the most likely case in my experience. But common enough. Don't pretend it doesn't happen. Not pretending. Although an interesting proposition I don't think I would ever use a boolean column to store true/false/maybe sort of things. Why not? Fragmented. Because of the explanation I gave. Did you read the whole paragraph? (see below). Of course, the column could be created to allow it but that, IMO, would defeat the purpose of the boolean column. No. SQL booleans are three-valued. It makes sense to use that property. I agree with you in the case of *unkown* data. (From above: you see? this next paragraph explains why. I knew I had written it somewhere!) I would rather use a different type because, as it happened to me in the past, a 'true/false/maybe' sort of scenario can quickly become a 'true/false/maybe/likely/not that likely/very likely' sort of scenario and then I would need to change my DB and code. Then change it *at that time*. Sure, and spend who knows how much time changing DB and code if that happens. You can't know what will happen in the future, and therefore you can't really design for it. Remember YAGNI. Don't overdesign. Don't anticipate if anticipation does not give you a present benefit. YAGNI is a very good principle to follow and I certainly try to adhere to it as much as possible, however it's not the only thing to take into consideration. There is something else I try to use as much as possible, it's called personal experience. There have been times when because of adhering to YAGNI I had to go back and rework A LOT of code. Now I prefer 'overdesigning' a little bit if I see that there is a possibility that not doing so might come back to bite me, even if the only present benefit I get is to have peace of mind and know that I won't get bitten by it. I'd rather spend 30 or 60 extra minutes giving a universal solution to a problem or generating related additional functionality that I might see a use for (but not needed right now) than having to go back and spend days reworking something because of those 'saved' 30 or 60 minutes. -- 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-t...@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.