[Rails] Cucumber/RSpec ::: Capybara? Webrat What am I using??
Hey everybody I'm currently reading through the Pragmatic Programmers RSpec book, and I really enjoy it. But I’m facing some problems because of the fact that the book is already some years old, I guess. I have installed rvm and use Ruby 1.9.3, and I didn’t really get some Rails code examples to work properly, so I tried it with a 1.8.7 installation, but there I had some other problems which I couldn’t solve. So I re-did the code example myself (it’s the simulated_browser example) on Ruby 1.9.3, and it’s working quite nice but I had some other strange behavior now. In fact, I had an error message that the contain() was not found. After some searching on Google (and having seen the term capybara before somewhere in my error messages), somebody pointed out that when using capybara, contain() would not exist, but have_content(). So I tried it with have_content(), and it worked! I’m a bit confused now – what exactly am I using? Capybara or Webrat?? I thought I use Webrat, and Capybara is never mentioned in the RSpec book. So why/where did Capybara sneak in?? Was Webrat maybe replaced in the never Rails version I’m using? Some information about my Rails app… $ ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin11.4.0] $ gem list LOCAL GEMS * abstract (1.0.0) actionmailer (3.2.5, 3.2.1, 3.0.0) actionpack (3.2.5, 3.2.1, 3.0.0) activemodel (3.2.5, 3.2.1, 3.0.0) activerecord (3.2.5, 3.2.1, 3.0.0) activeresource (3.2.5, 3.2.1, 3.0.0) activesupport (3.2.5, 3.2.1, 3.0.0) addressable (2.2.8) ancestry (1.2.5) archive-tar-minitar (0.5.2) arel (3.0.2, 1.0.1) bcrypt-ruby (3.0.1) bson (1.5.2) bson_ext (1.5.2) builder (3.0.0, 2.1.2) bundler (1.1.4, 1.0.0) capistrano (2.12.0) capybara (1.1.2) carrierwave (0.6.2) carrierwave-mongoid (0.2.0) childprocess (0.3.2) chronic (0.6.7) chunky_png (1.2.5) cleditor_rails (0.0.3) coffee-rails (3.2.2) coffee-script (2.2.0) coffee-script-source (1.3.3, 1.2.0) columnize (0.3.6) compass (0.12.rc.1) compass-rails (1.0.0.rc.3) cucumber (1.2.1) cucumber-rails (1.3.0, 0.3.2) daemons (1.1.8) database_cleaner (0.8.0) delayed_job (3.0.3) delayed_job_active_record (0.3.2) devise (2.0.4) diff-lcs (1.1.3) enum_column3 (0.1.4) erubis (2.7.0, 2.6.6) execjs (1.4.0, 1.3.0) ffi (1.0.11) formtastic (2.1.1) fssm (0.2.8.1) gherkin (2.11.0) god (0.12.1) haml (3.1.4) haml-rails (0.3.4) highline (1.6.12) hike (1.2.1) hpricot (0.8.6) i18n (0.6.0, 0.4.2) journey (1.0.3) jquery-rails (2.0.2, 2.0.1) jquery-ui-rails (0.2.2) json (1.7.3, 1.6.5) kaminari (0.13.0) launchy (2.1.0) libwebsocket (0.1.3) mail (2.4.4, 2.4.1, 2.2.19) mime-types (1.18, 1.17.2) mongo (1.5.2) mongoid (2.4.0) multi_json (1.3.6, 1.3.5) mysql2 (0.3.11) net-scp (1.0.4) net-sftp (2.0.5) net-ssh (2.5.2) net-ssh-gateway (1.1.0) nokogiri (1.5.4) orm_adapter (0.0.6) polyglot (0.3.3) rack (1.4.1, 1.2.5) rack-cache (1.2, 1.1) rack-mount (0.6.14) rack-ssl (1.3.2) rack-test (0.6.1, 0.5.7) rails (3.2.5, 3.2.1, 3.0.0) rails3-jquery-autocomplete (1.0.7) railties (3.2.5, 3.2.1, 3.0.0) rake (0.9.2.2) rdoc (3.12) rspec (2.10.0, 2.0.0) rspec-core (2.10.1, 2.0.0) rspec-expectations (2.10.0, 2.0.0) rspec-mocks (2.10.1, 2.0.0) rspec-rails (2.10.1, 2.0.0) ruby-debug-base19 (0.11.25) ruby-debug-base19x (0.11.30.pre10) ruby-debug19 (0.11.6) ruby_core_source (0.1.5) ruby_parser (2.3.1) rubygems-bundler (1.0.2) rubyzip (0.9.8, 0.9.7) rvm (1.11.3.3) rvm-capistrano (1.2.2) sass (3.1.19, 3.1.15) sass-rails (3.2.5, 3.2.4) selenium-webdriver (2.22.2) sexp_processor (3.0.10) sprockets (2.1.3, 2.1.2) sqlite3 (1.3.6) sqlite3-ruby (1.3.3) syntax (1.0.0) thor (0.15.2, 0.14.6) tilt (1.3.3) treetop (1.4.10) tzinfo (0.3.33) uglifier (1.2.4, 1.2.3) vpim (0.695) warden (1.1.1) webrat (0.7.3, 0.7.2) whenever (0.7.3) xpath (0.1.4) Thanks a lot for help about this. Josh -- 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: Open Source Project Suggestion
The 13/06/12, Mohit Sindhwani wrote: On 13/6/2012 8:01 PM, Sam Serpoosh wrote: Hello everyone, I'm looking for a rails open source project which is using newer versions of rails and is a good place for reading other people's code for learning more and more ways and techniques of developing rails projects, etc. and maybe they accept participation too. How about Redmine? www.redmine.org I'm not sure about Redmine. AFAIK, it was optimised for Rails 2 and had somewhat poor performance in rails 3 (at the beginning of the migration, at least). -- Nicolas Sebrecht -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Opening a file having white spaces on is name with the default program
On 13 June 2012 09:05, Paulo Carvalho li...@ruby-forum.com wrote: Hello, Please don't top post, it makes it difficult to follow the thread. Insert your reply inline in previous post. Thanks Thanks for your answer. I have made a put of the command f1 = d:/sat - Copy.png f1 = f1.gsub( , \ ) cmd = 'cmd /c start ' + f1 + '' puts CMD: + cmd system (cmd) and the result is the following one: cmd /c start d:/sat - Copy.png Exactly what command are you trying to execute? Colin In attachment, I've putted a picture with the error. Thanks Regards Colin Law wrote in post #1064223: On 12 June 2012 14:49, Paulo Carvalho li...@ruby-forum.com wrote: I've tried several ways to do it but, until now, I was not able to cmd = cmd /c start ' + f1 + ' system (cmd) But no one of these solutions has worked. Have you tried inserting puts cmd then copying and pasting the output into the terminal to see if that works? Colin Attachments: http://www.ruby-forum.com/attachment/7487/err.png -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Ror code please just help me in findng solution
Hey muruga i am rejected from fameexpress man see i really had respect for your organisation being a fresher i thought this is the organisation i tried everything possible with at the certain point i took help of few people i except man but what you do donkey's do there same neenu ade madod bevarshi asshole's will anyone give live project to fresher you fool them one day they try day and nigth you people easily say we r not hiring you thats the other point we have other organisation to work and we could build our own organisation do you know how hard i tried and it's finally implementing a project and posting at forums is not cheating man beacause this purpose forums are opened stupid's i will give a job for a fresher if he has little knowledge thats what didnt i give you entire thing manually if i can be done automatically using mechanize gem i was trying here withoput money how much to work for one and there is no guarantee of getting job Katte mattu,hesarakatte let me see man http://www.indianrail.gov.in/ fetch this page within an hour and links and submit from you read this let me see man then github not upload anything thats correct ya it will be like cheating an organisation but what about you cheating others asshole by the way how many people you gave this question there are certain situation leading me to get a job and work for few years anyway assholes bye take care man muruga looser. -- 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: Re: Ror code please just help me in findng solution
Muruga wrote in post #1061096: Hi Prajwal Dont behave silly .You are not really professional guy.You behave like illiterate.Even they also behave decently than you.. Do you know who am i .I am the person conducting interview for you. First be discipline then knowledge will come automatically. Good Bye..man... On Wed, May 16, 2012 at 8:50 PM, Frederick Cheung Hey muruga i am rejected from fameexpress man see i really had respect for your organisation being a fresher i thought this is the organisation i tried everything possible with at the certain point i took help of few people i except man but what you do donkey's do there same neenu ade madod bevarshi asshole's will anyone give live project to fresher you fool them one day they try day and nigth you people easily say we r not hiring you thats the other point we have other organisation to work and we could build our own organisation do you know how hard i tried and it's finally implementing a project and posting at forums is not cheating man beacause this purpose forums are opened stupid's i will give a job for a fresher if he has little knowledge thats what didnt i give you entire thing manually if i can be done automatically using mechanize gem i was trying here withoput money how much to work for one and there is no guarantee of getting job Katte mattu,hesarakatte let me see man http://www.indianrail.gov.in/ fetch this page within an hour and links and submit from you read this let me see man then github not upload anything thats correct ya it will be like cheating an organisation but what about you cheating others asshole by the way how many people you gave this question there are certain situation leading me to get a job and work for few years anyway assholes bye take care man muruga looser. -- 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] What is the difference between Soap API and REST API?
Regards, Seeni Rafiyullah Khan A, * * -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] What is the difference between Soap API and REST API?
Given that this is a generic question and has nothing to do with Ruby or Rails perhaps you should TRY GOOGLING FOR IT! Guess what the first result is :) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] What is the difference between Soap API and REST API?
@Peter Hickman +1 :D regards, Loganathan ViewMe http://vizualize.me/loganathan On Thu, Jun 14, 2012 at 4:05 PM, Peter Hickman peterhickman...@googlemail.com wrote: Given that this is a generic question and has nothing to do with Ruby or Rails perhaps you should TRY GOOGLING FOR IT! Guess what the first result is :) -- 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.
Re: [Rails] What is the difference between Soap API and REST API?
Thanks Peter. I have already tried got the same response what you said. Just curious to know if any!. Perhaps Ruby geeks know something that is hidden under the cave :). Regards, Seeni Rafiyullah Khan A, On Thu, Jun 14, 2012 at 4:05 PM, Peter Hickman peterhickman...@googlemail.com wrote: Given that this is a generic question and has nothing to do with Ruby or Rails perhaps you should TRY GOOGLING FOR IT! Guess what the first result is :) -- 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] Can't find my join table
Hey there, I was following up on some tutorials about has_many(_and_belongs_to). There it was explain that i should make a join table as such: create_table 'cards_users', :id = false do |t| t.column 'card_id', :integer t.column 'user_id', :integer end So i did, but now i wanna add a record via my rails console (@a = Cards_users.create :card_id = 1, :user_id = 1) but it keeps telling me, whatever i try with the capitals etc., that Cards_users(and all other options) is an undefined method. What do i do?:( Thanks in advance -- 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] Can't find my join table
Close. Try @a = CardUser.new Then @a.card_id = value @a.user_id = value -- 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/-/t6Dns-JQr9oJ. 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: user registration form example?
is there a way to encrypt the password value being stored in development.sqlite3? so far when I open it I can see the values as plain text -- 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: Can't find my join table
Thanks alot, in that case i'd like to ask the following question (since after some tutorials it's still unclear to me) I've got card_id = 1 and user_id = 1 in my DB now. In my user.rb i've got the has_and_belongs_to_many:cards and in cards i've got has_and_belongs_to_many:users. However, if i get all cards (@cards = Cards.all) and loop through them i don't have a user_id in my loop. So what i'm actually trying to ask is, how do i get all cards that belong to user 1? -- 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: 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] Strange regression in 3.0.14
I updated an application from 3.0.10 to 3.0.14, and now I'm getting an error of NoMethodError (undefined method `collect' for #Mysql::Result:0x9b89bc0): app/models/attachment.rb:20:in `set_uid' app/controllers/attachments_controller.rb:24:in `create' It's being triggered by the call to Attachment.find_by_uid in this method, which is called in a before_create callback in attachment.rb: def set_uid code = Array.new(7) { (('A'..'Z').to_a + (0..9).to_a)[rand(36)] }.join.to_s if Attachment.find_by_uid(code) return self.set_uid() else self.uid = code end end This works perfectly in 3.0.10, and fails in 3.0.14. One other wrinkle, this is using the mysql (not mysql2) adapter, as I can't get mysql2 to build on my Joyent SmartOS server. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: user registration form example?
On 14 June 2012 13:20, RR TT li...@ruby-forum.com wrote: is there a way to encrypt the password value being stored in development.sqlite3? so far when I open it I can see the values as plain text I think the tutorial at railstutorial.org will show you how to do that. Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to use a text_field for dates?
Hello, I need to accept dates in a form using a text_field and not a date_select. Why? Well, because for users it's faster to type a date. But if I enter a simple date like 13/05/2012 (dd/mm/ format), when I want to edit this register, in the text_field appears 2012-05-13. How can I change this behavior, so in the text_field appears 13/05/2012? Thank you! -- 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] Great Ruby on Rails project; looking for resources
Our client - a rapidly growing, well-funded financial services company based in Manhattan that facilitates the creation and servicing of loans between students and credit unions nationwide - is looking for 2 experienced Ruby on Rails developers, for a consulting project. Only candidates that can work onsite, please... Our client's systems are written in Ruby on Rails and thus they have a need for experienced Ruby on Rails developers. They have one of the biggest and most complex financial applications written in Ruby; are you up to the challenge? Preference will be given to those candidates who have experience with transaction-based systems such as e-commerce or trading. Candidate should have a minimum of 3 years with Ruby on Rails and several years of software development experience overall. Their application is probably one of the most complexly designed applications around (100 models). The hiring manager is looking for someone that is very well-versed with Ruby coding. Work includes many enhancements, some remediation, addressing performance issues and migratin some code (some legacy apps are on Ruby 2, which will need to be migrated to Ruby 3, like some others already are). They practice agile techniques from Scrum and Kanban, including TDD, standups, code review, story cards, etc. Candidate should be comfortable with rspec and/or cucumber. Additionally candidates should be proficient with MySQL, git, rake, and related tools. As senior software engineer, you will also be responsible for helping to mentor others on advanced Ruby programming techniques, designing solutions to complex problems, and digging into an existing codebase to derive understanding and intent of various application features. The senior software engineer is also expected to be an advocate of Ruby best practices, continuously expanding and sharing knowledge. All developers are given nice equipment (Apple computers and large screens). Candidates are required to work on-site, which maximizes communication and collaboration. Candidates should be strong team players with solid communication skills and an ability to write code that is easily understood by others. If you are not available, but have friends that would be interested, Talon has an exceptional referral program. Please contact me for details! Best, Aurelio e: asi...@talonpro.com w: talonpro.com -- 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] need a file upload plugin and a way to authenticate from another app
Hey all, i need to be able to create a mobile application that will upload a file to my rails site. i need the application to authenticate and then upload. I am using the basic roll-your-own authenticate system with a sessions and users controllers. Any ideas where best to find a tutorial or gem that can help explain how to get started with something like this? thanks -- 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/-/kTNKhw8b0D0J. 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] Reading a file using File.read
Hi, File.read(VALID_PATH_TO_FILE) works on ruby console but not as a rails application. I dont understand why it fails saying No such file or directory. Even File.exist? returns false from rails application output but returns true from rails console. It has readable permissions for the current user , so that's not an issue. What might be the cause of this problem? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Reading a file using File.read
Are you using a relative path? You might just be in a different working directory in your Rails app. -- 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: Reading a file using File.read
Im using absolute path. Actually i mounted a directory from remote server anddo a find for a specific file and then try reading it. The cmd find passes and returns a valid path to the file. But only the read cmd fails. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Can't find my join table
On 14 June 2012 13:23, Timen E. li...@ruby-forum.com wrote: Thanks alot, in that case i'd like to ask the following question (since after some tutorials it's still unclear to me) I've got card_id = 1 and user_id = 1 in my DB now. In my user.rb i've got the has_and_belongs_to_many:cards and in cards i've got has_and_belongs_to_many:users. However, if i get all cards (@cards = Cards.all) and loop through them i don't have a user_id in my loop. So what i'm actually trying to ask is, how do i get all cards that belong to user 1? If you have a User in @user then all his cards are available as @user.cards I think it would be worth your while working through good tutorial such as railstutorial.org which is free to use online. Then you will learn the fundamentals of Rails. Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Reading a file using File.read
I think i understood the problem -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Weird (?) ActiveSupport::TimeZone parse behaviour
Hi I must be slipping, but say I have a string that looks like: 3/11/2012 2:50:00 AM If I use the UTC timezone and ask it to parse this time, what would you expect the result to be? Personally, I'd say 3/11/2012 2:50:00 AM UTC Given this is the DST switchover date (for some places) this is an edge case. It's the spring forward rule so 2:50 AM is 3:50... But not in UTC... that's one of the nice things about UTC. So, I was surprised when: ActiveSupport::TimeZone[UTC].parse(3/11/2012 2:50:00 AM) = Sun, 11 Mar 2012 03:50:00 UTC +00:00 Ok, maybe the AM trips it up into thinking I'm not really UTC because I'm not using a 24 clock? Nope: ActiveSupport::TimeZone[UTC].parse(3/11/2012 2:50:00) = Sun, 11 Mar 2012 03:50:00 UTC +00:00 But, if I append UTC to the string it works as I expect: ActiveSupport::TimeZone[UTC].parse(3/11/2012 2:50:00 UTC) = Sun, 11 Mar 2012 02:50:00 UTC +00:00 ActiveSupport::TimeZone[UTC].parse(3/11/2012 2:50:00 AM UTC) = Sun, 11 Mar 2012 02:50:00 UTC +00:00 I looked at the documentation and parse for AR:TZ takes two parameters, the second being a now that: If upper components are missing from the string, they are supplied from #nowhttp://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html#method-i-now (http://api.rubyonrails.org/classes/ActiveSupport/TimeZone.html#method-i-parse) So, I tried passing in a UTC current time, but it also went back to 3:50: ActiveSupport::TimeZone[UTC].parse(3/11/2012 2:50:00, ActiveSupport::TimeZone[UTC].now) = Sun, 11 Mar 2012 03:50:00 UTC +00:00 For reference, I'm using: tzinfo 0.3.33 activesupport 3.2.6 Am I being stupid here? A cursory googling led to https://rails.lighthouseapp.com/projects/8994/tickets/2470-cannot-make-zoneparse-create-given-time-dst The wontfix is indicative, but maybe this should at least be a gotcha in the documentation? Again, apologies if I'm being dense and have missed something obvious. Thanks, Andrew -- 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/-/qP-2xEP7iWwJ. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] rake about Environment staging
good points rick, it lead me to the issue: my system-user groupmembership was wrong. i added for some other reasons my system user to the root and some other groups...that messed everythign up. using a new user, same rvmrc Gemfile works again as expected. thx On Mon, Jun 11, 2012 at 3:30 PM, Rick richard.t.ll...@gmail.com wrote: I'm not really too up on rvm but I wonder... Is it possible that your work environment, specifically the login shell that you are using to type commands in a terminal window, includes an alias for rake? Since staging is not one of the three default environments for RoR it had to be created with all rules for it's use somewhere outside the vanilla system. What I'm thinking is that somewhere you have a runtime command file (eg.: .bashrc, .cshrc, .profile, ...) that contains a line: *alias rake='rake RAILS_ENV=staging'* To find out if this is so, type: *alias rake* Rick On Sunday, June 10, 2012 7:19:30 AM UTC-4, der_tom wrote: inline On Sun, Jun 10, 2012 at 12:30 PM, Colin Law clan...@googlemail.comwrote: On 10 June 2012 11:19, tom tomabr...@gmail.com wrote: Top posting still :( yes, thats correct RAILS_ENV=development rake db:migrate runs in staging env. I don't understand why you then went on to ask where does rake get the environment info if i ommit 'RAILS_ENV' when executing a rake command? Two points (please reply inline so that it makes it easier to follow the thread. Thanks 1. How do you know that rake db:migrate is running in staging environment? because the migrations are being executed on the staging-db (eg adding a new colum) 2. Please post database.yml here. database.yml is pretty much standard: staging: adapter: mysql2 encoding: utf8 reconnect: false database: myproject_staging pool: 5 username: myproject_dbuser password: myproject_dbuser socket: /var/run/mysqld/mysqld.sock development: adapter: mysql2 encoding: utf8 reconnect: false database: myproject_development pool: 5 username: myproject_dbuser password: myproject_dbuser socket: /var/run/mysqld/mysqld.sock test: adapter: mysql2 encoding: utf8 reconnect: false database: myproject_test pool: 5 username: myproject_dbuser password: myproject_dbuser socket: /var/run/mysqld/mysqld.sock production: adapter: mysql2 encoding: utf8 reconnect: false database: myproject_production pool: 5 username: myproject_dbuser password: myproject_dbuser socket: /var/run/mysqld/mysqld.sock as i said, starting webrick works fine in different environments, whereas rake tasks always use staging, no matter what specify. here a sample of a migration: rails g migration add name_to_testbooks name:string /home/tom/.rvm/gems/ruby-1.9.**3-p194@mygemset/gems/railties-** 3.2.1/lib/rails/script_rails_**loader.rb:11: warning: Insecure world writable dir /home/tom in PATH, mode 040777 /home/tom/.rvm/gems/ruby-1.9.**3-p194@global/gems/bundler-1.** 1.4/lib/bundler/runtime.rb:**211: warning: Insecure world writable dir /home/tom in PATH, mode 040777 invoke active_record createdb/migrate/20120610111033_**add.rb tom@debian6ror3:~/rails3/**myproject$ RAILS_ENV=development rake db:migrate --trace /home/tom/.rvm/gems/ruby-1.9.**3-p194@global/gems/bundler-1.** 1.4/lib/bundler/runtime.rb:**211: warning: Insecure world writable dir /home/tom in PATH, mode 040777 ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment ** Invoke db:load_config (first_time) ** Invoke rails_env (first_time) ** Execute rails_env ** Execute db:load_config ** Execute db:migrate == Add: migrating ==** == -- add_column(:testbooks, :name, :string) - 0.3212s == Add: migrated (0.3216s) ==** = ** Invoke db:_dump (first_time) ** Execute db:_dump ** Invoke db:schema:dump (first_time) ** Invoke environment ** Invoke db:load_config ** Execute db:schema:dump furthermore, removing staging from the database.yml results in rake telling me that it doesnt find a staging adapter - even though when i run in ''dev mode @rvm i installed a user-rvm, straight from the docs. does that interfere? @ill setup a new user and rvm again, then reusing the GEMFILE/rvmrc Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.**comrubyonrails-talk@googlegroups.com . To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@**googlegroups.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/** group/rubyonrails-talk?hl=enhttp://groups.google.com/group/rubyonrails-talk?hl=en . -- You received this message
[Rails] Re: How to log session variables in Rails 3.2?
Hey, I know this is a few months old, but I ran into the same issue and have a (pretty hacky) solution. I put this into my `config/application.rb` in order to have access to the session in my log_tags: config.middleware.delete(ActionDispatch::Cookies) config.middleware.delete(ActionDispatch::Session::CookieStore) config.middleware.insert_before(Rails::Rack::Logger, ActionDispatch::Session::CookieStore) config.middleware.insert_before(ActionDispatch::Session::CookieStore, ActionDispatch::Cookies) # Now this works: config.log_tags = [:uuid, proc { |request| request.session[:user_name] || 'Anonymous' }] Hope this helps somebody else down the track. Cheers, Bo On Friday, May 11, 2012 10:42:01 AM UTC-5, Chirag wrote: Rails 3.2 introduced tagged logging, is it possible to log session variables like session[:user_id] using that? Tried adding that using a lambda, but session is not decrypted when the logger middleware is called. Is there any other way to get the session variables logged against each line that is added in the log file? Thanks Chirag -- 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/-/pg8yhkEZTzsJ. 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] newbie question: where to find documentation?
Hello, I am very new to Ruby on Rails and am currently working my way through the Depot tutorial in the *Agile Web Development with Rails* book. I like to have as much info available as possible when I am learning something new and had a question about where to find documentation. In my specific case I was trying to find more info on the assert and assert_equal functions and tried looking on both http://api.rubyonrails.org/ and http://www.ruby-doc.org/core-1.9.3/ with no luck. Is there some other place I should be looking for reference information? Thank you! -- 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/-/XUQJrvADU3oJ. 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: I can't install ruby on rails on my mac - Sorry I know it's been posted 1 million times before
Download and install this goodie https://github.com/kennethreitz/osx-gcc-installer Cheers, Tan On Wednesday, June 13, 2012 8:33:10 PM UTC+10, blakeh92 wrote: Hi guys I have a macbook pro version 10.7.4. I'm so keen to start using the ruby programming language and the ruby on rails framework, but I cannot download the damn thing ! It's literally driving me crazy.. I get up to the readline stage and it reads the following: checking whether make sets $(MAKE)... no checking for gcc... no checking for cc... no checking for cc... no checking for cl... no configure: error: no acceptable C compiler found in $PATH Also I have xcode downloaded and everything else that is required :S This is the guide i've been following: http://hivelogic.com/articles/ruby_rails_lighttpd_mysql_tiger/ Please HELP !!! Thanks in advance -- 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/-/YxD200BKUQoJ. 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: I can't install ruby on rails on my mac - Sorry I know it's been posted 1 million times before
i didn't try that, but http://railsinstaller.org/ has a one click installer. hope it helps On Wednesday, June 13, 2012 12:33:10 PM UTC+2, blakeh92 wrote: Hi guys I have a macbook pro version 10.7.4. I'm so keen to start using the ruby programming language and the ruby on rails framework, but I cannot download the damn thing ! It's literally driving me crazy.. I get up to the readline stage and it reads the following: checking whether make sets $(MAKE)... no checking for gcc... no checking for cc... no checking for cc... no checking for cl... no configure: error: no acceptable C compiler found in $PATH Also I have xcode downloaded and everything else that is required :S This is the guide i've been following: http://hivelogic.com/articles/ruby_rails_lighttpd_mysql_tiger/ Please HELP !!! Thanks in advance -- 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/-/pge7fcfvkcgJ. 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] return JSON in AJAX
hello guys, I'm trying to make a ajax request and return some data from my controller, but how I do it to call the JSON in my JS after the request ? controller task def create @task = Task.create( :project_id = params[ :project_id ], :name = params[ :task ] ) if @task.valid? @return = { :task = @task.name, :project_id = @task.project_id } else @return = { :error = Ocorreu um erro inesperado. Tente novamente. } end return ActiveSupport::JSON.encode( @return ) end view index - JS $( #tasks_form ).submit( function( e ) { e.preventDefault(); var task = $( this).find( textarea ).val(); $.post( %= url_for :controller = :task, :action = :create %, { task: task, project_id: %= @project_id % }, function( e ) { }, json); } ); Thank you -- 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] how to setup nulldb
Hello everyone, can you tell me how can I setup nulldb in a rails app so I'll be able to have fast sepcs. I read through the nulldb github page and went through the installation and setup steps but I'm getting some errors. I searched a lot but I didn't find any useful thing for solving the problem. here's a question about it which I posted in StackOverflow - http://stackoverflow.com/questions/10868408/how-to-set-up-nulldb-in-rails-with-rspec also I created a gist for the complete error message and also the related files which can be found here - https://gist.github.com/2869276 I really appreciate your help on this. Thanks in advance for your help. Best Regards -- Sam Serpoosh Software Developer: http://masihjesus.wordpress.com Twitter @masihjesus -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] newbie question: where to find documentation?
http://bfts.rubyforge.org/minitest/ You are right to look in http://ruby-doc.org but minitest is actually a Standard Library rather than Core. http://ruby-doc.org/stdlib-1.9.3/ and then minitest... should get you the information you are looking for. On Wed, Jun 13, 2012 at 4:56 PM, m m...@freeshell.org wrote: In my specific case I was trying to find more info on the assert and assert_equal functions and tried looking on both http://api.rubyonrails.org/ and http://www.ruby-doc.org/core-1.9.3/ with no luck. Is there some other place I should be looking for reference information? 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.