Re: [Rails] Re: Use of :include option in find query
The queries will likely be the same.. but you should check to see if it loaded the company details _before_ you called @user.company. You might try the following from script/console while tailing the log file in another terminal. ruby script/console = User.find(2) ... check the log/development.log = User.find(2, :include = :company) check log/development.log Good luck! Cheers, Robby On Tue, Aug 10, 2010 at 10:21 PM, Mike Disuza li...@ruby-forum.com wrote: Hi I have written code like this 1) Without :include My code is :- def user_details �...@user=user.find(params[:id]) �...@company=@user.company end Log Output:- Processing UsersController#user_details (for 127.0.0.1 at 2010-08-11 10:51:34) [GET] Parameters: {id=2} User Columns (1.0ms) SHOW FIELDS FROM `users` User Load (0.4ms) SELECT * FROM `users` WHERE (`users`.`id` = 2) Company Load (0.4ms) SELECT * FROM `companies` WHERE (`companies`.user_id = 2) LIMIT 1 Rendering template within layouts/users Rendering users/user_details Completed in 65ms (View: 48, DB: 2) | 200 OK [http://localhost/user_xml?id=2] 2) With Include:- def user_details �...@user=user.find(params[:id], :include=:company) �...@company=@user.company end Log Output:- Processing UsersController#user_details (for 127.0.0.1 at 2010-08-11 10:53:13) [GET] Parameters: {id=2} User Columns (1.2ms) SHOW FIELDS FROM `users` User Load (0.5ms) SELECT * FROM `users` WHERE (`users`.`id` = 2) Company Load (0.3ms) SELECT * FROM `companies` WHERE (`companies`.user_id = 2) LIMIT 1 Rendering template within layouts/users Rendering users/user_details Completed in 13ms (View: 2, DB: 2) | 200 OK [http://localhost/user_xml?id=2] If you look at the both o/p there is a query on company table in both the cases. What is the difference? Thanks, Mike -- 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.
[Rails] Re: Help on Route
Tony Yin wrote: Anubhaw Prakash wrote: Try this, map.resources :controller_name, :collection = { :method_name = :get } Thanks, Anubhaw hi Anubhaw, thanks for the reply, but that did not work. When I put that in my routes.rb, I lost home index; but I can view index from localhost:3000/site. But when I try to view localhost:3000/about it gives me an error message Unknown action No action responded to show. Actions: about, help, and index So it appears something is not connecting, even though I specified the action name and the action is defined in my controller. Hi Tony, Site is your controller name. If you need to access a method from controller, the url should be like this 'localhost:3000/site/about'. When you hit 'localhost:3000/site' the actual url is 'localhost:3000/site/index'. So in link to you need to specify controller name and action name. If you need the url like localhost:3000/about, you need to specify following in route:- map.connect '/about', :controller = 'site', :action = 'about'. Thanks, Anubhaw -- 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: Paperclip Trouble - Not Writing to the Database
Parker Selbert wrote: There is a duality to Paperclip in that it is meant to process anything, but the default processor (Thumbnail) is for images. I'm guessing the versatility of it is why it doesn't do a hard check for ImageMagick before it tries to process anything. As far as the Paperclip Processor knows the command just fails, and therefor processing fails, and therefore there is no image to link to. I highly recommend writing a test that just checks that the path you're using for ImageMagick exists. Something as simple as: IMAGE_MAGICK_PATH = /my/path/to/imagemagick def test_image_magick_is_installed assert File.exist?(IMAGE_MAGICK_PATH) end At least then you know that your install is working. Well I tried that, and it comes back false... The error messages give the right path for ImageMagick, but they still fail on the identify command. I've tested identify from the command line, and it works fine. I'm pretty lost as to what to do now, Paperclip seems to understand there's ImageMagick in Program Files, they just don't want to talk to each other. The images do get to a temp location in Local Settings\Temp, so some moving around is happening. Honestly, I'm just trying to get files uploaded in general, I'm only testing it on images because that's what all the guides are for and I wanted to have something working before I generalized. This is getting a lot more problematic than I expected. I guess the next thing to do is go to the Paperclip Google Group and see if they know anything. -- 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] Error in Rails 3 Release notes
I hope the fact that you see config.something did ring a bell that the setting has been moved to environment.rb and doesn't belong into a controller anymore. On 10 Aug 2010, at 20:13, Dorian wrote: There is : filter_parameter_logging is deprecated in favour of config.filter_parameters :password. but this don't work : and config.filter_parameters :password work, so there is an error ? http://edgeguides.rubyonrails.org/3_0_release_notes.html#action-controller Best regards Peter De Berdt -- 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 do I optimize this query?
Sprite, I propose a small change. Add a space between the sql_query string and the @top_tippers variable (for readability sake): def top_tippers sql_query = SELECT top_tippers.total_tips AS total_tips, top_tippers.client_id AS client_id, users.login_slug AS login_slug, users.login AS login FROM ( SELECT SUM(tips.amount_cents) AS total_tips, tips.client_id AS client_id FROM tips WHERE tips.vendor_id = #{self.id} GROUP BY tips.client_id ORDER BY total_tips DESC) AS top_tippers, users WHERE top_tippers.client_id = users.id @top_tippers = User.find_by_sql(sql_query) end And this blog post may be helpful too as you code: Top 10 Things That Annoy Programmershttp://www.kevinwilliampang.com/2008/08/28/top-10-things-that-annoy-programmers/ . Regards, --- Edmond Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) | Malawi Cell: +265 999 465 137 | +265 881 234 717 *Many people doubt open source software and probably don’t realize that there is an alternative… which is just as good.. -- Kevin Scannell* -- 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 3.0 and counter_cache error
Hello, I'm working on a rails 3.0 project and today I tried to add a counter cache column, but I keep getting this error: ArgumentError: Unknown key(s): counter_cache This happens with any combinations of rails 3.0 beta4, rc, ruby 1.8.7 and 1.9.2. Regards Andrea -- 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] script/console history
When you quit script/console you lose your command history. What would it take to get get that command history to persist? I wouldn't mind working on it if somebody had a good suggestion as to how to achieve that and if it was an acceptable solution to the core team. Cheers, D :) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Redirect loop
I have one record in a database that is encountering a redirect loop. When I point my browser to www.sitenamehere.co.uk/case_studies/1, it displays a redirect loop error message. When I point my browser to www.sitenamehere.co.uk/case_studies/2, it does not. Now, when I point my browser to www.sitenamehere.co.uk/case_studies/show/1, no error occurs and the page is displayed exactly as it should. Also, when I point my browser to www.sitenamehere.co.uk/case_studies/show/2, no error occurs and the page is displayed exactly as it should. What is the problem here? My routes are set up correctly when I review the output of rake routes. If there's any code you need, please ask. However, I assume someone has encountered this before. -- 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] Help geting started
Hi I am reading O'Reilly Rails Cookbook, but I can not get the examples working. Here is what I have done so far: rails mytest --database=mysql ruby script/generate migration build_db --BuildDb class-- class BuildDb ActiveRecord::Migration def self.up create_table :schedules, :force = true do |t| t.column :scheduleTime, :datetime t.column :repeatEveryYear, :boolean t.column :message, :string t.timestamps end end def self.down drop_table :schedules end end --BuildDb class-- rake db:migrate ruby script/generate model schedules (generates a new empty migration, I deleted it) ruby script/generate controller schedules Edited my controller, and added: scaffold :schedules But when I try to test my application, the mongrel log gives me this: Wed Aug 11 12:06:10 +0200 2010: Error calling Dispatcher.dispatch #NoMethodError: You have a nil object when you didn't expect it! You might have expected an instance of Array. The error occurred while evaluating nil.split /Users/sneigaard/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/ action_controller/cgi_process.rb:52:in `dispatch_cgi' /Users/sneigaard/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/ action_controller/dispatcher.rb:101:in `dispatch_cgi' /Users/sneigaard/.gem/ruby/1.8/gems/actionpack-2.3.8/lib/ action_controller/dispatcher.rb:27:in `dispatch' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb: 76:in `process' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb: 74:in `synchronize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb: 74:in `process' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:159:in `process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:158:in `process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:285:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel.rb:268:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ configurator.rb:282:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ configurator.rb:281:in `each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ configurator.rb:281:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/ command.rb:212:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /usr/bin/mongrel_rails:19:in `load' /usr/bin/mongrel_rails:19 Hm well should this not work? Thank you Søren -- 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: Re: link_to underlying urls/paths are showing in the actual view
The path is showing up in my links too. Tried Safari and FireFox. Did you find a solution to this problem? /landge Matt Royer wrote: Thanks for the tips Colin and Anand... Neither corrected the issue. I'm going to see if I can do this from another system. I'm wondering if my installation is jacked up or something. I'll post again and let everyone know what i've found. I'm on my system at work, so am limited by what I can do. I'll try this from home and see what I come up with. Thanks again for the suggestions! --Matt -- 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] Help geting started
On 11 August 2010 11:13, neigaard sneiga...@gmail.com wrote: Hi I am reading O'Reilly Rails Cookbook, but I can not get the examples working. That's not really a beginners tutorial book - it's more for reference on how to deal with specific problems. You may be better off with a book like Agile Web Development With Rails, which does take you through from first principles. Also, I'm not sure how up-to-date the Cookbook is (mine's for Rails 1.2 I think!), and it looks like you're running 2.3.8, so that may be part of the problems you're having. -- 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: Help geting started
neigaard wrote: Hi I am reading O'Reilly Rails Cookbook, but I can not get the examples working. Here is what I have done so far: rails mytest --database=mysql Maybe you should start Rails learning by following 'http://guides.rubyonrails.org/' site. Thanks, Anubhaw -- 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] script/console history
Third Replicator, If you are using some Linux system then you are safe. I use Ubuntu myself. I was tied of rewriting everything I put on the console too. So I with some little effort and help from friends, I made a small hack. Now, I have a simple script that helps me keep track of command-line history for both *irb * and *script/console*. Follow the steps below: - *create* *.irbrc* file in your home directory : ceek...@kanjedza:~$ touch .irbrc - *open* *.irbrc* using your preferred text editor (I prefer command-line based ones: *vi, vim, gvim*), *add* the following lines and* save*: *# This script saves and retrieves up to 600 lines of # command-line history in both irb and script/console # of a **Rails's project. (UP and DOWN ARROW keys to navigate) # In addition, it supports auto-completion.(Use the # TAB key to get auto-complete suggestions).* *# * *# :SAVE_HISTORY keeps the maximum number of lines to be saved # customize this to suite the amount of history would # like to retrieve # # :HISTORY_FILE keeps the file name where the # history is kept. In this case it is saved in the # home directory of the current user # i.e in the same directory where as this .irbrc file * ARGV.concat [ --readline, --prompt-mode, simple ] require 'irb/completion' require 'irb/ext/save-history' require 'rubygems' require 'map_by_method' require 'wirble' require 'pp' IRB.conf[:AUTO_INDENT]= true IRB.conf[:SAVE_HISTORY] = 600 IRB.conf[:HISTORY_FILE] = #{ENV['HOME']}/.irb-save-history Wirble.init Wirble.colorize Once you have this, you will be able to retrieve script/console's command-line history up to 600 lines. Please inform me if doesn't work. I would be very happy to get as much input as possible. I think *Sprite* will also find this useful. * P/S: I am not sure if I have violated the forum rules by adding an attachment. If so, forgive me and inform me how best I can send files through.* Regards, --- Edmond Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) | Malawi Cell: +265 999 465 137 | +265 881 234 717 *Many people doubt open source software and probably don’t realize that there is an alternative… which is just as good.. -- Kevin Scannell* On 11 August 2010 11:49, Third Replicator thirdreplica...@gmail.com wrote: When you quit script/console you lose your command history. What would it take to get get that command history to persist? I wouldn't mind working on it if somebody had a good suggestion as to how to achieve that and if it was an acceptable solution to the core team. Cheers, D :) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.comrubyonrails-talk%2bunsubscr...@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. .irbrc Description: Binary data
Re: [Rails] script/console history
Very nice! It works on my Mac 10.6, Ruby 1.9.1 via RVM, Rails 2.3.8. I had to install a couple of the required gems. Do you have it on Github? D :) On Wed, Aug 11, 2010 at 3:54 AM, Edmond Kachale edmond.kach...@baobabhealth.org wrote: Third Replicator, If you are using some Linux system then you are safe. I use Ubuntu myself. I was tied of rewriting everything I put on the console too. So I with some little effort and help from friends, I made a small hack. Now, I have a simple script that helps me keep track of command-line history for both irb and script/console. Follow the steps below: create .irbrc file in your home directory : ceek...@kanjedza:~$ touch .irbrc open .irbrc using your preferred text editor (I prefer command-line based ones: vi, vim, gvim), add the following lines and save: # This script saves and retrieves up to 600 lines of # command-line history in both irb and script/console # of a Rails's project. (UP and DOWN ARROW keys to navigate) # In addition, it supports auto-completion.(Use the # TAB key to get auto-complete suggestions). # # :SAVE_HISTORY keeps the maximum number of lines to be saved # customize this to suite the amount of history would # like to retrieve # # :HISTORY_FILE keeps the file name where the # history is kept. In this case it is saved in the # home directory of the current user # i.e in the same directory where as this .irbrc file ARGV.concat [ --readline, --prompt-mode, simple ] require 'irb/completion' require 'irb/ext/save-history' require 'rubygems' require 'map_by_method' require 'wirble' require 'pp' IRB.conf[:AUTO_INDENT]= true IRB.conf[:SAVE_HISTORY] = 600 IRB.conf[:HISTORY_FILE] = #{ENV['HOME']}/.irb-save-history Wirble.init Wirble.colorize Once you have this, you will be able to retrieve script/console's command-line history up to 600 lines. Please inform me if doesn't work. I would be very happy to get as much input as possible. I think Sprite will also find this useful. P/S: I am not sure if I have violated the forum rules by adding an attachment. If so, forgive me and inform me how best I can send files through. Regards, --- Edmond Software Developer | Baobab Health Trust (http://www.baobabhealth.org/) | Malawi Cell: +265 999 465 137 | +265 881 234 717 Many people doubt open source software and probably don’t realize that there is an alternative… which is just as good.. -- Kevin Scannell On 11 August 2010 11:49, Third Replicator thirdreplica...@gmail.com wrote: When you quit script/console you lose your command history. What would it take to get get that command history to persist? I wouldn't mind working on it if somebody had a good suggestion as to how to achieve that and if it was an acceptable solution to the core team. Cheers, D :) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- 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] names and stuff
I'm trying to stuff like this in my BabyName model.. before_save :capitalize def capitalize self.title= title.capitalize self.forename = forename.capitalize self.surname = surname.capitalize self.middlenames = middlenames.split.each { |x| print x.capitalize!, }.join( ) end def full_name self.title + + self.forename + + self.middlenames + + self.surname end def initials end # two things; 1) my full_name method doens't seem great in that I might get two spaces between names. 2) how do I grab the initials method ? -- 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] An implementation level question
Hi I have a message model and message_participants table. message_participants table because same message goes to various recipients. Messaging between either company to users OR user to company. So an initial design of tables made like messages table --- +---+--+--+-+-++ | Field | Type | Null | Key | Default | Extra | +---+--+--+-+-++ | id| int(11) | NO | PRI | NULL| auto_increment | | subject | varchar(255) | YES | | NULL|| | message_thread_id | int(11) | YES | | NULL|| | message | text | YES | | NULL|| | company_id| int(11) | YES | | NULL|| +---+--+--+-+-++ message_participants table +---+--+--+-+-++ | Field | Type | Null | Key | Default | Extra | +---+--+--+-+-++ | id| int(11) | NO | PRI | NULL| auto_increment | | direction_in | tinyint(1) | YES | | NULL|| | direction_out | tinyint(1) | YES | | NULL|| | type | varchar(255) | YES | | NULL|| | company_id| int(11) | YES | | NULL|| | user_id | int(11) | YES | | NULL|| | message_id| int(11) | YES | | NULL|| +---+--+--+-+-++ Here about 'type' field I am not sure. My question is should I treat message_participants like STI or polymorphic? I can't decide it. Relation is message has_many message_participants message_participants belongs_to message Please guide Thanks Tom -- 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] keeping file field if error
hi, i'm doing a plugin for upload files, but after upload i have to validate some fields and if don't pass de validation come back to the create page keeping the introduced dates, so the user can change the wrongs date without itroduce all again, my problem is that i can keep all the dates less the file, and i'd like keep it too, any idea? the code of the controller for keep dates: def new @document = AlfrescoDocument.new(params[:document]) @document.project_id = @project.id @edit_metadata = false @file=Tempfile.new(params[:file]) @metadata = AlfrescoMetadata.new(params[:metadata]) . and in the view the file is loaded with: p label%=l(:label_attachment)%span class=required*/label %= file_field_tag 'file', :size = 30, :id = nil -% /p thanks. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Paperclip Trouble - Not Writing to the Database
A. Leek wrote: Well I tried that, and it comes back false... The error messages give the right path for ImageMagick, but they still fail on the identify command. I've tested identify from the command line, and it works fine. I'm pretty lost as to what to do now, Paperclip seems to understand there's ImageMagick in Program Files, they just don't want to talk to each other. Ah, I think I see a potential problem. It's actually a pretty common thing in Windows development using Perl, Ruby etc. When you're using the shell Windows will handle the PATH including Program Files as Program\ Files without you having to do anything. When Paperclip tries to run the command through Ruby your request gets broken up at the space between Program Files, and it is shown as two different commands: C:\Program Files\ImageMagick\imagemagick.exe Or something to that effect. If it isn't happening with Program Files it could just as easily by happening with your temporary content, which also has a space in the path: identify C:\Local Settings\Temp\crazyfilename,0,1.jpg The images do get to a temp location in Local Settings\Temp, so some moving around is happening. Honestly, I'm just trying to get files uploaded in general, I'm only testing it on images because that's what all the guides are for and I wanted to have something working before I generalized. This is getting a lot more problematic than I expected. I guess the next thing to do is go to the Paperclip Google Group and see if they know anything. Stick with it, in the end it really does make things easier. Keep in mind that all of these libraries aren't developed with WIndows in mind and you'll really have to compensate. If possible pretend your system is *nix, keep your installs in C:\lib or C:\bin and remove the path issues. -- 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: Starting Mongrel failes on Mac OS 10.6
Gregor gregor.mit...@... writes: On 2 Jun., 02:10, Hassan Schroeder hassan.schroe...@... wrote: On Tue, Jun 1, 2010 at 4:38 PM, Gregor gregor.mit...@... wrote: Sorry for that, but first I gone the wrong way and after some hours I noticed how easy it is to install rails.. I use the command ruby script/server. How do I see if webrick starts? prompt% script/server webrick Output of gem list --local: actionmailer (2.3.8) actionpack (2.3.8) activerecord (2.3.8, 2.3.4) activeresource (2.3.8) activesupport (2.3.8, 2.3.4, 2.2.3) Whatever wrong way you started out with, you might want to just `sudo gem uninstall rails` completely, and then re-install it. Did you create your test project before or after you installed the 2.3.8 version of Rails? -- Hassan Schroeder hassan.schroe...@... twitter: @hassan Yeah, I re-installed rails and it doesn't work at all. The project was created after installing version 2.3.8 and it's a riddle to me, why there are different versions of some packages. I am having the same problem on on Ubuntu. Did you find a solution? script/server fails with = Booting Mongrel = Rails 2.3.8 application starting on http://0.0.0.0:3000 = Call with -d to detach = Ctrl-C to shutdown server Exiting /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/mongrel.rb:10:in `initialize': wrong number of arguments (5 for 4) (ArgumentError) While script/server webrick works fine. cheers, Morten -- 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] my final year project.
Hallo there, i'm currently doing my final year project and currently in my final year and 2 more semesters to go in my local university. my lecturer told me that i can choose a language to build a web app on my own. since ROR is new to most of us and i read news how easy it is to use ruby to built apps from various sources. but i'm still wondering where is a good start to learn ROR. my back ground is that i did some lessons on php. and my last project of php involves me to built a system to manage students who lives in the hostel. in short. my FYP requires me to built a system that can manage a shop that only sells toilet bowl and sink, plus possible franchise branching. hahah, this project its so funny that i took the project in request... but soon know that its not just a small fish that i can swallow peacefully. here's what i can imagine so far, my system need to be able to record new stock and record it like a stock keeper do and register new model if its so new that this is the companies latest model with a picture. the management need to set price for the different models that they got. than if some one buys a few toilet bowl. my system need to be able to deduct the stock and come out a delivery order for the stock keeper. the casher need to be able to print an invoice if the buyer pays by cheque Or print a receipt if buyer pays by cash. and all print have letter head attached to it page by page. then heres another part of the system that can check which branch have stock for a certain model of toilet bowl or give a summery on the stock on different branches. i'm given 8 months to complete this project. but i don't think i need 2 months to complete this project so that i have more time fooling my self on other subjects or do more part time job in mc D to pay my fees . 1.my question is, can i built this system using ROR? i can imagine building it using php. but i really want to learn ROR 2.hmm... i was wondering if i print a receipt, if the item list got so long, my printer will split the page in two, where the header will be print at the first page and no header on the next page. and the length of the page is inconsistent if the item list differs.. how do i overcome this? i can imagine that the company have already have a header printed on the paper first then set the margin for the printer to avoid printing on the header. but, i don't think this will amaze my lecturer. 3.can anyone send me a link where's the best place to read so that i can learn more about ROR? -- 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] Help geting started
On 08/11/2010 12:13 PM, neigaard wrote: Hi I am reading O'Reilly Rails Cookbook, but I can not get the examples working. Here is what I have done so far: Hey, I also just started learning rails. First I've read The well grounded Rubyist to learn the language itself and now I'm reading Agile Web Development with Rails. Cheers, Jan -- 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] my final year project.
On 11 Aug 2010, at 12:26, psyionx wrote: 1.my question is, can i built this system using ROR? i can imagine building it using php. but i really want to learn ROR Remember that RoR is a framework and not a language. Compare it to CodeIgniter, CakePHP, Symphony in the PHP space. As to your question: yes, RoR can do that. In fact, your whole project description is a class example of an MVC based application. If you have worked with unit and integration tests before in the course of your education, I would recommend using a BDD or TDD approach for your Rails app right away. 2.hmm... i was wondering if i print a receipt, if the item list got so long, my printer will split the page in two, where the header will be print at the first page and no header on the next page. and the length of the page is inconsistent if the item list differs.. how do i overcome this? i can imagine that the company have already have a header printed on the paper first then set the margin for the printer to avoid printing on the header. but, i don't think this will amaze my lecturer. Generate a PDF instead. I would recommend PrinceXML, which you can just use in demo mode since it's just a school project. PrinceXML allows you to generate a PDF from HTML+CSS, including all the cases with headers and footers you correctly indicated as problematic with just an HTML print. 3.can anyone send me a link where's the best place to read so that i can learn more about ROR? http://guides.rubyonrails.org/ http://peepcode.com/products/test-first-development Just google around, there's plenty of Rails related resources out there. Best regards Peter De Berdt -- 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] Redirect loop
On Wed, Aug 11, 2010 at 06:03, Pale Horse li...@ruby-forum.com wrote: I have one record in a database that is encountering a redirect loop. So what's different about that record? I'd bet it includes or references some resource that's the problem. -Dave -- Specialization is for insects. -RAH | Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: http://dare2xl.com | Play: http://davearonson.net * * * * * WATCH THIS SPACE * * * * * | Ruby: http://mars.groupsite.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: An implementation level question
Tom Mac wrote: Hi I have a message model and message_participants table. message_participants table because same message goes to various recipients. Messaging between either company to users OR user to company. [...] Here about 'type' field I am not sure. My question is should I treat message_participants like STI or polymorphic? I can't decide it. STI: single-table *inheritance*. Does User inherit from Company, or Company from User? Probably not. So no inheritance is involved, and you probably want a polymorphic association. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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: names and stuff
On Aug 11, 7:18 am, bingo bob li...@ruby-forum.com wrote: I'm trying to stuff like this in my BabyName model.. before_save :capitalize def capitalize self.title = title.capitalize self.forename = forename.capitalize self.surname = surname.capitalize self.middlenames = middlenames.split.each { |x| print x.capitalize!, }.join( ) end def full_name self.title + + self.forename + + self.middlenames + + self.surname end def initials end # two things; 1) my full_name method doens't seem great in that I might get two spaces between names. You could build an array with all the components, remove any blanks or nils and then use join on all that 2) how do I grab the initials method ? as in how to write it ? forename surname should be straightforward, for middlenames you could just split on spaces and then take the first letter of each component Fred -- 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: Redirect loop
Dave Aronson wrote: On Wed, Aug 11, 2010 at 06:03, Pale Horse li...@ruby-forum.com wrote: I have one record in a database that is encountering a redirect loop. So what's different about that record? I'd bet it includes or references some resource that's the problem. -Dave -- Specialization is for insects. -RAH �| Have Pun, Will Babble! -me Programming Blog: http://codosaur.us | Work: http://davearonson.com Leadership Blog: �http://dare2xl.com | Play: http://davearonson.net * * * * * WATCH THIS SPACE * * * * * | Ruby: http://mars.groupsite.com Surely if that were true, it'd error when I pass in the 'show' action into the URL? -- 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: Redirect loop
Pale Horse wrote: Dave Aronson wrote: On Wed, Aug 11, 2010 at 06:03, Pale Horse li...@ruby-forum.com wrote: I have one record in a database that is encountering a redirect loop. So what's different about that record? I'd bet it includes or references some resource that's the problem. -Dave -- [...] Surely if that were true, it'd error when I pass in the 'show' action into the URL? That depends on how your routes are set up. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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: Paperclip Trouble - Not Writing to the Database
Parker Selbert wrote: [...] Keep in mind that all of these libraries aren't developed with WIndows in mind and you'll really have to compensate. If possible pretend your system is *nix, keep your installs in C:\lib or C:\bin and remove the path issues. Or don't pretend. Rails development on Windows is problematic, from all the info I have (note: I don't use Windows myself). So if you can't get your hands on a Mac or other *nix system, at least install a *nix VM (Virtual Rails has been making a splash lately). Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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: Redirect loop
On Aug 11, 6:03 am, Pale Horse li...@ruby-forum.com wrote: What is the problem here? My routes are set up correctly when I review the output of rake routes. Look at your log files to see where the browser is being redirected by what bit of your code Fred If there's any code you need, please ask. However, I assume someone has encountered this before. -- 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: reload is using a cache and i dont want it to be
Josh Sharpe wrote: class PendingOrder ActiveRecord::Base def sleep_until_processed sleep 0.5 while !processed? reload sleep 0.25 end end end Aug 10 19:43:38 prod-app1 foo[31608]: PendingOrder Load (0.6ms) SELECT * FROM `pending_orders` LIMIT 1 Aug 10 19:43:39 prod-app1 foo[31496]: CACHE (0.0ms) SELECT * FROM `pending_orders` WHERE (`pending_orders`.`id` = 221) So the first query is legit -- but second query is cached, and so forth. Every subsequent query ends up being a cached value, forever. How can I make the above method *not* look at a cache? Not forever! Subsequent queries are cached until an update changes the underlying data. Isn't it good to read from the cache if the underlying database hasn't changed? I am assuming that processed? reads from a column in your pending_orders table. If something in your application changes that value then the query cache should be cleared automatically. However, if that database change were to happen outside of your Rails application I could see that your code could end up blocking forever. In any case I would recommend adding some circuit breaker code to your method to prevent blocking forever. Maybe some sort of timeout/watchdog to limit the amount of time this method could block. -- 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] what's with the snowman?
what's with the snowman in forms? div style=margin:0;padding:0;display:inline input name=_snowman type=hidden value=☃ input name=authenticity_token type=hidden value=DOw4is1mrktdfQqm6HMUSmeSDTC73BGqt1z0OwDwsbU= /div mirek rusin -- 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: reload is using a cache and i dont want it to be
Josh Sharpe wrote: class PendingOrder ActiveRecord::Base def sleep_until_processed sleep 0.5 while !processed? reload sleep 0.25 end end end Robert Walker wrote: In any case I would recommend adding some circuit breaker code to your method to prevent blocking forever. Maybe some sort of timeout/watchdog to limit the amount of time this method could block. And, if your Rails application is single treaded then your sleep_until_processed method could block your entire Rails application never allowing other parts of the application to perform the work necessary to update the pending_orders table. Maybe you should consider offloading this work to a background process using something like delayed_job or similar. -- 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: what's with the snowman?
Mirek Rusin wrote: what's with the snowman in forms? div style=margin:0;padding:0;display:inline input name=_snowman type=hidden value=☃ input name=authenticity_token type=hidden value=DOw4is1mrktdfQqm6HMUSmeSDTC73BGqt1z0OwDwsbU= /div mirek rusin http://railssnowman.info/ -- 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: reload is using a cache and i dont want it to be
Frederick Cheung wrote: On Aug 11, 11:07�am, Robert Walker li...@ruby-forum.com wrote: I am assuming that processed? reads from a column in your pending_orders table. If something in your application changes that value then the query cache should be cleared automatically. However, if that database change were to happen outside of your Rails application I could see that your code could end up blocking forever. It's more than that - the cache is in memory, so the cache won't be cleared if a different rails instances touches the data I actually misstated that, sorry. I should have said anything outside the current Rails instance (including other Rails instances). Thanks Frederick for the clarification. And also for the uncached solution. I wasn't actually aware of that, but it's definitely good to know. -- 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: my final year project.
On Aug 11, 8:52 am, Peter De Berdt peter.de.be...@pandora.be wrote: On 11 Aug 2010, at 12:26, psyionx wrote: 1.my question is, can i built this system using ROR? i can imagine building it using php. but i really want to learn ROR Remember that RoR is a framework and not a language. Compare it to CodeIgniter, CakePHP, Symphony in the PHP space. As to your question: yes, RoR can do that. In fact, your whole project description is a class example of an MVC based application. If you have worked with unit and integration tests before in the course of your education, I would recommend using a BDD or TDD approach for your Rails app right away. 2.hmm... i was wondering if i print a receipt, if the item list got so long, my printer will split the page in two, where the header will be print at the first page and no header on the next page. and the length of the page is inconsistent if the item list differs.. how do i overcome this? i can imagine that the company have already have a header printed on the paper first then set the margin for the printer to avoid printing on the header. but, i don't think this will amaze my lecturer. Generate a PDF instead. I would recommend PrinceXML, which you can just use in demo mode since it's just a school project. PrinceXML allows you to generate a PDF from HTML+CSS, including all the cases with headers and footers you correctly indicated as problematic with just an HTML print. 3.can anyone send me a link where's the best place to read so that i can learn more about ROR? http://guides.rubyonrails.org/http://peepcode.com/products/test-first-development Just google around, there's plenty of Rails related resources out there. Best regards Peter De Berdt While I agree with much of what Peter said, I have had extensive experience with generating .pdf files, including PrinceXML. The problems which I experienced with PrinceXML were (a) it requires an external step in that you have to generate the .pdf from Prince, based on a file which you created from your ROR application; and (b) you have to manually go into the xml file and escape things like signs. Also, Prince requires that you generate a specific .css file (no big deal, but another step). After playing with various other .pdf generation techniques, I landed on the combination of the Prawn gem and the Prawnto plugin, which allow a seamless integration of your ROR application and .pdf output. As far as the issue of headers at the start of each page, what I do is to simply start each individual item with a NewPage followed by a Header partial. Good luck with your EOY project, and ROR is definitely the way to go. Sandy -- 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] Paperclip generating crap urls on server, works on dev
Hi, I have the following: has_attached_file :data, :styles = {:theora = {:format = ogv}, :still = {:format = jpg}, :small = {:format = jpg}}, :url= /uploads/products/:basename:suffix.:extension, :path = :rails_root/uploads/products/:basename:suffix.:extension Let's say I upload a video called video.mp4, now I want paperclip to generate the url: object.data.url(:still) = /some/url/video.jpg But for some reason on my server, paperclip generates: /some/url/video.mp4 Moreover, if I update code and restart the server, paperclip will correctly generate the .jpg extension the first time, but if I reload the page, it messes up and goes back to .mp4. Everything works fine on my dev machine (mac mongrel+nginx), and this strange behavior only happens on the server (freebsd passenger+nginx). Did anyone experience such weird thing? It's driving me crazy!. -- 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: my final year project.
Fernando Perez wrote: Remember that RoR is a framework and not a language. Compare it to CodeIgniter, CakePHP, Symphony in the PHP space. No RoR is a thing to build websites, as pure php, symphony, and pure ruby do, so it is fair to compare them. It's fair to compare Rails and Symfony. It's fair to compare pure PHP and pure Ruby. That's about it, really. RoR is stuff written in Ruby that avoids writing boiler plate. No, it's much more than that, unless you have a very broad definition of boilerplate. Beware 2 months is certainly no enough to get your app going. Of course it is. The app is very simple, and the OP should be able to get a usable version within 2 months (depending on how long it takes him to learn Ruby and Rails, of course). In real life, a usable blog takes more than 15 minutes to get built. Of course. 15 minutes is not 2 months. Have fun learning and working with Rails. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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: Merb configuration options in rails3
arai wrote: As much fun as it is to type rails s thin -p 1234, I'd rather just use rails s, or even merb. I've spent hours digging through google and various documentation projects trying to figure this out, how can I do this in rails3? Add to ~/.profile (or similar): --- alias merb=rails s thin -p 1234 Then do this to activate the alias: --- source ~/.profile (or simply close the terminal window and open a new one) While not a direct answer this would do precisely what you're asking. I use this technique for a number of things like running ./script/server by typing ss and ./script/console as sc for Rails 2.x. -- 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: (Dreaded) STI, belongs_to
On Aug 10, 2:29 pm, Gaudi Mi li...@ruby-forum.com wrote: Having problems with STI. Names below have been changed to protect the innocent. Imagine a system that allows someone to apply for one of two different types of school scholarships. Each scholarship goes through a different review process, represented by a state machine (this is not a state machine question). So there are two state machine classes that differ slightly and subclass a generic StateMachine: class ScholarshipApplication belongs_to :state_machine end class StateMachine end class StateA StateMachine has_one :application end class StateB StateMachine has_one :application end The problem is I can get a ScholarshipApplication instance to tell me its StateMachine, but the StateMachine can't tell me it's ScholarshipApplication. E.g.: app = ScholarshipApplication.create state = StateA.create app.state_machine = state app.save app.state_machine # returns what it should sm = app.state_machine sm.scholarship_application # throws error: Unknown column scholarship_applications.state_a_id... Passing the :foreign_key option to the has_ones will definitely work. You might also try hoisting the has_one into StateMachine (if that makes sense for your models), as it's guessing the foreign key named based on the class where it's declared (*probably* - I've not poked the source to check this). --Matt Jones -- 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: ActiveRecord::UnknownAttributeError: unknown attribute: script type
On Aug 10, 4:47 pm, Gudleik Rasch gudl...@gmail.com wrote: Could be a bug or even someone trying to inject malicious javascript code into your app. Either case its a good practice to have these kind of scenarios covered by tests. How? It's not really feasible to strip attrs that don't belong from the params... I'd have to query the targeted model for its list of valid params and then reject non-matches. The idiom is to trustingly throw the whole hash at the model - User.create params[:user]. This error doesn't seem to be so much a security risk as just perplexing. Happened again on another action today... random field, unknown attribute: descriptionscript type. Safari only again. You should also make sure that some fields are protected from mass-assignment. In your hash you have is_admin = 0. If you have in your controller: User.create params[:user] # or @user.update_attributes params[:user] Thanks, this has already been done. -- 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: my final year project.
On 11 Aug 2010, at 17:42, Sandy wrote: While I agree with much of what Peter said, I have had extensive experience with generating .pdf files, including PrinceXML. The problems which I experienced with PrinceXML were (a) it requires an external step in that you have to generate the .pdf from Prince, based on a file which you created from your ROR application; If you mean you have to pass on a rendered document to the prince command line utility, then yes. Generate a file... no. Whether you use Princely (http://github.com/mbleigh/princely) or the PDF helper (http://sublog.subimage.com/2007/05/29/html-css-to-pdf-using-ruby-on-rails ), there is no need to generate a file as such. The content is just passed on to the command line utility right away. and (b) you have to manually go into the xml file and escape things like signs. Also, Prince requires that you generate a specific .css file (no big deal, but another step). When you're going from web to print, you'll always end up with a separate styling file, although that can just be basic stuff like overriding background colors, hiding certain elements, defining page size etc in addition to your normal view stylesheet. About the escaping, I've never had that problem, since you will be escaping the HTML in your ERB views anyway (and in Rails 3 it will be done by default). Not using the XML feature, but the HTML - PDF feature though. After playing with various other .pdf generation techniques, I landed on the combination of the Prawn gem and the Prawnto plugin, which allow a seamless integration of your ROR application and .pdf output. As far as the issue of headers at the start of each page, what I do is to simply start each individual item with a NewPage followed by a Header partial. We also looked into all PDF solutions out there. We had to provide our customers with the option to generate their own PDF layouts, including vector images in the header etc. So basically what we have in our application is a module where our customers can use something they are familiar with (they're advertising agencies for the most part), i.e. HTML + CSS, with some Liquid tags sprinkled in, which we then run through the Liquid renderer and pass on to prince, the result is returned to the Rails app right away and streamed to the client, not a single file is generated along the way. Prawn requires you to code the PDF into your app. Whether one likes the syntax is debatable (I for one don't :-)). It's also fairly limited in what it can do and there's tricky involved to achieve some fairly common things, like you mentioned yourself. That said, Prince, Prawn, wicked_pdf, they are all valid options. It all depends on the requirements of your application. PrinceXML is by far the most flexible and most feature rich out of the bunch and will give you the smallest PDF, but it comes with a very hefty price tag. Wicked_pdf (which uses wkhtmltopdf) is free, but when we tried it, it was very unstable and still had a long way to go in terms of features. Prawn is nice because it doesn't use any external applications to render the PDF, but it is very limited compared to the other two imo. I'd say: complex or large documents, especially if they have vector images, high res images or custom fonts, are a Prince thing. Reports or simple documents (possibly the invoice document the original poster talked about) are more of Prawn's territory. Wicked_pdf dangles a bit in between those two, would like to hear about people's experience with it lately. BTW, I'm not an avid supporter of closed source software, but I have to say YesLogic has excellent support and their product is great. Best regards Peter De Berdt -- 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: Locking Images in HTML Files..can use it on ROR also
On Aug 9, 11:52 pm, Jeffrey Bonson li...@ruby-forum.com wrote: Thank you all,for your VALUABLE information. I didn't find what i needed in this forum and many newbies are using this as a reference. That's why i posted this. Why don't u guys prove what u have written with some CODES, so that it becomes useful to OTHERS as well. What exactly are you expecting to accomplish by flaming the list? Regarding your need for C0DEZ!!1!one!!eleven: Uninformed devs like you have been trying this IM IN UR WEBPAGE DISABLING RITECLICK routine since back in the days of Geocities. Guess what? It didn't even work *then*. Would you like me to make a screencast that demonstrates how to disable JS in the browser to prove this? --Matt Jones -- 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: my final year project.
On 11 Aug 2010, at 18:06, Fernando Perez wrote: Remember that RoR is a framework and not a language. Compare it to CodeIgniter, CakePHP, Symphony in the PHP space. No RoR is a thing to build websites, as pure php, symphony, and pure ruby do, so it is fair to compare them. Ruby on Rails is a framework, it even says so on the rubyonrails.org site. It was very fair of me to compare it to PHP frameworks like Symphony, which is basically a very Rails inspired framework for PHP developers. Ruby is a language, as is PHP. They both can do more than serve or generate web pages. RoR is stuff written in Ruby that avoids writing boiler plate. I don't know what you see as boiler plate, but considering the amount of code in Rails, I would hardly say it's some helper functions to build websites with database interaction quicker than from scratch. Rails has a very well defined API, using reusable abstractions and programming patterns to achieve a certain featureset, i.e. build web applications, which by definition is a framework. Beware 2 months is certainly no enough to get your app going. In real life, a usable blog takes more than 15 minutes to get built. It doesn't need to be. Modelwise the project seems to be quite easy, there's only a few scenarios in there that need to be covered and by the description alone you can clearly see the different iterations for the project. The most difficult part about this application is plotting out the database structure and relationships and defining the user scenarios, all of which are totally unrelated to Rails and should be fairly trivial for someone in his final year of... something. Translating them into Rails code is just browsing the API and scratching your head every once in a while and let Google help you out. The dangerous element will be how you will present it to the user and you can go very fancy and get stuck into a very very timeconsuming hell, or you can just make it simple, yet just as powerful. If you have time left, you can then enhance the experience by refactoring some views and sprinkling it with some functional Javascript (i.e. something that enhances the application). Best regards Peter De Berdt -- 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: Paperclip generating crap urls on server, works on dev
Okay so it has to do with caching. On my dev machine, if I switch to production environment I get the same behavior. I don't know what's the solution. -- 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] PDF generation -- was: Re: Re: my final year project.
Peter De Berdt wrote: [...] Prawn requires you to code the PDF into your app. That is not necessarily true. prawn_format generates PDF files from HTML. (I've never used it, so I don't know how well it works, but I'm going to try to switch some PDF views from Prawn code to HTML soon.) [...] BTW, I'm not an avid supporter of closed source software, but I have to say YesLogic has excellent support and their product is great. I've never heard a bad thing about Prince, other than its price tag. Good to know about support; I find that very often, the most expensive software has the worst support. Best regards Peter De Berdt Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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: Understanding this model relationship (possibly a HABTM and a belongs_to ?)
My initial example is probably confusing. Here is another shot at it in something that has more meaning: A User can create multiple “notices” ( eg “Corporate meeting notice”, “Big Sale Items”, “Job Wanted” ) A User can create multiple “notice groups” (eg “Corporate Notices”, “Public Notices”, “My Miscellaneous Notices”) Every notice should belong to an “notice group” A User needs to be able to subscribe to multiple “notice groups” so that they could see the notices in the different groups they’re subscribed to. To model this relationship, I was thinking: User has_many :notices has_and_belong_to_many :notice_groups Notice has_one :notice_group belongs_to :user NoticeGroup has_and_belongs_to_many :users So first question, is the above set up correctly? How would I also model that a “NoticeGroup” is ‘owned/created’ by a particular user? Right now the HABTM on NoticeGroup seems to imply that the NoticeGroup can belong to many Users but I also need it to show that its owned/created by a particular User (owner_id concept on NoticeGroup?), can I have a HABTM :users and a belongs_to :User in the same NoticeGroup model definition? On Wed, Aug 11, 2010 at 12:20 AM, Rick R ric...@gmail.com wrote: I'm pretty newb and trying to get a handle on setting up a particular relationship with my models. For sake of this discussion (real app isn't with tools but for illustration, using tools): To start with (more complicated in a bit); - A User can have multiple tools - A single tool can only belong to one ToolGroup - A User can belong to multiple ToolGroups To model this relationship, I was thinking: User has_many :tools has_and_belong_to_many :tool_groups Tool has_one :tool_group belongs_to :user ToolGroup has_and_belongs_to_many :users So first question, is the above set up correctly? Once the above is set up correctly, I want to have it set up where a ToolGroup can also be 'owned' by a User. In other words, a user will set up a ToolGroup and they are the owner, but other users can belong to this ToolGroup. How do I model that? Do I need to set up another model that is called Owner that is really a User? This doesn't seem right. In reality the db table ToolGroup would just need an ownerID that would be a fk to the User table, but I'm not sure how to model that since ToolGroup already has a HABTM to users. Can I have a HABTM to Users and also a belongs_to :User? Thanks for any help -- Rick R -- 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] Controller syntax
why is this required: def new @post = Post.find(params[:post_id]) @comment = @post.comments.build end instead of: def new @comment = Post.find(params[:post_id]).comments.build end is the 2nd style possible? If no, why not? if yes, why is the 1st style preferred? -- 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: Understanding this model relationship (possibly a HABTM and a belongs_to ?)
Rick R wrote: My initial example is probably confusing. Here is another shot at it in something that has more meaning: A User can create multiple “notices” ( eg “Corporate meeting notice”, “Big Sale Items”, “Job Wanted” ) A User can create multiple “notice groups” (eg “Corporate Notices”, “Public Notices”, “My Miscellaneous Notices”) Are these notice groups specific to the one user, or are they more like global discussion topics? Can notice groups contain notices created by users other than the one who created the group? Every notice should belong to an “notice group” A User needs to be able to subscribe to multiple “notice groups” so that they could see the notices in the different groups they’re subscribed to. To model this relationship, I was thinking: User has_many :notices has_and_belong_to_many :notice_groups Notice has_one :notice_group That should be belongs_to, not has_one. belongs_to :user NoticeGroup has_and_belongs_to_many :users So first question, is the above set up correctly? Maybe, maybe not. Depends on the questions above. How would I also model that a “NoticeGroup” is ‘owned/created’ by a particular user? Right now the HABTM on NoticeGroup seems to imply that the NoticeGroup can belong to many Users but I also need it to show that its owned/created by a particular User (owner_id concept on NoticeGroup?), can I have a HABTM :users and a belongs_to :User in the same NoticeGroup model definition? Sure. Just give the associations different names. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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: Controller syntax
Nathan Kirk wrote: why is this required: def new @post = Post.find(params[:post_id]) @comment = @post.comments.build end instead of: def new @comment = Post.find(params[:post_id]).comments.build end is the 2nd style possible? If no, why not? if yes, why is the 1st style preferred? Depends on your view code. Remember that controller @instance variables are copied to the view, so that the first example would make both @post and @comment available in the view, whereas the second example would only make @comment available. Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- 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: Understanding this model relationship (possibly a HABTM and a belongs_to ?)
On Wed, Aug 11, 2010 at 2:26 PM, Marnen Laibow-Koser li...@ruby-forum.comwrote: Rick R wrote: My initial example is probably confusing. Here is another shot at it in something that has more meaning: A User can create multiple “notices” ( eg “Corporate meeting notice”, “Big Sale Items”, “Job Wanted” ) A User can create multiple “notice groups” (eg “Corporate Notices”, “Public Notices”, “My Miscellaneous Notices”) Are these notice groups specific to the one user, or are they more like global discussion topics? They are created by one user but multiple users can subscribe to them: A User needs to be able to subscribe to multiple “notice groups” so that they could see the notices in the different groups they’re subscribed to. Can notice groups contain notices created by users other than the one who created the group? No. How would I also model that a “NoticeGroup” is ‘owned/created’ by a particular user? Right now the HABTM on NoticeGroup seems to imply that the NoticeGroup can belong to many Users but I also need it to show that its owned/created by a particular User (owner_id concept on NoticeGroup?), can I have a HABTM :users and a belongs_to :User in the same NoticeGroup model definition? Sure. Just give the associations different names. Ok, I'll look into that. thanks. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] [JOB] Ruby on Rails Developer - Chicago, IL
Hi, We are looking for a junior to mid-level Ruby on Rails Developer in Chicago, IL. No formal experience necessary, just someone with a passion for RoR and the desire to write Ruby every day. If interested, please respond with your resume, salary requirements and a code sample. Someone will contact you ASAP! Thanks! Regards, Tallience, LLC j...@tallience.com www.tallience.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: what's with the snowman?
what's with the snowman in forms? div style=margin:0;padding:0;display:inline input name=_snowman type=hidden value=☃ input name=authenticity_token type=hidden value=DOw4is1mrktdfQqm6HMUSmeSDTC73BGqt1z0OwDwsbU= /div mirek rusin http://railssnowman.info/ Interesting. Maybe the wrong place to ask this, but... Why doesn't Rails strip _snowman out of params automagically so I don't have to worry about it? Why not change authenticity_token to contain UTF8 characters? I'm mostly just curious... -philip -- 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: Auto-increment column scoped to another column
I try to use the methods before or after. I think it is better to be done in the DB. -- Andre Fonseca http://www.andrefonseca.net -- 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: rake db:create uninitialized constant Mysql::Error
you need reinstall mysql gems with correct flags. Try google this : mysql gems flags snow leopard -- 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: localhost:3000/
There's also Devise. Devise has more feature than Authlogic. Search in gitub -- 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: Paperclip generating crap urls on server, works on dev
Fernando Perez wrote: Okay so it has to do with caching. On my dev machine, if I switch to production environment I get the same behavior. I don't know what's the solution. You're encountering this because Paperclip was originally built to process a file into different sizes of itself, original, medium, thumbnail etc. In that scenario the format stays the same, so if you use a jpg you'll have a thumbnail jpg as well. When you're looking at converting to a different format or, in your case, capturing a still it doesn't check the mime-type for every style it has. There is at least one branch on github where somebody has attempted to solve this, but here is the approach I've followed: 1. Create an initializer at # config/initializers/paperclip.rb Paperclip.interpolates :style_extension do |attachment, style| default = File.extname(attachment.original_filename).gsub(/^\.+/, ) case style.to_s when /theora/ then 'ogv' when /still/ then 'jpg' else default end end 2. Use that interpolation in your url and path options: :url= /uploads/products/:basename:suffix.:style_extension, :path = :rails_root/uploads/products/:basename:suffix.:style_extension For reference on interpolations: http://rdoc.info/projects/thoughtbot/paperclip Hope it helps! - Parker -- 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] Hash.from_xml does not handle attributes as of rails3 beta4
Can anybody confirm whether or not this has been fixed in the rc releases? -- 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 3- Could not find generator session.
Hello, I am trying to use Authlogic in Rails 3. when I run rails g session admin_session to create the session, I get- == Could not find generator session. == I'm using Rail 3 RC and working off the Rail3 Branch now == GemFile: gem 'authlogic', :git = 'git://github.com/odorcicd/ authlogic.git', :branch = 'rails3' == Any hints? I'm using Rails 3 RC I need this really bad!! 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] ActiveRecord errors ... Best way to rescue a live web application?
Hi all, I have some issues when a link is clicked twice quickly that deletes an ActiveRecord row. All I really want to do is set up some universal catch that will redirect all application errors to index. Best way? Thanks! Shawn -- 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: rails 3- Could not find generator session.
Hello, I am trying to use Authlogic in Rails 3. when I run rails g session admin_session to create the session, I get- == Could not find generator session. == I'm using Rail 3 RC and working off the Rail3 Branch now == GemFile: gem 'authlogic', :git = 'git://github.com/odorcicd/ authlogic.git', :branch = 'rails3' == Any hints? I'm using Rails 3 RC I need this really bad!! Thanks aww w/e i just made it by hand -- 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: rails 3- Could not find generator session.
Hello, I am trying to use Authlogic in Rails 3. when I run rails g session admin_session to create the session, I get- == Could not find generator session. == I'm using Rail 3 RC and working off the Rail3 Branch now == GemFile: gem 'authlogic', :git = 'git://github.com/odorcicd/ authlogic.git', :branch = 'rails3' == Any hints? I'm using Rails 3 RC I need this really bad!! Thanks aww w/e i just made the file by hand -- 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: Re: what's with the snowman?
Philip Hallstrom wrote: http://railssnowman.info/ Interesting. Maybe the wrong place to ask this, but... Why doesn't Rails strip _snowman out of params automagically so I don't have to worry about it? Well you could most likely include your own Rack middleware to melt the _snowman from your params hash. No need to wait (and hope) for the Rails team to do it for you. Why not change authenticity_token to contain UTF8 characters? I would assume that authenticity_token is some form of SHA-1 hash encoded in Base64, which by definition produces 7-bit ASCII character strings. -- 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] Problem with changing from mySql to PostrgreSql with rails
I have this statement running Ok in my development mode @users = User.paginate :joins = :properties ,:group = 'users.id', :page = params[:page], :order = 'count(properties.id) DESC',:conditions = ['users.id != 1'] when I push my app to Heroku it gives me this error column users.email must appear in the GROUP BY clause or be used in an aggregate function : SELECT users.* FROM users INNER JOIN properties ON properties.user_id = users.id WHERE (users.id != 1) GROUP BY users.id,users.login,users.name ORDER BY count(properties.id) DESC LIMIT 10 OFFSET 0): by doing some research on Google, I found out that it's a DB Engin problem. MySql allows me to do it but PostgreSql does not. How can I run the same query on PostgreSql. I am trying to get the users ordered by the users with highest properties. -- 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] where can I get up to date instantrails ?
Dani Dani wrote: Hi, can someone please tell me where can I find up-to-date instantrails (with rails 2.38, ruby 1.8.7) ... ? Thanks for any help Dani You can just install instant rails and 'gem update' and you should get what you want. I have done that with minimal effort and updated as far as RoR 2.2.2 (maybe further, I do not really remember and if I did I decided to use the 2.2.2 version). Norm -- 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: Re: what's with the snowman?
Philip Hallstrom wrote: http://railssnowman.info/ Interesting. Maybe the wrong place to ask this, but... Why doesn't Rails strip _snowman out of params automagically so I don't have to worry about it? As of tonight the snowman is gone entirely. The key is utf8 and the value is ✓ (#x2713;). Far more on the sane 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 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: Controller syntax
Marnen Laibow-Koser wrote: Nathan Kirk wrote: why is this required: def new @post = Post.find(params[:post_id]) @comment = @post.comments.build end instead of: def new @comment = Post.find(params[:post_id]).comments.build end is the 2nd style possible? If no, why not? if yes, why is the 1st style preferred? Depends on your view code. Remember that controller @instance variables are copied to the view, so that the first example would make both @post and @comment available in the view, whereas the second example would only make @comment available. And of course if you just had @post you could easily extract comments in the view code by @post.comments.build. @comment is really not necessary because @post gives you the handle you need. Norm Best, -- Marnen Laibow-Koser http://www.marnen.org mar...@marnen.org -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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] named routes don't load in plugin
Hi all, I have one plugin for a datagrid. This plugin have one module wich use json with ajax. The poblem: When i call the method by ajax and generate data to compose datagrid i tried use my named route post_url, but it's not being loaded on routes.rb (this behaviour exist only here) How can i load these helpers (edit_post, new_post...) inside my plugin Thanks -- Rodrigo Mendonça (62) 8567-3142 -- 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: where can I get up to date instantrails ?
Norm Scherer wrote: You can just install instant rails and 'gem update' and you should get what you want. I have done that with minimal effort and updated as far as RoR 2.2.2 (maybe further, I do not really remember and if I did I decided to use the 2.2.2 version). Norm Thank you Norm. I was looking to upgrade my InstantRails to rails 2.3.8 from 2.3.5 and ruby to 1.8.7. from 1.8.6. Now I have managed to do it. I have first upgraded gem to 1.3.7, upgraded ruby directly to x:\rails\ruby directory (windows), and at last gem update rails has done the rest - rails 2.3.8. Now I have the environment I was looking for: Rails 2.3.8 Ruby 1.8.7 Thank you again. Dani -- 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: where can I get up to date instantrails ?
hey dani can you please tell how you do that in a explained way i am in the same situation On Thu, Aug 12, 2010 at 10:31 AM, Dani Dani li...@ruby-forum.com wrote: Norm Scherer wrote: You can just install instant rails and 'gem update' and you should get what you want. I have done that with minimal effort and updated as far as RoR 2.2.2 (maybe further, I do not really remember and if I did I decided to use the 2.2.2 version). Norm Thank you Norm. I was looking to upgrade my InstantRails to rails 2.3.8 from 2.3.5 and ruby to 1.8.7. from 1.8.6. Now I have managed to do it. I have first upgraded gem to 1.3.7, upgraded ruby directly to x:\rails\ruby directory (windows), and at last gem update rails has done the rest - rails 2.3.8. Now I have the environment I was looking for: Rails 2.3.8 Ruby 1.8.7 Thank you again. Dani -- 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.comrubyonrails-talk%2bunsubscr...@googlegroups.com . For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- Thanks: Rajeev sharma -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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.