Re: [Rails] Re: store pdf directly to amazon
I dont think it will helpful, below is my code, // in my model content = File.read "#{Rails.root}/app/to/mytemplate.html.erb" template = ERB.new(content) html_content = template.result(binding) pdf= WickedPdf.new.pdf_from_string(html_content) save_path = "#{Rails.root}/public/test_pdf.pdf" File.open(save_path, 'wb') do |file| file << pdf end @photo = Photo.new @photo.avatar = File.open("#{Rails.root}/public/message#{@message.id }.pdf") @photo.save The above code will generate pdf and store file locally then only i am uploading into s3 server. But i need to store s3 without store into local. Is that possible? Saravanan.P On Sat, Jan 26, 2013 at 1:22 PM, GT wrote: > Using Paperclip, you should be able to configure to store your pdfs onto > amazon s3. > > https://github.com/thoughtbot/paperclip > > Cheers, > GT > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to rubyonrails-talk+unsubscr...@googlegroups.com. > To post to this group, send email to rubyonrails-talk@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msg/rubyonrails-talk/-/Prrc-anHCUYJ. > > For more options, visit https://groups.google.com/groups/opt_out. > > > -- Regards by Saravanan.P -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: store pdf directly to amazon
Using Paperclip, you should be able to configure to store your pdfs onto amazon s3. https://github.com/thoughtbot/paperclip Cheers, GT -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/Prrc-anHCUYJ. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: JMeter Load testing
You need to extract the authenticity_token from the page each time it loads and add it to your form post. How to instructions are provided here: http://ertw.com/blog/2010/06/29/load-testing-a-rails-app-and-the-authenticity_token/ On Thursday, February 25, 2010 9:30:30 AM UTC-8, Ruby-Forum.com User wrote: > > I started playing with JMeter to load test a rails app. I have it > working for th most part but I am having a problem with > InvalidAuthenticityToken when posting forms. > > The problem is that JMeter is recording the InvalidAuthenticityToken > value to post when it runs the test. Of course its valid when recording > but when I play back the token is no longer valid. > > Anyone gotten around this? > > Any other free load testing tools (that have a record feature) that > might work better? > -- > 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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/fJHvS6X7HaMJ. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Best practice to handle this
On 01/26, Linus Pettersson wrote: > Hi! > > I have a model which has a field that can have three values only. I store > the value in the database as an integer, 0, 1 or 2, but when I display it I > want a more appropriate text. And, I want it to be translatable using i18n. > > Let's say that it corresponds to how difficult something is. So, 0 > represents "Easy", 1 represents "Normal" and 2 represents "Hard". > What I did was first to define it as a hash like this: > DIFFICULTIES = { "Easy" => 0, "Normal" => 1, "Hard" => 2 } > Then I can easily pass this to, for instance, simple_form and it will > generate a nice dropdown with the correct values. > > But let's say that I have the value and want to display the text. Then I'd > have to iterate over the hash to find which key corresponds to the right > value. Right? Not that big of an issue when there are three values as in > this example, but there could be more. I don't know of any best practice for this, but searching in a hash takes, on average, O(1); so I don't think there's anything to worry about here. Of course, if the hash gets big you might end up with maintainability issues, but that's another story. > > How do you normally handle these cases? Is there any "best practice" to > handle this in an efficient manner? > > Cheers, > Linus > > -- > 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/-/1fjJK_EjQ50J. > 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. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Railinstaller issues on mac: Step 5
I downloaded Railsinstaller @ http://railsinstaller.org/mac and am stuck on step 5. I downloaded sublime and have tried to create a ~/bin directory in my path by following some tutorials but not sure if that was successful and do not know how to check. Also, I am confused over the directions on step 5 because they have terminal commands (Seen below) but when I plug them into there, the files are not found. As you can see, I'm new to this so I appreciate the help! Thank you in advance. - You can now visit the folder of your rails application and open your new rails app with Sublime Text $ cd railsinstaller_demo $ subl . -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To post to this group, send email to rubyonrails-talk@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/1OpClMKiRkYJ. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] Best practice to handle this
On Sat, Jan 26, 2013 at 8:58 PM, Linus Pettersson < linus.petters...@gmail.com> wrote: > Hi! > > I have a model which has a field that can have three values only. I store > the value in the database as an integer, 0, 1 or 2, but when I display it I > want a more appropriate text. And, I want it to be translatable using i18n. > > Let's say that it corresponds to how difficult something is. So, 0 > represents "Easy", 1 represents "Normal" and 2 represents "Hard". > What I did was first to define it as a hash like this: > DIFFICULTIES = { "Easy" => 0, "Normal" => 1, "Hard" => 2 } > Then I can easily pass this to, for instance, simple_form and it will > generate a nice dropdown with the correct values. > > But let's say that I have the value and want to display the text. Then I'd > have to iterate over the hash to find which key corresponds to the right > value. Right? Not that big of an issue when there are three values as in > this example, but there could be more. > Use http://www.ruby-doc.org/core-1.9.3/Hash.html#method-i-key to get the key you want given a value. I'm thinking that you will only do this if you have a small number of constants that you want to define. If it is a long list, then use the database for that. > > How do you normally handle these cases? Is there any "best practice" to > handle this in an efficient manner? > > Cheers, > Linus > > -- > 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/-/1fjJK_EjQ50J. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- - visit my blog at http://jimlabs.heroku.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 https://groups.google.com/groups/opt_out.
[Rails] Best practice to handle this
Hi! I have a model which has a field that can have three values only. I store the value in the database as an integer, 0, 1 or 2, but when I display it I want a more appropriate text. And, I want it to be translatable using i18n. Let's say that it corresponds to how difficult something is. So, 0 represents "Easy", 1 represents "Normal" and 2 represents "Hard". What I did was first to define it as a hash like this: DIFFICULTIES = { "Easy" => 0, "Normal" => 1, "Hard" => 2 } Then I can easily pass this to, for instance, simple_form and it will generate a nice dropdown with the correct values. But let's say that I have the value and want to display the text. Then I'd have to iterate over the hash to find which key corresponds to the right value. Right? Not that big of an issue when there are three values as in this example, but there could be more. How do you normally handle these cases? Is there any "best practice" to handle this in an efficient manner? Cheers, Linus -- 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/-/1fjJK_EjQ50J. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: [ANN] Ruby Manor 4, London UK, 6th April 2013
fist I've heard of it again this year. What secret society do you need to belong to to get a ticket - lol > We'd love to see you there. *I'd love to be there!* In anticipation Tony On Tuesday, 22 January 2013 16:22:34 UTC, James Adam wrote: > > There's a good chance you've already seen this, but just in case not... > > Tickets for Ruby Manor 4 are now available, happening on the 6th of April > 2013 in London, UK. > > Full details and ticket info: http://rubymanor.org/4/ > > > > All the best, > > - James > -- 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/-/cHk58MeD5yUJ. For more options, visit https://groups.google.com/groups/opt_out.