[Rails] How can a gem (unintentionally) change the migrations path?
I wrote a Gem (https://github.com/absolutedevops/civo) which is a simple Rails Engine containing a few API accessing models. However, when I include it in a Rails project, any generators create their files under the Gem's source code not the project's. I can't see anything I'm doing in the Gem that would cause this. It's repeatable (it's happening in two projects at my company and I can reproduce it with a minimal set of steps below). Can anyone tell me how I've managed this? I've been a Rails user for many years but haven't ever come across this before, nor has a skim through the Rails code given me any indication of how I'd change the migrations path if I wanted to! Thanks, Andy Reproducible steps: $ rails -v Rails 4.2.6 $ rails new civo-test [...] Bundle complete! 12 Gemfile dependencies, 55 gems now installed. Use `bundle show [gemname]` to see where a bundled gem is installed. run bundle exec spring binstub --all * bin/rake: spring inserted * bin/rails: spring inserted $ cd civo-test $ echo 'gem "civo"' >> Gemfile $ bundle [...] Bundle complete! 13 Gemfile dependencies, 66 gems now installed. Use `bundle show [gemname]` to see where a bundled gem is installed. $ rails g migration a_new_migration_here Running via Spring preloader in process 75091 invoke active_record create db/migrate/20160411093346_a_new_migration_here.rb $ ls -l db/migrate/20160411093346_a_new_migration_here.rb ls: db/migrate/20160411093346_a_new_migration_here.rb: No such file or directory $ rails g migration a_new_migration_here Running via Spring preloader in process 75193 invoke active_record identical db/migrate/20160411093346_a_new_migration_here.rb $ ls -l /Users/andy/.rbenv/versions/2.3.0/lib/ruby/gems/2.3.0/gems/civo-0.3.21/db/migrate/ total 8 -rw-r--r-- 1 andy staff 73 11 Apr 10:33 20160411093346_a_new_migration_here.rb -- 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/msgid/rubyonrails-talk/etPan.570e472c.507a17c1.2be%40Andys-MacBook-Air. For more options, visit https://groups.google.com/d/optout.
[Rails] Re: Why can't inline template be rescued?
By default rescue only matches StandardError. If you are getting another type of Exception then your usage of rescue will not be sufficient to handle it. You will need to use the multiline form of begin/rescue. ``` begin ActionView::Template.new("Test <% if Crash %>", "inline template", handler, :locals => {}).render("Test2",{}) rescue Exception # You should replace Exception with a more specific class or classes if possible. false end On Sunday, October 18, 2015 at 4:17:24 PM UTC-5, kopf1988 wrote: > > I am attempting to debug some complicated inline templates, because they > are generated dynamically with the complicated way this program works. > > However when doing render inline: "Template here" rescue false, an error > is still thrown if there's an error in the Template. > > I tried this in IRB and it's very weird! > ActionView::Template.new("Test <% if Crash %>", "inline template", > handler, :locals => {}).render("Test2",{}) rescue false > > This returns an error, even though we would expect the Rescue to rescue us > from the bad code in the inline template. This worked in an old version of > Rails. > > Any ideas? > > Breaking out into multiple lines also didn't help > begin > ActionView::Template.new("Test <% if Crash %>", "inline template", > handler, :locals => {}).render("Test2",{}) > rescue > false > end > > Still has an error. > > =Ryan > -- 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/msgid/rubyonrails-talk/0c0b102c-cf84-4da6-89d0-326120893390%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Rails] Re: Endless scroll
Railscasts is now premium content. Perhaps you could provide a bit more context. http://railscasts.com/episodes/114-endless-page-revised?view=asciicast As a User Experience side note, please be sure that infinite scroll is appropriate. Depending on the goals of your user it can be a frustrating interface. If you are not tracking infinite scroll position then when a user is forced to refresh may loose their place (restoring state is important), and consider if a user might want to share a particular part of the list (state in the url). For general usability reading: http://www.nngroup.com/articles/infinite-scrolling/ On Monday, October 5, 2015 at 4:37:21 AM UTC-4, Hans wrote: > > I develop an application in rails 3.2 and ruby 1.9 > I am using endless scrolls as described in railcars 114. I works fine > except when I try to use it on a remote table with remote will paginate. > Then there is already an index.js file and I cannot find out how to use > endless scrolling this situation > Grateful for any ideas > -- 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/msgid/rubyonrails-talk/6f6719a5-72b0-4ca6-b357-04c31e6dddcf%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Rails] Can we create Kisok apps using ROR
As Norbert suggests this is a User Agent (browser) feature. Have a look at these configurations for linux/chrome and linux/firefox. http://askubuntu.com/questions/124759/customize-ubuntu-for-a-library-internet-kiosk On Tuesday, October 6, 2015 at 4:38:35 PM UTC-4, Norbert Melzer wrote: > > Kiosk mode is a feature of some UAs, just try to hit F11, works in FF and > Chrome at least. Exiting is via F11 also. > > But I don't see how it would be different to do this with rails instead of > php or plain HTML. it's a feature of the client, not the server. > > Colin Law > schrieb am Di., 06.10.2015, > 22:08: > >> On 6 October 2015 at 17:35, VIDYA SAGAR POGIRI >> > wrote: >> > Hi , need help from all of you guys on a question that Can we develop a >> > Kisok App using ROR. If yes can you provide me the details or link so >> that i >> > will go through. >> >> Showing my ignorance here, and google has not helped. What is a Kisok >> App? >> >> Colin >> >> -- >> 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-ta...@googlegroups.com . >> To post to this group, send email to rubyonra...@googlegroups.com >> . >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/rubyonrails-talk/CAL%3D0gLsHYt6D2uokt-ycyBa29e9ZGhdqGon6VNKmxdrXeSbvVA%40mail.gmail.com >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- 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/msgid/rubyonrails-talk/b0306a3f-2f08-4417-bca1-067b475602fa%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Rails] Why does Rails throw an autoloading constant exception when I use threads?
Oh wow, thanks, super interesting. So the issue is that the same file gets autoloaded twice... I see. Thanks so much man. Yeah will check out that article, really appreciate the answer. So as you said this *shouldn't* be an issue in production since as you said rails will eager load everything. Cool, great to know! -- 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/msgid/rubyonrails-talk/934c4535-e35b-4ba4-af39-44c79fa2e332%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [Rails] Why does Rails throw an autoloading constant exception when I use threads?
Hey Xavier, thanks so much! Really appreciate your answer! Could you maybe describe to me (or point me in the right direction) to how content autoloading happens? You know what it? I've kinda solved the issue by just referencing the constant explicitly. But I'm really curious as to how Rails ends up throwing that circular dependency exception. Like... I get what happens when you have a non-threadsafe variable... because actually setting a variable requires multiple steps in the MRI and so while one thread is reading from a variable before setting it, another thread has already set it to something. But what's going on here like... one thread tries to autoload a constant... and then before it's done another thread does the same and then... why does that result in a circular reference exception? Any ideas? On Wednesday, 4 February 2015 10:23:29 UTC, Xavier Noria wrote: > > On Wed, Feb 4, 2015 at 12:12 AM, Andy Rose > wrote: > > Hey guys, I posted this on Stackoverflow but it's not getting much love. >> >> Note in the question that I've found a solution to my problem. However >> I'm curious as to what is going on here. Why does Rails encounter a race >> condition when auto-loading an ActiveRecord model association...? >> >> >> http://stackoverflow.com/questions/28267513/why-does-rails-throw-an-autoloading-constant-exception-when-i-use-threads >> >> Feel free to answer on SO if you have an account, but here's cool too. >> > > Hey, I am not on SO. > > Constant autoloading is not thread-safe (it can't be). That's one of the > reasons by default Rails eager loads the application code in production > mode. > > There are a few things you can do. The easiest one is to enable eager > loading by setting config.eager_load = true (in modern versions of Rails). > Another possibility is to load the files with the involved classes using > require_dependency in your script before spawning threads. > > -- 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/msgid/rubyonrails-talk/1cacb44f-5c82-4e78-a834-1c9fb88b7998%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Rails] Why does Rails throw an autoloading constant exception when I use threads?
Hey guys, I posted this on Stackoverflow but it's not getting much love. Note in the question that I've found a solution to my problem. However I'm curious as to what is going on here. Why does Rails encounter a race condition when auto-loading an ActiveRecord model association...? http://stackoverflow.com/questions/28267513/why-does-rails-throw-an-autoloading-constant-exception-when-i-use-threads Feel free to answer on SO if you have an account, but here's cool too. Cheers! -- 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/msgid/rubyonrails-talk/7ea6a7ea-552f-482d-ac3e-c3da5833d13d%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Rails] Re: :to argument to match() -- how is it converted to class/method name
This is not really documented anywhere, and tracing through the source is difficult. Within Rails the string inflector methods #classify and #underscore are used to go between snake-case names and camel-cased class and module names. http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-underscore "MyFoo".underscore # => "my_foo" "MyApp::Foo".underscore # => "my_app/foo" http://api.rubyonrails.org/classes/ActiveSupport/Inflector.html#method-i-classify "my_foo".classify # => "MyFoo" "my_app/foo".classify # => "MyApp::Foo" On Monday, October 27, 2014 2:25:17 PM UTC-5, Brian Sammon wrote: > > Is there any documentation for how the match command converts the ":to" > argument to a class and method name? > > If I have >match '', to: '#', > via: :get > How does it go from to , and > more importantly, how do I go in the reverse direction? > > I can probably figure this out via trial-and-error, but I'd like to see > docs if there are some, or contribute some docs if not. > -- 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/msgid/rubyonrails-talk/b0a230aa-7b16-423a-bf3d-8dc2b0fe4a4e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
[Rails] Re: Authentication failed. when login heroku
It's an error on heroku side V:\>heroku status === Heroku Status Development: yellow Production: No known issues at this time. === Elevated rate of CLI/Toolbelt errors 2014/07/22 09:22:22 (~ 1h+) 2014/07/22 10:52:27 (~ 26m ago) investigating We are still investigating the T oolbelt errors. We will post another update in an hour, if not sooner. 2014/07/22 09:49:19 (~ 1h ago) investigating Our engineers are still investig ating the Toolbelt errors. We will provide more information as soon as possible. 2014/07/22 09:22:22 (~ 1h ago) investigating We are seeing an elevated rate o f errors from the Heroku Toolbelt. Our engineers are investigating. -- 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/msgid/rubyonrails-talk/efdb7925d560f2af8994ac3cde084bb8%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.
[Rails] Re: Authentication failed. when login heroku
Reinstalling the heroku toolbelt does'nt solve the problem. But installing on a new machine works! -- 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/msgid/rubyonrails-talk/526b1a4f065bb8407cab08c625e136ec%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.
[Rails] Re: Authentication failed. when login heroku
I have the same problem. But no solution yet. Any news from your side? -- 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/msgid/rubyonrails-talk/10a091ee1b89b7135068d170063ce5a8%40ruby-forum.com. For more options, visit https://groups.google.com/d/optout.
Re: [Rails] Difference between Cookies and Sessions
Cookies are stored key/value pairs (with other attributes such as expiry, domain, path and ssl requirements) in the client's browser. The specification for them is in the HTTP specification and these can (generally) be read by backend languages such as Rails or frontend technologies such as Javascript. Sessions are an unrestricted storage area for applications, generally used by the backend language only (due to encryption and hash protection with server side secrets), although they may be stored in their entirety in a client-side cookie for convenience to avoid "sticky sessions" where requests have to come back to the same backend server. Hope this helps. Cheers, Andy *Andy Jeffries* Ruby on Rails, RubyMotion, jQuery Developer & Taekwondo 6th Dan Instructor andyjeffries.co.uk +44 7939 164853 @andyjeffries <http://twitter.com/andyjeffries> fb.com/andyjeffries <http://facebook.com/andyjeffries> On 7 July 2014 10:21, Praveen BK wrote: > Hello, > > Can anybody please define cookies and sessions and their > differences in detail with reference to rails. > > > Thank you, > Praveen > > -- > 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/msgid/rubyonrails-talk/6c917df7bf555a6e49a8fbfb68cd6144%40ruby-forum.com > . > For more options, visit https://groups.google.com/d/optout. > -- 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/msgid/rubyonrails-talk/CANRNWfgM%3DN4eEuPKW7NN4DGHNL3O%3D9%2BNcHZgWTWvm0dFEW%2Bbdg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Rails] Application trace in the error page for a Rails engine
Yes, Engines are considered part of the framework level rather than the application level. If I developed an engine and released it as a gem, you wouldn't want my lines littering your application stack trace, right? Cheers, Andy *Andy Jeffries* Ruby on Rails, RubyMotion, jQuery Developer & Taekwondo 6th Dan Instructor andyjeffries.co.uk +44 7939 164853 @andyjeffries <http://twitter.com/andyjeffries> fb.com/andyjeffries <http://facebook.com/andyjeffries> On 7 July 2014 12:04, David Morales wrote: > I'm developing a Rails engine, and when debugging an error through the > default Rails error page, I find that the Application trace shows nothing, > while Framework trace and Full trace show the trace. > > Is this intended for an engine? > > -- > 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/msgid/rubyonrails-talk/76da4720-e598-4550-9e56-9f832ceb6623%40googlegroups.com > <https://groups.google.com/d/msgid/rubyonrails-talk/76da4720-e598-4550-9e56-9f832ceb6623%40googlegroups.com?utm_medium=email&utm_source=footer> > . > For more options, visit https://groups.google.com/d/optout. > -- 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/msgid/rubyonrails-talk/CANRNWfi18KT2si%3D-5%2B8PP%2BM0WWb8NaugQAL%2BJ%3DkMBGvFESZstw%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Rails] What is your style? Single quote, double quotes or depends?
On 25 March 2014 15:24, Colin Law wrote: > My comment "Or, possibly, slower" was to point out that you had said > double quotes were 2% faster when I believe you meant slower. > > My consistency question was prompted by that fact that when there are > such small differences one has to be careful that one is seeing a real > effect, which apparently you were, so that is all right. > Doh, fair point, thanks for catching that :-) Cheers, Andy *Andy Jeffries* Ruby on Rails, RubyMotion, jQuery Developer & Taekwondo 6th Dan Instructor andyjeffries.co.uk +44 7939 164853 @andyjeffries<http://twitter.com/andyjeffries> fb.com/andyjeffries <http://facebook.com/andyjeffries> -- 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/msgid/rubyonrails-talk/CANRNWfh0NEN0MaNjQM5xVHi5%2B8ze1kvQE%2BW1HfNRzPKW%2BfLWcA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Rails] What is your style? Single quote, double quotes or depends?
On 17 March 2014 15:32, Colin Law wrote: > Did you try swapping the two lines round and checking that the result > is consistent? > Yes, it's consistent for me. Was it not for you or are you just asking? Cheers, Andy -- 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/msgid/rubyonrails-talk/CANRNWfi4kC4DQE2T9qhMBKMqrHUe0t%3D3rAxYYFLyH%3DSqDMAG5g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Rails] What is your style? Single quote, double quotes or depends?
According to a quick benchmark on my machine (MacBook Air 2013, Ruby 2.1.0p0), using double quotes is about 2% faster: require 'benchmark' n = 10_000_000 Benchmark.bm do |x| x.report { n.times do ; a = "1"; end } x.report { n.times do ; a = '1'; end } end user system totalreal 1.02 0.00 1.02 ( 1.015903) 0.99 0.00 0.99 ( 0.992175) However, as you can see it takes about 1 second to do 10 million iterations, so in reality, using a " instead of a ' adds on about 2 nanoseconds on a 99 nanosecond operation. There are much bigger inefficiencies in all of our code than worrying about saving the odd 2ns here and there... I personally tend to use double quotes everywhere, for the same reason that I never do if statements on multiple lines (in Javascript for example) without braces. I'd much rather have the almost unmeasurable wastage than risk a bug. Cheers, Andy -- 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/msgid/rubyonrails-talk/CANRNWfgF%3Dpht4dRE1od0y1g%2BHubjbKtfBDo9WiYz6yTeLB%2BV6A%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
[Rails] Announcing: ActiveRestClient
The company I'm currently contracting at has released their first piece of Open Source Software, a Ruby gem for interacting with REST servers. There are other gems out there but we wanted something that felt more like using ActiveRecord (like ActiveResource) but more customisable. http://whichdigital.github.io If anyone has any questions or runs in to any problems with it, let me know. It was mentioned on Ruby 5 this week, so grateful if anyone likes it and fancies tweeting/blogging about it... Cheers, Andy -- 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/msgid/rubyonrails-talk/CANRNWfhr_%2BY0%3Djtz%2BnFcQfi78KpGxxkQnvsgjRqqo6d63Uszzg%40mail.gmail.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Re: Capybara throws printer errors with every test
The problem seems to be the name of the action, "test", and nothing to do with printers at all. Any action that starts "test" seems to be affected, though I am still not sure why. -- 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/msgid/rubyonrails-talk/a6697af85f3221b9aa616a9eae44c928%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Capybara throws printer errors with every test
I am in the process of upgrading from Rails 3 to 4. Whenever I run a test I always get two errors like this: Capybara::Rails::TestCase#test_printer_url: ActionController::UrlGenerationError: No route matches {:action=>"test", :controller=>"printers"} missing required keys: [:id] If I test all my controllers I get 2, if I just test one of my models I get the same 2. They are nothing to do with any test I have written myself, they seem to be tests Capybara is running on itself. The problem seems to arise because I have a route for printers in my project, set up like this. resources :printers do member do get :test end end Okay, so just rename it to something to stop the name collision... If I rename "test" to "test_printer45745dc", or I change it from GET to POST it still fails! And if I have a second member line in there, I get four errors. If I change it to a collection, I get a different error: Capybara::Rails::TestCase#test_printers_url: ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true What Capybara seems to do is to generate tests on the fly, based on the routes, and then generate errors however they are set up. Why would it do that? What can I do about it? I am using JRuby 1.7.4 on Windows, by the way -- 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/msgid/rubyonrails-talk/a7f21d55f1780c3118904ae5005dc480%40ruby-forum.com. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] stub not working
On Fri, May 24, 2013 at 8:07 AM, Aashish Kiran wrote: > Hi, > I am testing views. I dont understand why stubs are not working. > Can anyone help. > > view code : > > before(:all) do > @current_user = stub("User") > assigns[:message] = @current_user > end > > output: > NoMethodError: >undefined method `stub' for #http://www.andylindeman.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/msgid/rubyonrails-talk/CA%2BvJLftvPjPNg99BTGfqJdY8DPJMf8mjY_WqcryJvdvLM8YOwg%40mail.gmail.com?hl=en-US. For more options, visit https://groups.google.com/groups/opt_out.
[Rails] Does anyone know what is causing auto-generated config.rb file for stylesheets?
Recently a particular Rails app I'm working with began to auto-generate a file app/assets/stylesheets/config.rb. It looks similar to a Compass configuration file, but this app does _not_ use Compass. I've found a couple threads about this, but so far no answers. http://stackoverflow.com/questions/15003841/rails-assets-stylesheets-config-rb https://github.com/rails/sass-rails/issues/141 Some relevant info about the app's gems: rails (3.2.12) sass (3.2.6) sass-rails (3.2.5) sprockets (2.2.2) Most of all I want to know why the file is now appearing and why it is important. Should I just git-ignore it? Is it best to add the file to version control? -- 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/-/x1650WpJtcQJ. For more options, visit https://groups.google.com/groups/opt_out.
Re: [Rails] What the Ruby Association
On Thursday, July 12, 2012 12:37:33 PM UTC-4, Walter Lee Davis wrote: > > > On Jul 12, 2012, at 12:30 PM, Jean-Sébastien D. wrote: > > > Walter Davis wrote in post #1068458: > >> On Jul 12, 2012, at 11:18 AM, Jean-Sbastien D. wrote: > >> > >>> rake db:rollback MMDDHHMMSS_model.rb > >> I don't know specifically -- what do the guides say? I've only ever > >> stepped back one or two at a time, made my adjustments, then run rake > >> db:migrate again to roll back up to the current stage. > >> > >> Walter > > > > Thanks I appreciate, i find it weird that you must make a new migration > > everytime you made a mistake, its seem to be a lot of overhead in > > compilation time. Maybe something that future rails should invest. Who > > knows I just started learning ruby. > > > > The migrations are typically only run during development, and then you can > install from the schema (which maintains a "current state" of the database > at all times) This is not true. Lets say you have a working system, being used by thousands of users. The database has enough data that a backup/restore takes half a day. Then you need to add a new feature that requires 3 new tables, and new columns on an existing table. How are you supposed to do this *without* running a migration against the production system? -- 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/-/vsEgGxckAXwJ. 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.
Re: [Rails] Run performance tests without dumping database
On Thursday, July 12, 2012 12:01:15 PM UTC-4, Colin Law wrote: > > On 12 July 2012 15:37, Andy Chambers wrote: > > > > > > On Thursday, July 12, 2012 3:03:25 AM UTC-4, Colin Law wrote: > >> > >> On 11 July 2012 01:39, Andy Chambers > wrote: > >> > Hi, > >> > > >> > I'm trying to build a simple performance test on a rails 3 app that > >> > operates > >> > on a large database (~150GB). We copy production data to our > dev/test > >> > setup > >> > every night so that we have a realistic environment for development. > >> > > >> > I followed the guide on creating a test and tried to run it using > >> > > >> > $ rake test:benchmark > >> > > >> > Unbelievably, this tried to drop my test database!!! Fortunately it > >> > didn't > >> > have permission to do this and failed. > >> > Is there a way to skip this step and > >> > just run the test against the DB as it exists already. From the > guide, > >> > it > >> > seems like most rails apps have their test data in yaml files or > >> > something > >> > but I don't understand how this would scale to a production > environment. > >> > Code that works well on 100 or so database rows is not necessarily > going > >> > to > >> > work well on millions of rows. > >> > >> The test environment is designed for testing that stuff works, not for > >> performance testing. > > > > > > If this is true, someone should tell that to the official guide > maintainers > > > > http://guides.rubyonrails.org/performance_testing.html > > That munching sound you can hear is me eating my words. > > > > >> The test environment is not appropriate for performance testing > >> anyway, to do this you would have to set up a parallel production > >> environment in order that it correctly mimics your real environment. > > > > > > Exactly! We have this. I just wondered if there was a "rails/ruby way" > of > > writing and running performance tests against this environment. The > > scaffolding builds a tests/performance directory so I assumed there was. > > I see from the guide section 1.7 that for performance test environment > is close to the production environment. Munch munch. > > So to get back to your original question this might be helpful, though > I have not tried it myself. It is a bit old so may need tweaking for > Rails 3. Does anyone else have suggestions? > http://m.onkey.org/running-rails-performance-tests-on-real-data > Aha, thanks for this link. That helps a lot. -- 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/-/wSPU3SU9N4YJ. 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.
Re: [Rails] Run performance tests without dumping database
On Thursday, July 12, 2012 3:03:25 AM UTC-4, Colin Law wrote: > > On 11 July 2012 01:39, Andy Chambers > wrote: > > Hi, > > > > I'm trying to build a simple performance test on a rails 3 app that > operates > > on a large database (~150GB). We copy production data to our dev/test > setup > > every night so that we have a realistic environment for development. > > > > I followed the guide on creating a test and tried to run it using > > > > $ rake test:benchmark > > > > Unbelievably, this tried to drop my test database!!! Fortunately it > didn't > > have permission to do this and failed. > > Is there a way to skip this step and > > just run the test against the DB as it exists already. From the guide, > it > > seems like most rails apps have their test data in yaml files or > something > > but I don't understand how this would scale to a production environment. > > Code that works well on 100 or so database rows is not necessarily going > to > > work well on millions of rows. > > The test environment is designed for testing that stuff works, not for > performance testing. If this is true, someone should tell that to the official guide maintainers http://guides.rubyonrails.org/performance_testing.html The test environment is not appropriate for performance testing > anyway, to do this you would have to set up a parallel production > environment in order that it correctly mimics your real environment. > Exactly! We have this. I just wondered if there was a "rails/ruby way" of writing and running performance tests against this environment. The scaffolding builds a tests/performance directory so I assumed there was. -- 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/-/ChtcbBV8m6IJ. 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] Run performance tests without dumping database
Hi, I'm trying to build a simple performance test on a rails 3 app that operates on a large database (~150GB). We copy production data to our dev/test setup every night so that we have a realistic environment for development. I followed the guide on creating a test and tried to run it using $ rake test:benchmark Unbelievably, this tried to drop my test database!!! Fortunately it didn't have permission to do this and failed. Is there a way to skip this step and just run the test against the DB as it exists already. From the guide, it seems like most rails apps have their test data in yaml files or something but I don't understand how this would scale to a production environment. Code that works well on 100 or so database rows is not necessarily going to work well on millions of rows. Feel free to point me in the direction of relevant documentation and tell me to RTFM. -- 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/-/LUHLC6G36-kJ. 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] Models in sub-folders in Rails 3
I have a Rails 2 project in which models are in sub-folders, but not in a name space app/models/sub_folder/posts.rb class Post < ActiveRecord::Base end The controllers are also in sub-folders, but are name spaced (views also in a corresponding sub_folder). app/controllers/sub_folder/posts_controller.rb class SubFolder::PostsController < ApplicationController end This works fine, but I want to move on to Rails 3, and it all falls apart... In application.rb I have config.autoload_paths += Dir["#{config.root}/app/models/**/"] So Rails should be able to find the models. However running tests (which are subfoldered in an analogous way), I get LoadError: Expected R:/test3/app/models/sub_folder/post.rb to define SubFolder::Post So okay, suppose I name-space my models? Now I get: LoadError: Expected R:/test3/app/models/sub_folder/post.rb to define Post Taking the model out of it sub-folder does allow the tests to pass, but my real project has over 30 models, and I really do want them to be structured somehow. Running on Rails version 3.2.2, with Ruby 1.9.2, on JRuby 1.6.7 by the way, and all the above are from a simple test project that I created just for this purpose; no custom code except as noted above. I have found several web pages about this issue, but they just indicate the config.autoload_paths bit should solve the problem; am I missing something simple here? -- 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] Request for Advice: "insert-only" ordering schema
Hi, I really like the "insert-only" ordering model described by Johnson in http://groups.google.com/group/rubyonrails-talk/browse_thread/thread/b8785791f46dd091/ec1a4f6e5a38a60c?lnk=gst&q=order+schema#ec1a4f6e5a38a60c and would like your advice on how to model reserved inventory and updates that results in a refund or extra charge. Please see our "insert-only" schema below. Summary of "insert-only" approach: The polyphasic timeline or "insert- only" approach, in which rows in the tables are only ever inserted, never deleted or updated (except for the inactivated_at column). This is accomplished by keeping "created_at" and "inactivated_at" columns on every table. The appearance and business effect of an update is accomplished by inactivating the existing row and creating a new row. The appearance and business effect of deleting a row is accomplished by inactivating the row. Rows that are currently active are readily identified by "inactivated_at is null" in the sql. We model previous charges in a 'transaction_amount' field in the orders table. A new transaction amount represents the extra charge necessary to pay for the order order.transaction_amount = order.price - sum_all(inactivated_order.transaction_amount) If order.transaction_amount is '< 0' it's a refund and if it's '> 0' it's an extra charge. Please let us know if you have any better ideas. I'd also like your advice on how to model reserved inventory. When the user initiated an order we reserve the inventory for up to 30 minutes. Inventory is currently reserved by setting a 'order.completed' flag to false, and we inactivate an order if it is not completed within 30 minutes. Another idea is to create a new table Reserved that has_one reserved Order. When the order is processed or time runs out the Order referenced by Reserved is inactivated. Please let me know what your advice is. Thank you in advance. Best, Andy ActiveRecord::Schema.define(:version => 20120213011540) do create_table "line_items", :force => true do |t| t.string "product_id", :null => false t.string "order_id", :null => false t.integer "quantity", :null => false t.integer "price", :null => false t.datetime "created_at", :null => false t.datetime "updated_at", :null => false t.datetime "inactivated_at" end create_table "orders", :force => true do |t| t.string "space_id", :null => false t.string "ip_address" t.boolean "accept_eula",:default => false t.string "email" t.text "address" t.string "pay_type" t.boolean "completed", :default => false, :null => false t.integer "total_price", :null => false t.datetime "created_at",:null => false t.datetime "updated_at",:null => false t.boolean "attend_event" t.text "comment" t.datetime "inactivated_at" t.integer "transaction_amount" end create_table "products", :force => true do |t| t.string "title" t.string "description" t.integer "price", :null => false t.string "currency", :null => false t.string "event_id" t.integer "max_spots", :null => false t.integer "taken_spots", :null => false t.integer "spots_req", :null => false t.integer "max_spots_per", :null => false t.datetime "created_at",:null => false t.datetime "updated_at",:null => false end end -- Andy Saebjoernsen Founder & CTO www.tableslice.com tel: 510.332.4877 Follow us @Tableslice Like us on Facebook -- 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: Simple ActiveRecord serialise problem
I've also just tried upgrading JSON to 1.6.0 (as that's the version that seems to be installed if I do gem install json), same problem. Cheers, Andy -- 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: Simple ActiveRecord serialise problem
> I was basing it on this article (as well as a stack overflow answer) that you > can provide a custom serializer in Rails 3.1: > > http://edgerails.info/articles/what-s-new-in-edge-rails/2011/03/09/custom-activerecord-attribute-serialization/index.html > > JSON provides a dump and load method on the class so it should be acceptable > as the serializer. > > Is this article incorrect or my understanding of it? Having just had a read of ActiveRecord::Base, I still can't see how I go wrong… Base#serialize (line 557 of base.rb in ActiveRecord 3.1.0) if the object supplied as the second argument responds to :load and :dump (which JSON does), then it uses that object, if not it wraps it in a YAMLColumn and sets the entry in serialized_attributes to that object. Then in: Base#arel_attributes_values (line 1963 of base.rb in ActiveRecord 3.1.0) if there is an entry in serialized_attributes for a given attribute name (with a value put in to the coder variable) it calls coder.dump with the attribute value. So, I can't understand why JSON wouldn't work as a second parameter... Cheers, Andy -- 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: Simple ActiveRecord serialise problem
> the second argument to serialise is used to say that you always want > the serialised object to be of a certain class (e.g. Hash, an > application specific class etc.). I'm not sure what you meant by > passing JSON as that argument but I suspect that it isn't doing what > you think it is. I was basing it on this article (as well as a stack overflow answer) that you can provide a custom serializer in Rails 3.1: http://edgerails.info/articles/what-s-new-in-edge-rails/2011/03/09/custom-activerecord-attribute-serialization/index.html JSON provides a dump and load method on the class so it should be acceptable as the serializer. Is this article incorrect or my understanding of it? Cheers, Andy -- 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] Simple ActiveRecord serialise problem
When I create a table with the following SQL: # create table foos (id SERIAL, content VARCHAR(255)); And define a class as follows: class Foo < ActiveRecord::Base serialize :content, JSON end Creating a new instance of the class gives an error: > f = Foo.new NoMethodError: undefined method `read' for nil:NilClass from /Users/andy/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-3.1.0/lib/active_support/whiny_nil.rb:48:in `method_missing' from /Users/andy/Code/FakePlatform/vendor/gems/Darwin/gems/json-1.4.6/lib/json/common.rb:286:in `load' from /Users/andy/.rvm/gems/ruby-1.9.2-p290/gems/activerecord-3.1.0/lib/active_record/base.rb:1938:in `block in set_serialized_attributes' Does anyone have any ideas how to fix this? It should work (it's such a simple case). Cheers, Andy -- 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] problem with catch all route catching redirects to external websites
We use a catch-all route in SomeController that incorrectly catch redirects to external websites when we use the 'redirect_to' method. Any help on how to avoid that is greatly appreciated. This is our routes: resources :some_controller, :path => '/' do collection do get 'go_to_external' end end This is an action that does a redirect to an external website: class SomeController < ApplicationController def go_to_external #should not be caught by the some_controller route, but is caught by it. redirect_to "https://example.com";, :status => :found end end Best, Andy -- 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] Fwd: ROR Developer positions in Hamburg - Can anyone help??
Hey, In reference to my last message I should have included the following information. We are only looking for developers that are willing to become a permanent employee of our business and work from our HQ in Hamburg. Unfortunately at this time we are not considering any offshore options or remote working. The right candidate doesn't need to speak German as our company language is English so fluency in English is the only language requirement. Many thanks Andy -- Forwarded message -- From: Andy Clayton Date: Wed, Jun 1, 2011 at 2:50 PM Subject: ROR Developer positions in Hamburg - Can anyone help?? To: rubyonrails-talk@googlegroups.com Hi, I’m currently looking for some Ruby on Rails developers in Hamburg, Germany to implement new future additions to our current platform and to maintain and improve the existing code base. If you are, passionate about writing Rails code, know other programming languages but you’re crazy about Ruby, like to stay on the cutting edge of web application development, into agile methodologies, enjoy working in teams with a focus on sharing knowledge with other experts and are interested in a new job role, then please contact me. I truly have some good positions available right now and would love to hear from any ROR developers who are seeking a new challenge. I look forward to hearing from you. Kind Regards Andy Clayton -- 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] ROR Developer positions in Hamburg - Can anyone help??
Hi, I’m currently looking for some Ruby on Rails developers in Hamburg, Germany to implement new future additions to our current platform and to maintain and improve the existing code base. If you are, passionate about writing Rails code, know other programming languages but you’re crazy about Ruby, like to stay on the cutting edge of web application development, into agile methodologies, enjoy working in teams with a focus on sharing knowledge with other experts and are interested in a new job role, then please contact me. I truly have some good positions available right now and would love to hear from any ROR developers who are seeking a new challenge. I look forward to hearing from you. Kind Regards Andy Clayton -- 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] Looking for a webmaster interested in real estate/advertising to work on a currently developing site
I'm looking for an freelancing webmaster who can help me with an extremely interesting advertising start-up and work with 3 other programmers to make a site for a start-up. We are using Ruby on Rails for this website. Email achang...@gmail.com if interested. -- 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] Integrating the fb_graph or koala gem with devise+mongoid+omniauth in rails 3
I need Facebook API integration in my rails application, but I can't figure out how to store the Facebook access token from Omniauth so that it can be reused later by a Facebook API gem. The Facebook API gems I am considering is fb_graph or koala (don't really care which), but I am open to other solutions if there are better alternatives. A question on Stackoverflow provides a solution which the questioner (and I) were not able to get to work: http://stackoverflow.com/questions/4010915/does-omniauth-provide-simple-hooks-to-the-facebook-graph-api The base code I want to integrate fb_graph or koala into comes from the official devise example page: https://github.com/plataformatec/devise/wiki/Example-Applications The base I am using integrates devise+mongoid+omniauth: https://github.com/fertapric/rails3-mongoid-devise-omniauth.git Any tips on how to integrate fb_graph or koala (or any other facebook API connection) with this devise+mongoid+omniauth base would be greatly appreciated. Best, Andy -- 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 join tables be polymorphic?
For example: Currently I have: functions < functions_competencies < competencies exams < exam_competencies < competencies I'd like to dry up "functions_competencies" and "exam_competencies" by using a polymorphic association, by let's say 'attached_competencies': functions < attached_competencies < competencies exams < attached_competencies < competencies evaluations < attached_competencies < competencies ... Note that these are join tables. Is this possible? -- 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: any gems to process PowerPoint files?
Unfortunately that's not going to work either. I really need to process these either in my Rails app or through a 3rd party service. Anyone know of any SaaS or web services that would do this? Thanks On Nov 29, 11:55 am, Walter Lee Davis wrote: > On Nov 29, 2010, at 10:49 AM, Andy wrote: > > > My client has PowerPoint files and we need to process them into images > > and text. > > > I was hoping there was something out there that could do this > > directly. > > > If anyone else has suggestions, please post. > > > Thanks > > Not on the server, but PowerPoint itself can output a Web site from > each file using File / Export. Something for a temp at your client's > office to do all day long. > > Walter > > > > > > > > > On Nov 26, 2:15 pm, gezope wrote: > >> Hi, > > >> I highly reccomend you Prezihttp://prezi.com/ > >> and not any MS product, since they are not free, and not open-source, > >> so if any company makes anything which can use it - it still mean > >> that > >> you or some will pay for it in the end. And mostly PowerPoint is > >> really out of date. > >> cheers > >> Zoltán > > >> On nov. 23, 14:00, DBL Systems wrote: > > >>> not sure if this will help but google docs just started providing > >>> 3rd > >>> party publishing/conversion from MS Office to google docs. perhaps > >>> this can get you part of the way by converting and using the gdata > >>> gem > > >>>http://code.google.com/apis/gdata/articles/gdata_on_rails.html > > >>> b > > >>> On Nov 22, 10:31 pm, Andy wrote: > > >>>> Does anyone know of any gems or plugins that can take a > >>>> PowerPoint and > >>>> create images out of every slide and also access the text in each > >>>> slide? > > > -- > > 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 > > athttp://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-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: Error installing rails 3, get error: mail requires i18n (~> 0.4.1, runtime)
*I also uninstalled i18n 0.5.0 leaving i18n 0.4.2 to get everything working... Andy -- 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: Error installing rails 3, get error: mail requires i18n (~> 0.4.1, runtime)
Same just happened to me on Ubuntu 10.04 using RVM. Anyways, my theory at the moment is they just released i18n 0.5.0 and gem install rails installed 0.5.0 and mail gem requires i18n version 0.4.x. Here's the entire painful process of getting it working. abarrin...@andys-dev-box:~$ gem install rails ERROR: Error installing rails: mail requires i18n (~> 0.4.1, runtime) abarrin...@andys-dev-box:~$ gem install i18n Successfully installed i18n-0.5.0 1 gem installed Installing ri documentation for i18n-0.5.0... Installing RDoc documentation for i18n-0.5.0... abarrin...@andys-dev-box:~$ gem install rails ERROR: Error installing rails: mail requires i18n (~> 0.4.1, runtime) abarrin...@andys-dev-box:~$ gem list *** LOCAL GEMS *** abstract (1.0.0) actionpack (3.0.3) activemodel (3.0.3) activerecord (3.0.3) activeresource (3.0.3) activesupport (3.0.3) arel (2.0.4) builder (2.1.2) erubis (2.6.6) i18n (0.5.0) mime-types (1.16) polyglot (0.3.1) rack (1.2.1) rack-mount (0.6.13) rack-test (0.5.6) rake (0.8.7) treetop (1.4.9) tzinfo (0.3.23) abarrin...@andys-dev-box:~$ gem install mail Successfully installed i18n-0.4.2 Successfully installed mail-2.2.10 2 gems installed Installing ri documentation for i18n-0.4.2... Installing ri documentation for mail-2.2.10... Installing RDoc documentation for i18n-0.4.2... Installing RDoc documentation for mail-2.2.10... abarrin...@andys-dev-box:~$ gem install rails -v 3.0.3 Successfully installed actionmailer-3.0.3 Successfully installed thor-0.14.6 Successfully installed railties-3.0.3 Successfully installed bundler-1.0.7 Successfully installed rails-3.0.3 5 gems installed Installing ri documentation for actionmailer-3.0.3... Installing ri documentation for thor-0.14.6... Installing ri documentation for railties-3.0.3... Installing ri documentation for bundler-1.0.7... Installing ri documentation for rails-3.0.3... Installing RDoc documentation for actionmailer-3.0.3... Installing RDoc documentation for thor-0.14.6... Installing RDoc documentation for railties-3.0.3... Installing RDoc documentation for bundler-1.0.7... Installing RDoc documentation for rails-3.0.3... abarrin...@andys-dev-box:~$ gem list *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.3) actionpack (3.0.3) activemodel (3.0.3) activerecord (3.0.3) activeresource (3.0.3) activesupport (3.0.3) arel (2.0.4) builder (2.1.2) bundler (1.0.7) erubis (2.6.6) i18n (0.5.0, 0.4.2) mail (2.2.10) mime-types (1.16) polyglot (0.3.1) rack (1.2.1) rack-mount (0.6.13) rack-test (0.5.6) rails (3.0.3) railties (3.0.3) rake (0.8.7) thor (0.14.6) treetop (1.4.9) tzinfo (0.3.23) On Nov 29, 11:54 am, Mike Moretti wrote: > Hi folks: > > I have Windows XP Pro SP3. I have installed ruby 1.9.2p0 (2010-08-18 > [i386-mingw32]). I’m trying to install rails 3 by entering “gem install > rails” on command prompt window (i.e. DOS window). Halfway through > installation I get the following: > > ERROR: Error installing rails: > mail requires i18n (~> 0.4.1, runtime) > > Can anyone help please? > > Mike > > -- > 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: any gems to process PowerPoint files?
My client has PowerPoint files and we need to process them into images and text. I was hoping there was something out there that could do this directly. If anyone else has suggestions, please post. Thanks On Nov 26, 2:15 pm, gezope wrote: > Hi, > > I highly reccomend you Prezihttp://prezi.com/ > and not any MS product, since they are not free, and not open-source, > so if any company makes anything which can use it - it still mean that > you or some will pay for it in the end. And mostly PowerPoint is > really out of date. > cheers > Zoltán > > On nov. 23, 14:00, DBL Systems wrote: > > > > > > > > > not sure if this will help but google docs just started providing 3rd > > party publishing/conversion from MS Office to google docs. perhaps > > this can get you part of the way by converting and using the gdata gem > > >http://code.google.com/apis/gdata/articles/gdata_on_rails.html > > > b > > > On Nov 22, 10:31 pm, Andy wrote: > > > > Does anyone know of any gems or plugins that can take a PowerPoint and > > > create images out of every slide and also access the text in each > > > slide? -- 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] any gems to process PowerPoint files?
Does anyone know of any gems or plugins that can take a PowerPoint and create images out of every slide and also access the text in each slide? -- 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] Overriding log_error in Rails3 not working
I have this in my application.rb: private def log_error(exception) super UserMailer.error_message(exception, clean_backtrace(exception), session.instance_variable_get("@data"), params, request.env ).deliver end I'd like the errors emailed to me. It doesn't seem to be calling that "log_error" at all. Is this done some other way in Rails3? -- 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] What's your Real World Rails 3 performance like?
Can any of you share your upgrade stories from Rails 2.x to 3 and how it impacted performance for better or worse? Include details like web server, passenger/mongrel, rails version etc. We have a rails project that we are looking to upgrade to Rails 3 but just wanted to know from a performance perspective what the community was experiencing. Thanks, Andy -- 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: ERROR: Failed to build gem native extension (win server 2003/2008 ruby 1.9.1/1.8.7)
try this: gem install mongrel_service --platform i386-mswin32 -- 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-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: Simple Captcha - files still in "/tmp" directory and not displaying
Found the solution: https://rails.lighthouseapp.com/projects/8994/tickets/4063-rails-30-beta1-send_file-with-0-byte On Sep 9, 6:59 pm, Andy wrote: > I'm starting to narrow down the problem. > > The files are being created in the "/tmp" folder. > > But when image.rb passes it up to simple_captcha_controller.rb, the > files are coming through empty. > > The versions in "/tmp" are not empty files though. > > I'm using a CentOS server I configured myself (rather than a Rails > host like EngineYard) so I'm guessing it's some sort of server > issue. > > On Sep 9, 5:29 pm, Andy wrote: > > > > > I'm trying to use the Rails3 Simple Captcha version from > > here:http://github.com/galetahub/simple-captcha > > > It's working 100% fine on my local environment. > > > In Production, I had to point the "convert" command to the correct > > directory and then reinstall ImageMagick with the FreeType lib. > > > Now I'm not getting any errors in production.log but the images are > > coming up as broken images. > > > Any ideas? -- 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: Simple Captcha - files still in "/tmp" directory and not displaying
I'm starting to narrow down the problem. The files are being created in the "/tmp" folder. But when image.rb passes it up to simple_captcha_controller.rb, the files are coming through empty. The versions in "/tmp" are not empty files though. I'm using a CentOS server I configured myself (rather than a Rails host like EngineYard) so I'm guessing it's some sort of server issue. On Sep 9, 5:29 pm, Andy wrote: > I'm trying to use the Rails3 Simple Captcha version from > here:http://github.com/galetahub/simple-captcha > > It's working 100% fine on my local environment. > > In Production, I had to point the "convert" command to the correct > directory and then reinstall ImageMagick with the FreeType lib. > > Now I'm not getting any errors in production.log but the images are > coming up as broken images. > > Any ideas? -- 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] Simple Captcha - files still in "/tmp" directory and not displaying
I'm trying to use the Rails3 Simple Captcha version from here: http://github.com/galetahub/simple-captcha It's working 100% fine on my local environment. In Production, I had to point the "convert" command to the correct directory and then reinstall ImageMagick with the FreeType lib. Now I'm not getting any errors in production.log but the images are coming up as broken images. Any ideas? -- 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 can I do an onChange event with Rails3 and jQuery?
I'm using jQuery with Rails3. I'd like to trigger some AJAX on the change of a SELECT element. I've tried the old Prototype way: {:onchange =>remote_function(:update => "mytable", :url => "/xxx")} I get a JS error: "Ajax is not defined" I assume it's trying to use Prototype and that's where the error comes from. I'd love to use Unobtrusive Javascript, but I don't want to submit the WHOLE form. I just want the ONCHANGE of a SELECT element to trigger AJAX and update a specific piece of the page. I can't find any documentation anywhere that describes how to do this. Anyone know any resources or know how to do this? Thanks, Andy -- 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] Recommend a gem/plugin for autocomplete in Rails3 using jQuery?
Can anyone recommend a good gem or plugin for autocomplete in Rails 3 that only needs jQuery? I need to search multiple fields and multiple objects and display them in a clickable auto-complete list. Would it be best to just build this myself? -- 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] Rails hosting in Canada?
Anyone have any recommendations for Rails hosting in Canada? It needs to be solid hosting, on the level of EngineYard and Blue Box Group. 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] JOBS: ROR Dev needed in Texas
ROR Developer opening in Texas. Relocation expenses paid for. Direct - permanent employment. Opportunity to join an exceptional development team. Exceptionl benefits and training. Flat organization model. Desire energetic opinions. Agile environment. ROR Dev will design and develop new automation platform; Ruby on Rails. Interested developers should email resume to andy.ka...@modis.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] zxcvbnm
class LoginController < ApplicationController def addprod @category=Cattab1.find(:all) @product=Prodtab.find(:all) @i=0 @checkvalue="" end def login @logincheck =Login.new @prodcheck=Prodtab.new if(session[:login_id]) Login.update(session[:login_id],:user_status=>"0") end end def login_create @login = Login.new(params[:login]) if request.get? session[:login_id] = nil else puts 'logincretaee' puts params[:login][:password] params[:login][:password] = Login.hashed_password(params[:login][:password]) puts params[:login][:password] @logincheck = Login.find_by_name_and_password(params[:login][:name],params[:login][:password]) if @logincheck == nil #...@logincheck.save flash[:error] ="Name/Password not matching" redirect_to :controller=>'login', :action=>'login' and return else session[:login_id] = @logincheck.id Login.update(@logincheck.id,:user_status=>"1") redirect_to :controller=>'prodtabs', :action=>'index' and return end end end def category3 puts '*category3' @categyid=request.raw_post session[:category_i...@categyid.to_i puts @categyid.to_i @catlist=Cattab1.find_all_by_id(@categyid.to_i) end def category4 puts '*category4' @productid=request.raw_post puts @productid.to_i @prodlist=Prodtab.find_all_by_id(@productid.to_i) end def prod1 puts '***prodids' puts params[:product_id] puts '*vijay' @prodcheck1=params[:product_id] @prodcheck=Prodtab.find_all_by_id(@prodcheck1) @prodcheckcatid=Prodtab.find_all_by_cattab1_id(@prodcheck1) @prodcheck.each do|p| if p.cattab1_id==0 Prodtab.update(p.id ,:cattab1_id=>session[:category_id]) flash[:success] ="Product is assigned successfully" else flash[:error] ="#{p.pname} is already assigned" redirect_to :controller=>'login', :action=>'addprod' and return end #end end redirect_to:controller=>'login', :action=>'addprod' end end views var txt1=new Array(); var txt2=new Array(); function compare1() { if(document.getElementById("login_name").value=="") { alert("Please enter the Login name"); document.getElementById("login_name").focus(); return false; } var checkStr = document.getElementById("login_name").value; if(checkStr.length<2 || checkStr.length>6) { alert("Login Name should be minimum two characters and maximum Six characters"); document.getElementById("login_name").value=""; document.getElementById("login_name").focus(); return false; } var checkOK = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; var checkStr1= document.getElementById("login_name").value; var checkStr2= document.getElementById("login_password").value; var allValid = true; var allValid1=true; for (i = 0; i < checkStr.length; i++) { ch = checkStr.charAt(i); for (j = 0; j < checkOK.length; j++) if (ch == checkOK.charAt(j)) break; if (j == checkOK.length) { allValid = false; break; } } if (!allValid) { alert("Please enter only letter and numeric characters in the \"Login Name\" field."); document.getElementById("login_name").focus(); document.getElementById("login_name").value=""; return false; } if(document.getElementById("login_password").value=="") { alert("Please enter the Login Password"); document.getElementById("login_password").focus(); return false; } if(checkStr2.length<6 || checkStr2.length>10) { alert("Password should be minimum six characters and maximum Ten characters"); document.getElementById("login_password").value=""; document.getElementById("login_password").focus(); return false; } return true; } LOGIN FORM <%= flash[:error] %> <% form_tag({ :controller => "login", :action => "login_create"}, {:id=>"login", :name=>"login" ,:multipart => true}) do %> Login ID <%= text_field 'login','name' %> Password <%= password_field 'login','password' %> <% end %> model class Login < ActiveRecord::Base validates_uniqueness_of :name def self.hashed_passwo
Re: [Rails] Admin interface for Rails?
It's a generator, but it comes up with quite nice 37 Signals style admin interfaces. http://github.com/andyjeffries/andy_admin Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 1 August 2010 06:03, rodrigo3n wrote: > Hello folks, I am currently working on a project that has to deliver > an admin interface like the Django's one, I wanna know if you know/ > recommend any gem or plugin for that. > > Cheers, > Rodrigo Alves Vieira > > -- > 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. > > -- 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.
Re: [Rails] Rescuing Errors
Hoptoad -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 28 July 2010 11:26, Pale Horse wrote: > Ideally, what I need is a method of rescuing ALL errors that can occur > on a site by sending those errors (including the time they occurred) to > a specified address. > > What would you 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-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. > > -- 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.
Re: [Rails] Re: rails asset cache
Sorry, no idea. (just to let you know that you're not being ignored it's just likely that no-one has an answer for you, this generally works fine for me). -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 27 July 2010 05:49, Tom Mac wrote: > Hi > Could anybody please clarify my doubt? > > 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-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. > > -- 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.
Re: [Rails] rails asset cache
On 23 July 2010 10:52, Tom Mac wrote: > I have a of line code like > <%= stylesheet_link_tag "styles",:cache => "cache/styles" %> > >And it produces source as > > rel="stylesheet" type="text/css" /> > >config.action_controller.perform_caching = true > > My concern is what is 1279620123 after question mark(?) above. If such a > random number always appended, whether caching in browser happens or > not?Please give me a good idea > It's the timestamp when the file was last changed (or the last file if you list multiple stylesheets in stylesheet_link_tag). That way browsers can cache it long term and it will automatically change if you change one of the files during a new deployment. Cheers, Andy -- 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.
Re: [Rails] Re: starting with RoR
I wouldn't normally post silly little corrections/typos, but as the OP was a newbie (and might play with it, type the code in and fail to get it all to work): > $ ./script generate scaffold User login:string password:string > first_name:string last_name:string > Should be: $ ./script/generate scaffold User login:string password:string > first_name:string last_name:string > Cheers, Andy -- 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.
Re: [Rails] starting with RoR
> > Why is mySQL not the typical default DB? > Because SQLite is easier to install/maintain on a developer's machine. It's easy enough to switch to MySQL when creating a project: rails my_project -d mysql > I'm used to building up tables by hand...I'm aware there is a faster way > of doing it in RoR - should I be old fashioned and comfortable or plunge > right in to the Ruby way? > Look in to ActiveRecord Migrations and "rake db:migrate". When you say "building up tables" if you mean initial data entry, look in to ActiveRecord Seed data and "rake db:seed". > Hosting companies? Can anyone recommend any cheap development servers, > that we can all work remotely? > In the UK, I'd recommend Bytemark.co.uk - outside the UK, you'd need to give more information on where you are :-) > Prob inane questions - but my experience with RoR is zero! > I'm sure we'll all help you on here. Providing you post detailed questions (including any error messages, what you've tried etc) you're bound to get helpful answers. Cheers, Andy -- 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.
Re: [Rails] Send picture from iPhone
> > The rails output shows: > [paperclip] An error was received while processing: > # pDBak1ufEeSHluZ8kAougU+++TI/-Tmp-/stream20100721-4816-1pbpnnn-0 is not > recognized by the 'identify' command.> > > What is the best way to do this? > The normal cause of that problem in my experience (and I've had it a few times) is that 'identify' isn't in the path for the Rails process. The easiest solution is to go to the server and type "which identify" then put the path in the config/environments/production.rb file (or whatever your environment it): Paperclip.options[:image_magick_path] = '/foo/bar/bin/' Cheers, Andy -- 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: setup not invoked during unit testing
Frederick Cheung wrote: > On Jul 20, 3:57�pm, Andy Joel wrote: >> >> test_setup does get invoked, so the file is being processed. I am >> guessing that somewhere there is another setup method that takes >> priority, but where would it be, and why does it take priority over this >> one? My IDE recognises that this setup overrides the one in >> ActiveSupport::TestCase. >> > > is it possible that another of your test cases is also called > GlcTest ? > > Fred That was it. I had copy-and-pasted from GlcTest to create a new test class, and had forgotten to change the class name. Thanks for the help. -- 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-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] setup not invoked during unit testing
I have a bunch of unit test files in a Rails project. One of them has stopped using the setup method before each test, or even if I invoke it in the test itself. After commenting out most of it, here is what is left: require 'test/test_helper' class GlcTest < ActiveSupport::TestCase def setup p '###' end def test_setup p '' setup end end The file I am testing is glc.rb, and that does get loaded. If I run the test file, it does work normally; this is a problem when running the test through rake (either via my IDE or at the command line). test_setup does get invoked, so the file is being processed. I am guessing that somewhere there is another setup method that takes priority, but where would it be, and why does it take priority over this one? My IDE recognises that this setup overrides the one in ActiveSupport::TestCase. There is no setup method defined in glc.rb, and as the problem is isolated to this one class, I am mystified as to where this other setup might be. Any advice appreciated. Using JRuby 1.5 on Windows, by the way. -- 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-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.
Re: [Rails] Re: Git on MAC OS X
On 19 July 2010 16:38, Abder-Rahman Ali wrote: > I now added /usr/local/bin to my path as follows: > > export PATH=$PATH:/usr/local/bin > > http://www.how-to-linux.com/2010/04/how-to-add-usrlocalbin-to-your-path-on-centos/ Good job. > But, when I run now: brew install git > > I get the following: > > -bash: /usr/local/bin/brew: /usr/bin/ruby: bad interpreter: No such file > or directory > Wow! That is weird. Where is your Ruby? On Mac OS X Ruby is available by default at that location: $ which ruby /usr/bin/ruby Try running which ruby in a Terminal. Cheers, Andy -- 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.
Re: [Rails] Re: Does Nginx with Passenger actually work?
> > Anyway, unless you are using your Mac as a server, why are you running > Passenger on it in the first place? Mongrel is perfectly suitable for > development. > A lot of people: 1) Work on more than one site at a time (during a day) 2) Want it always available rather than having to remember to start the server 3) Prefer to host as much as possible on the same technology (Apache, Passenger, MySQL is much better than Mongrel/SQLite even if you develop on Mac OS X and deploy on Linux). I know I do (all of the above). Cheers, Andy -- 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.
Re: [Rails] Git on MAC OS X
On 19 July 2010 15:46, Abder-Rahman Ali wrote: > I know that this question may not be here, but think that most of you > using RoR deal with Git. > > I run a MAC OS X 10.5.8, and want to install Git running on my machine. > But, I didn't find this version of my MAC OS X here: Hi, > > http://code.google.com/p/git-osx-installer/downloads/list > > Any ideas on getting Git working on my MAC? > Personally I install all my Linuxy software through Homebrew - http://github.com/mxcl/homebrew - install homebrew using (from the github page): ruby -e "$(curl -fsS http://gist.github.com/raw/323731/install_homebrew.rb)" Then you can install Git using: brew install git Cheers, Andy -- 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.
Re: [Rails] :controller, how does Rails recognize them?
> > It mentions that we have the following in the "routes.rb" file: > > map.connect ':controller/:action/:id' > map.connect ':controller/:action/:id.:format' > > Now, in completing the tutorial, we will add the following to > "routes.rb": > > map.root :controller => "home" > > In the first two statements we have :controller, and in the last > statement, we have a :controller pointing to a value. > > How does Rails determine that the first two statements point to a > :controller other than the last statement? > Because it's mapping a URL pattern to a controller and action. For example, it means that: http://www.example.com/users Will go to the UsersController's index action (because index is the default action) with no id (as nil is the default for a missing parameter at the end). http://www.example.com/users/show/1 Will map to the show actions of UsersController passing in a params[:id] of 1. And, in the last statement, what are we exactly saying? > That the / (http://www.example.com/) should go to the HomeController class's index action (as index is the default as above). Cheers, Andy -- 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.
Re: [Rails] Re: Re: Ruby on Rails template designs
> > > http://github.com/andyjeffries/andy_admin > > Thanks a lot. > > Does it give you the layouts to the pages? > It generates the stylesheets and layouts, styles a lot of the standard classes and gives an amended form builder. > Do you have an example of that? > I've been meaning to put together a screencast sometime on it, but to be honest, it's very simple - just following the README should get you up and running. I won't get chance to do a screencast today, but I'll try to do it this week if I get a chance. Cheers, Andy -- 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.
Re: [Rails] Re: Ruby on Rails template designs
Or as another example: http://github.com/andyjeffries/andy_admin :-) -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 18 July 2010 08:25, Abder-Rahman Ali wrote: > I think this is what I was looking for: > http://github.com/pilu/web-app-theme > -- > 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-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. > > -- 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.
Re: [Rails] Re: Added associations but don't see generated methods
> > > Welcome to dynamic objects and classes :-) > Thanks. This restores my faith in Rails and enhances my appreciation > of newsgroups, especially this one. > Now I've got to put them to use! > Good luck. Post back if you have any more problems. Cheers, Andy -- 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.
Re: [Rails] Re: Added associations but don't see generated methods
> > > what makes you think they aren't there ? > > I searched for them to no avail. Shouldn't they be in the > Expense model (app\models\expense.rb); or > Expense controller (app\controllers\expenses_controller.rb? > No, they are dynamically defined and exist in memory only at runtime. Welcome to dynamic objects and classes :-) Try using script/console to execute them. Cheers, Andy -- 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.
Re: [Rails] Effects of a humongous Controller on performance?
> > My thinking is that perhaps every time a page is rendered, a mongrel has > to instantiate this controller and that marshalling this into RAM is > very time-consuming. Or does a controller get loaded into RAM at server > startup and then the effect is not all that substantial for each page? > Any ideas on this? > I'm not familiar with Mongrel-based hosting, but in Passenger classes are cached in memory when loaded and instantiated from that. The cost of instantiating a new object shouldn't be that onerous (even if you have a zillion methods) as it's only a pointer to the class at that point and an instance data created during instantiation. I am familiar with Ruby profiling and we are looking into that too. > Personally I'd recommend testing it on a Mac and using DTrace to get a really good insight in to where it's spending it's time. I've had a lot of success with that in the past. Cheers, Andy -- 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.
Re: [Rails] Ruby - return true if any element in Array satisfies condition but false otherwise
On 16 July 2010 13:51, Michael Pavling wrote: > On 16 July 2010 13:48, Ram wrote: > > Anyone know a function that loops through an array and returns true if > > any one element satisfies the condition but false if none satisfy the > > condition? And it should do this in one line. Something like > > You probably want ".detect" > http://ruby-doc.org/core/classes/Enumerable.html#M003123 > >any_bot_follower = followers.detect(false) { |f| f.bot? } > Or Enumerable#any? http://apidock.com/ruby/Enumerable/any%3F any_bot_follower = followers.any? { |f| f.bot? } Cheers, Andy -- 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.
Re: [Rails] Re: how to do url rewriting
> > What the purpose to hide the controller and action from URL? > To have nicer URLs? For example: http://www.facebook.com/andyjeffriesrather than http://www.facebook.com/user/show/andyjeffries It's quite a common request. You can use the Apache mod_rewrite itself to make this change. You will > need to know a little regex to make these changes. > You can, but given that Rails has native support for this in the Routing subsystem I'd personally avoid putting it in the webserver (otherwise if you want to move to something else, Nginx, Unicorn, whatever) you'd have to redo the work. Cheers, Andy -- 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.
Re: [Rails] Re: named_scope multiple conditions
> > Thanks for the suggestion. However what did you mean specifically with > your last comment? > > >> With anything like this any time you save when building up the > conditions > >> will be dwarfed by the time it takes to run the actual query > Putting words in Frederick's mouth, but it simply means that it's ridiculously quick to build up the conditions object in Ruby compared to actually executing the SQL on the database (and communicating the SQL and response over the socket). Cheers, Andy -- 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.
Re: [Rails] how to do url rewriting
Look at my response to your message "how can i hide controller and action name in url". There is a link there to a Rails guide which explains all about Routing. Routing is the part of rails that defined mapping a URL or URL pattern to a controller and action. At the moment you seem to be multiple posting the same question, phrased slightly differently without reading responses. Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 16 July 2010 11:53, Amit Jain wrote: > Hello, > > I am Amit. i am new to Rails. Please forgive me if ask any stupid > questions. > > I have gone through this article. I am also suffering with the same > problem. > > my website URL like this: http://127.0.0.0:3000/users/edit/30 > > I don't want to show the controller:users and action: edit. > > I want to Re-Write (rewrite) the URL or i want to maintain the URL as > http://127.0.0.0:3000/30/ only.(30 is a user id) > > I am not interested to show the controller(user) and action (edit) > > > I total intention is to Hiding (HIDING) and rewriting (REWRING) the URL > and mainly i want to hide the URL Extensions with controller and actions > mainly.. > > Can u help me on that Please.! sad > -- > 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-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. > > -- 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.
Re: [Rails] how can i hide controller and action name in url
> > I am new in ROR. > > I want to hide controller and action name from url. > > exp. my current url: > > http://localhost:3000/triggers/index/amit123 > > expected: > > http://localhost:3000/amit123 > > remove controller(trigger) and action(index) name from url. > http://guides.rubyonrails.org/routing.html If you look at section 2.3 of that document, it shows how to map '/login' to what would be '/sessions/new'. Cheers, Andy -- 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.
Re: [Rails] Is TDD really followed in the industry ?
> > I am a rails beginners. I have created a couple of simple applications > without following TDD. > > I have a question - Do good programmers really follow TDD strictly ? I > mean.. Do they follow { 1. Write Test 2. Write Code 3. Refactor } > cycle ? > > Is Writing tests before Implentation code really significate beyond > these TDD books ?? > Absolutely! It's a matter of habit to get in to, but once you do... I much prefer developing TDD. It's not always easy (if you're taking over an existing codebase, etc) but if you have the chance go for it - you'll find bugs much earlier in the process which is ALWAYS a good thing :-) A lot of companies using Rails are doing things in a very agile/Agile way - automated testing is a key part of that, and it's always better to test first. I would say though, that I much prefer feature tests using Cucumber to old Test::Unit tests. Cheers, Andy -- 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.
Re: [Rails] on
Good catch Hassan -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 -- 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.
Re: [Rails] on
> > this his the generated code from my haml code > > > Anglais option> > Français > Allemand > > > but I get a JS error > > this.form is undefined > > what did I missed ... > The onchange event is on the tag, so "this" is a form and doesn't have a ".form" method. Try doing: http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Gentoo for Rails?
> > Please don't make it a flame war about linux distros. > To the OP, I really haven't heard about any Gentoo user in the rails > community so far, if I have to say there's a predminant OS in the > rails community that would be Mac OS. (And I don't know why either) > As a Mac OS X user I don't particularly care about which distro to use (so I had no intention of making it a flame war), I was just trying to point out that it's not that hard :-) Cheers, Andy -- 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.
Re: [Rails] Elegant Registration / Log in fix
I don't use Resftul_authentication, but without knowing the details of it personally I'd use a before_filter in ApplicationController (or SignupController and LoginController) to set params[:email] (or whatever) to the shorter email (gsub to replace the long one with the short one). There may be a better way with Restful_authentication and you'll need to find out the param names you need to change the values for, but that may point you in a direction to get it working... Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 9 July 2010 14:44, DanC wrote: > Hi, > > I have an app which allows users to register using two different email > address suffixes only which identifies them as being from a certain > organisation. > > Let's call them @abcd.co.uk and @abcdefg.co.uk > > The shorter version is just a contraction of the longer version and > are interchangeable for the users in their day to day email activity. > The problem is that some people register with the long form and then > try and log in using the short form. > > This causes a headache for the admin who gets unnecessary emails. > > What is the most Rails way to deal with this at log in and catch the > users error automatically but still allowing log in? i.e. make the app > insensitive to which email gets used for login / registration etc. > > The app uses Resftul_authentication plugin > > Thanks, > > Dan > > -- > 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. > > -- 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.
Re: [Rails] [Rails3] Issue in modifying locale and redisplaying page
On 8 July 2010 19:39, Erwin wrote: > In a test app, I have a drop-down selection to change the language of > the site. > I use an Ajax request to an action in which the locale is changed, and > the it's redirected to the home page > unfortunately, the locale seems to be changed but the home page > doesn't reflect the new language .. > That doesn't surprise me... > application_controller.rb > .. before_filter :set_locale > def set_locale >I18n.locale = params[:locale] > end > This filter will execute on your Ajax action (as you have a params[:locale]) but on your redirect it's a fresh request without that parameter so it will fallback to default. I'd imagine you want to store params[:locale] in the session[] or cookie[] arrays and then use that value if set. Also, remember the browser will normally send a preferred language in the headers (Accept-language) so you can use that by default. I can't remember if I18n.locale uses that (or just the system locale). Finally, your default_url_options is only used when generating urls for links using url_for and related functions - it doesn't set it as a default parameter on incoming request. Cheers, Andy -- 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.
Re: [Rails] Re: Gentoo for Rails?
On 9 July 2010 00:32, Gerardo Gonzalez Cruz wrote: > I Work rails on my beauty Gentoo System, i find hard install rails over > Ubuntu because you need know each package to install :-(, on Gentoo is easy. Really? apt-get install ruby1.8 ruby1.8-dev rubygems gem update --system gem install rails passenger Configure Passenger as normal. What's hard? Cheers, Andy -- 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.
Re: [Rails] Kind of object
$ irb > class MyHash < Hash ; end => nil > h = MyHash.new => {} > h.is_a? Hash => true Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 9 July 2010 08:52, Hemant Bhargava wrote: > Hello All, > > I want to know that is there anything in ruby by which i can know that > which kind of object is this..? Something like is_object? :) > > I mean.. lets suppose i have two objects of Model ABC and Model DEF.. > then i want to execute some conditions based upon the type of objects. > > 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-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. > > -- 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.
Re: [Rails] Paypal Integration
I'd recommend starting here... Episode 141: PayPal Basics<http://railscasts.com/episodes/141-paypal-basics> Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 8 July 2010 11:57, debadatta wrote: > Hi all I want to integrate Paypal in my rails application .. How to do > it please give me some idea for IPN. > > -- > 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. > > -- 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.
Re: [Rails] Re: How can I hide my Ruby code?
On 7 July 2010 01:25, Skip Levens wrote: > Props to Andy's solution - thats pretty awesome... hopefully not > everyone needs that! > Thanks Skip and I agree with your hope. There are so many weird things I've done on this project, it's been a great/interesting experience... Cheers, Andy -- 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.
Re: [Rails] Re: How can I hide my Ruby code?
> > Interesting solution, but also not secure. Anybody who has root can > read out your running processes' memory spaces and either (a) grab the > key and yer pwned or (b) grab the bytecodes, decompile and yer pwned. > Yep. Completely agree. They weren't planning on stopping crackers, but sysadmins that "knew some ruby". > Add to that bonus nasties like directly frobbing the core of a running > VPS instance from the hypervisor, and you're back in security hell > again. > They're not using VPS/hypervisors. Cheers, Andy -- 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.
Re: [Rails] Re: Re: Re: How can I hide my Ruby code?
> > >> Or if there is any way so that I can encrypt my code > >> without interrupting the execution of the application. > > If your client is determined to access your code even an encryption of > the Ruby source code will not be sufficient. In order for MRI to > interpret Ruby it must be decrypted. If the client has full access to > the system then this means that they also have access to the encryption > keys. > > This is the same issue that makes decrypting DVDs possible. The keys > must be available to the system performing the decryption. Now maybe > doing this will discourage a client from making the attempt, but if they > are determined then there's nothing stopping them from hiring someone to > "crack" your encryption. But, as I said it's not really cracking it > since the encryption keys exist in a location where the client has > access. > Indeed, finding them in memory. I believe though that the requirement is to stop casual looking/tampering by the company's sysadmins rather than to stop a dedicated expert cracker. Cheers, Andy -- 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.
Re: [Rails] Re: Re: How can I hide my Ruby code?
> > > We're developing the site but the day to day running is down the client > (but > > they have lots of power from various sources, redundancy and sysadmins to > > type the password back in). > > Is the client trying to keep the code hidden from his own sysadmins or > are you trying to hide it from the client? > The first option :-) Cheers, Andy -- 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.
Re: [Rails] Re: Re: How can I hide my Ruby code?
On 6 July 2010 11:31, Michael Pavling wrote: > On 6 July 2010 11:19, Andy Jeffries wrote: > > You can do this (I've had to do it for a client) but it's not simple > > > > Very interesting approach. Will file that for future reference. > I hope you never need it :-) > > The last step, if you're using Passenger ensure that the last child is > never > > killed off (if it is, it will lose the decryption key which is now only > in > > memory). I can't remember the setting but there's a timeout setting > which > > you can set to zero so the last child never dies. > > Hope you've got good UPS and redundancy too (and a well-negotiated > call-out fee to re-encrypt everything if the YTS boy unplugs the power > :-) We're developing the site but the day to day running is down the client (but they have lots of power from various sources, redundancy and sysadmins to type the password back in). Cheers, Andy -- 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.
Re: [Rails] Re: Re: How can I hide my Ruby code?
On 6 July 2010 10:34, Sumanta Das wrote: > Or if there is any way so that I can encrypt my code > without interrupting the execution of the application. You can do this (I've had to do it for a client) but it's not simple and I can't share my solution's code. However, you basically go along the lines that you have a class responsible for decrypting/encrypting code (I used Base64 encoded AES). You then have Rake tasks that go through all Ruby (I did YAML too as YAML files are executed as ERB first) files, encrypt the content and replace the file contents with contents like this: require 'config_decryptor' eval ConfigDecryptor.decrypt(...ENCRYPTED_CONTENT_HERE...) Your config_decryptor.rb file has to be in the load path - I handled this by requiring the full path in a config/preinitializer.rb file. The eval is done once as the Ruby class files are cached in memory during production mode. The next problem is getting the key in to Ruby. I did this by having a Rake task that puts it in to a specific named file in /tmp which is then read by my class (during a call in preinitializer.rb) and deleted. It's not ideal, but it works for my purpose and would also work for yours. The last step, if you're using Passenger ensure that the last child is never killed off (if it is, it will lose the decryption key which is now only in memory). I can't remember the setting but there's a timeout setting which you can set to zero so the last child never dies. I would however, recommend against doing this - server security and not giving out the username/password is far and away the best solution. I work in a specific industry in a country with a lot of security requirements so had no choice - but it's a solution and something I wished I never had to write ;-) Cheers, Andy -- 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.
Re: [Rails] problem finding find current page
On 29 June 2010 11:00, Neil Bye wrote: > I have this bit of code in my email.controller > > user = @current_user > story = @current_story > recipient = story.user > > It doesn't work because @current_story isn't defined. How can I find the > current page to make this work? You haven't given anywhere enough detail for us to help you. @current_story - what are you expecting this variable to contain? Saying "the current page" won't help. Do you mean the current URL (@request.request_uri)? The current Page object (in which case you must have found the Page object using some code, assign that to @current_story. A variable from the session? @current_story = session[:current_story]. We need a lot more information to be able to help. @current_story is an instance variable, but there's no information on what you're expecting it to magically contain. Cheers, Andy -- 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.
Re: [Rails] (JOBS) Junior Rails Developer, London, UK
We're actually looking for currently UK located developers. Thanks anyway, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 26 June 2010 08:21, ratnamraj varasala wrote: > Hai Andy, > > This is Raju from india im Ruby on Rails Developer and as well as System > Administrator also from past two years, i have work experience in ROR 1/2 > years now im deal both ROR development and System Admin. > > Andy i have a doubt, im clear about your offer, i.e., remote working or > relocate can i know clear about your offer plz > > thanks & regards > > Raju > > On Fri, Jun 25, 2010 at 4:27 PM, Andy Jeffries wrote: > >> The company I'm contracting at is looking for: >> >> An enthusiastic, junior Ruby on Rails developer. Maybe you've been using >> PHP for a few years and have recently started playing with Rails or you've >> been using Rails for a while but only in a small/sideline capacity and want >> to move up to using it in a professional environment on high transaction >> sports betting sites. >> >> We're looking for someone that knows the buzzwords - HTML, CSS, jQuery, >> JSON, Rails, RSpec, etc but hasn't necessarily had a chance to learn them >> fully or use them "in anger". We'll start you off easy and bring you up to >> speed working on a major Rails site, helping you learn along the way. >> >> We're looking for enthusiasm and drive, with a little bit of Rails rather >> than lots of experience - recent/upcoming graduates that have played with >> Rails part time would be perfect. >> >> If you want a chance to switch or having been using Rails for a while >> but haven't been able to prove yourself, get in touch. >> >> * No telecommuting >> * Salary is early to late £20Ks depending on experience. >> >> Cheers, >> >> >> Andy >> >> -- >> 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. >> > > -- > 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. > -- 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] (JOBS) Junior Rails Developer, London, UK
The company I'm contracting at is looking for: An enthusiastic, junior Ruby on Rails developer. Maybe you've been using PHP for a few years and have recently started playing with Rails or you've been using Rails for a while but only in a small/sideline capacity and want to move up to using it in a professional environment on high transaction sports betting sites. We're looking for someone that knows the buzzwords - HTML, CSS, jQuery, JSON, Rails, RSpec, etc but hasn't necessarily had a chance to learn them fully or use them "in anger". We'll start you off easy and bring you up to speed working on a major Rails site, helping you learn along the way. We're looking for enthusiasm and drive, with a little bit of Rails rather than lots of experience - recent/upcoming graduates that have played with Rails part time would be perfect. If you want a chance to switch or having been using Rails for a while but haven't been able to prove yourself, get in touch. * No telecommuting * Salary is early to late £20Ks depending on experience. Cheers, Andy -- 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.
Re: [Rails] Re: Mac and Rails
> > > Use Apache locally too. It's simple, Apache is already installed on > > Snow > > Leopard. Install Passenger and configure it (which you'll need to learn > > how > > to do for production anyway). > > What a waste of effort IMHO. I've never used anything but Mongrel > locally. It works fine n > What effort? It's 4 lines of typing to get Passenger installed: gem install passenger passenger-install-apache2-module (copy the suggested lines and paste into...) mate /etc/apache2/httpd.conf sudo apachectl restart Download the Passenger Preferences Pane ( http://github.com/alloy/passengerpane/downloads) to be able to set up new sites easily using a GUI. Much easier than setting up Mongrel as a daemon to serve multiple sites in the background. How do you set up Mongrel that's easier (from scratch) than the above? I'm assuming you're not just working on a single Rails site and just do "rails s" or "script/server" when you need it up (I have locally running websites available all the time). Cheers, Andy -- 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.
Re: [Rails] Need Help - New to RoR
Look in your log file (your_app/log/*.log) - the error will be detailed in there. Also, it seems from the error message you're running in production mode, you should really switch to development then you'd see the full error message in your browser. Cheers, Andy -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 16 June 2010 21:48, Sangeetha wrote: > Hello All, > > I installed Ruby on Windows (using rubyinstaller-1.9.1-p378.exe from > here - http://rubyforge.org/frs/?group_id=167). > Then I ran gem install rails. > > I was following instructions here -http://oreilly.com/pub/a/ruby/ > archive/rails.html?page=1 to create my first app. > I was able to start the server and see the first page. > > When I click on "About you application's environment" link, I get the > following message. > > We're sorry, but something went wrong. We've been notified about this > issue and we'll take a look at it shortly. > > I get the same message when I generate a new controller and try to > access that on the URL. > > Any idea what is wrong? > > Thank you > Sangeetha > > -- > 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. > > -- 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.
Re: [Rails] Off Topic Advice Needed (Time objects)
> > If you have two floating point values representing seconds (and parts of) >> why can't you just compare the two floating point values? >> >> What part are you stuck with? Can you give us some code with a comment on >> which bit you can't do. >> > >> I don't have a problem with comparing floats, but I might need to find the > 10 closest times to the actual event time and 4 of those times could be less > than the actual event time and 6 could be higher. > > I don't mind rolling my own and am quite looking forward to it, but I don't > want to re-invent the proverbial wheel. > This seems a fairly simple wheel to be worried about re-inventing though (or even to look forward to). OK, so you have an array of times. You sort through them based on: (predicted_time - actual_time).abs and pick the smallest 10 items. Cheers, Andy -- 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.
Re: [Rails] Off Topic Advice Needed (Time objects)
> > These values are then converted to seconds and stored as decimal in the DB > (I allow fractions of a second, too (tenth, hundredth, millisecond). when > they are retrieved form the DB, I convert the seconds to a string format of, > for example, 01:39:11 (from 5951 seconds). If fractions are used, they are > just appended to the string. (non of this is elegant IMO) > > That's all done in my Converter class. I am going to write a Calculator > class to compare all times entered for an event and picking the closest > times to how long the actual event took. > > So my question is, I know I can't use a Time object but it would be really > nice to know if there is something out there that could help me with this as > to write my own Calculator is going to be a bit of a pain. > If you have two floating point values representing seconds (and parts of) why can't you just compare the two floating point values? What part are you stuck with? Can you give us some code with a comment on which bit you can't do. Andy -- 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.
Re: [Rails] Mac and Rails
> > I have been just tasked to learn Rails for a new project and have been > given Mac machine for it. I have never used a Mac / Linux ever. I have > used Rails before on Windows. I need to set up Rails development env > on this Mac machine. Its Mac OS X - Snow Leopard. The development > environment needs Rails 2.3.5, GIT client and MySQL. We are still > swaying between using Mongreal or Apache locally, because the > production will be in Apache. > Use Apache locally too. It's simple, Apache is already installed on Snow Leopard. Install Passenger and configure it (which you'll need to learn how to do for production anyway). Update your gems on Snow Leopard (as Rails is also already installed on Snow Leopard) and away you go. > Can someone advise what the best practices, best tools, editors, etc > to set up Rails development env locally on a Mac? Apologize for the v > basic question. :-) > As I said, you already have Rails and Apache ready to go. You need to install MySQL (or use sqlite in development) and that's it. I personally use TextMate, but RubyMine looks awesome if you don't mind the lag for Java-based IDEs to start up. Cheers, Andy -- 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.
Re: [Rails] How to specify which database we're using?
rake db:seed RAILS_ENV=test -- Andy Jeffries http://andyjeffries.co.uk/ #rubyonrails #mysql #jquery Registered address: 64 Sish Lane, Stevenage, Herts, SG1 3LS Company number: 5452840 On 4 June 2010 15:31, Ramos wrote: > I am seeding my environment for testing, but I am doing it upon my > development environment, and in fact I'd like to seed my test > environment... > > 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-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. > > -- 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.