[Rails] why story.votes return Array, but story.votes.create works?
In Ruby on Rails, say a Story object can has_many Vote objects (a story is voted hot by many users). So when we do a s = Story.find(:first) s is a Story object, and say s.votes returns [] and s.votes.class returns Array So clearly, s.votes is an empty Array object. At this time, when s.votes.create is called, it actually invokes a method of the Vote class? How come an Array class object can invoke a Vote class 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] What does attachment_fu do when saving?
Hi, I have a model with attachment_fu. The model saves images but I didn't put validates_as_attachment. I understand that it takes long time to create an object as it has to process images. But I don't understand why it takes long time to update the object (not changing file but only modify other non-attachment_fu attributes). If I do object.save(false), it doesn't take long time. So my question is... What's the difference between object.save and object.save(false) when the object is attachment_fu model and there's no validation? Thanks. Sam -- 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] remote_function return No action responded error
here i given my codes when i execute this remote_function rails give me this error ActionController::UnknownAction (No action responded to report_poem. Actions: create, destroy, edit, index, new, show, update): in my view span class=report_button onclick= %=remote_function(:url={:action=:report_poem,:id=@poem.id}) %Submit/span in my controller def report_poem @poem = Poem.find(params[:id]) respond_to do |format| format.js end end so anybody know what is the reason is? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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: why story.votes return Array, but story.votes.create works?
On May 23, 7:10 am, Jian Lin li...@ruby-forum.com wrote: So clearly, s.votes is an empty Array object. Actually it's not. It's an AssociationProxy object pretending to be an instance of Array Fred At this time, when s.votes.create is called, it actually invokes a method of the Vote class? How come an Array class object can invoke a Vote class method? -- 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 athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Extending a module in a controller
On May 23, 12:59 am, Marnen Laibow-Koser li...@ruby-forum.com wrote: module Enumerable def my_compress ... but when I visit the web page in question I get No method 'my_compress' for Array ... I'm probably doing something fundamentally wrong - what could/should I be doing? You should be putting your model logic in the model, not in the controller. on top of that, by putting it inside the controller like that you've created a new module called LookupController::Enumerable rather than extending Enumerable. If I were you I'd keep extensions to core classes somewhere in lib. Fred thanks Best, -- Marnen Laibow-Koserhttp://www.marnen.org mar...@marnen.org -- 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 athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: why story.votes return Array, but story.votes.create works?
Frederick Cheung wrote: On May 23, 7:10�am, Jian Lin li...@ruby-forum.com wrote: So clearly, s.votes is an empty Array object. Actually it's not. It's an AssociationProxy object pretending to be an instance of Array Fred not like this? irb(main):010:0 class Foo irb(main):011:1 def class irb(main):012:2 return Fixnum irb(main):013:2 end irb(main):014:1 end = nil irb(main):015:0 f = Foo.new = #Foo:0x4799ce8 irb(main):016:0 f.class = Fixnum irb(main):017:0 -- 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] validating a form with a foreign key
Hi there. I have a problem with validating a form, where is foreign key present. I have a table like this: id name password status_id This is the way that status_id is implemented to the users table. td%= select_tag ('status_id', options_for_select([['-- choose one --', nil]] + @status.collect { |stat| [stat.status, stat.id]}, @user.status_id))%/td - When I dont enter anything to any of the fields, I get an error: NoMethodError in Users#create Showing users/_form.rhtml where line #12 raised: 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.collect Extracted source (around line #12): 12: td%= select_tag ('status_id', options_for_select([['-- choose one --', '']] + @status.collect { |stat| [stat.status, stat.id]}, @user.status_id))%/td -- And when everything is not blank just the status_id is nto chosen, I get another error: ActiveRecord::RecordNotFound in UsersController#create Couldn't find Status with ID= - Here is the code of my controller: class UsersController ApplicationController def index @user = User.find(:all) end #* NEW def new @user = User.new @status = Status.find(:all) end def create @user = User.new(params[:user]) status = Status.find(params[:status_id]) @user.status = status if @user.save flash[:notice] = 'New item successfully created!' redirect_to(:action = 'index') else flash[:notice] = 'Creating an item failed!' render(:action = 'new') end end end - Can you suggest a 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] Re: Extending a module in a controller
Frederick Cheung wrote: On May 23, 12:59�am, Marnen Laibow-Koser li...@ruby-forum.com wrote: ... by putting it inside the controller like that you've created a new module called LookupController::Enumerable rather than extending Enumerable. If I were you I'd keep extensions to core classes somewhere in lib. Fred Ah I see, of course. So I've moved it to 'my_extensions.rb' in lib/, added require 'my_extensions' in the controller and now it works fine. Thanks! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] [Rails 3] Trouble with named routes and form_for
Hi guys, I'm having trouble getting named routes and form_for to play nicely in quite the way I would expect. Here's a quick summary of what I've got going on: Named route: resources :thread, :class_name = forum_thread Controller name: forum_thread_controller Model object: forum_thread In both my new and edit actions I'm setting up an @thread variable: @thread = ForumThread.new 1.) My first attempt at writing the form_for looked something like this: %= form_for @thread do |f| % . % end This didn't work because @thread tries to use a path involving the string forum_thread, which doesn't have a matching route and which I don't want. 2.) So that's fine, I figured I'd just use named routes. So I tried this: %= form_for @thread, :as = :thread, :url = thread_path(@thread) do |f| % % end This works for edit actions, but not for new actions. On new I get the following error: No route matches {:action=destroy, :controller=forum_thread, :id=#ForumThread id: nil, .} 3.) So then I tried: %= form_for @thread, :as = :thread, :url = threads_path(@thread) do |f| % % end This doesn't work for edit, and sorta works for new except it outputs the following HTML, which makes the respond_to block unhappy: form action=/thread?format= class=thread_new id=thread_new method=post 4.) So then I tried: %= form_for @thread, :as = :thread, :url = threads_path do |f| % % end Now everything works for new, but not for edit! (Because the ID of the element being edited isn't emitted as part of the action): form action=/thread class=thread_edit id=thread_edit method=post So: 1. Is there some way to use a named route that uses a custom class name and still be able to reuse my form partial for both new and edit actions? Or am I stuck writing two forms? 2. Is the error I received in #2 a bug in Rails 3 or expected behavior? 3. Is the erroneous output in #3 a bug in Rails 3 or expected behavior? My sincere thanks in advance for your help! -Jury -- You received 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] Introducing ResourceAwareness
Hi all, I want to invite you to check out ResourceAwareness, a small gem that makes available information about a Rails application's resources (as defined by the 'resource/s' routing DSL methods) at Rails.application.resources. http://github.com/ingoweiss/resource_awareness You can find a brief introductory post about it here: http://blog.ingoweiss.com/2010/05/10/resource-awareness.html There is also another post with a small example (dynamic ActiveResource client creation) for the kind of things that become possible once this resource information is available: http://blog.ingoweiss.com/2010/05/12/resource-awareness-and-active-resource.html Best Regards, Ingo Weiss http://github.com/ingoweiss -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Rails acts_as_* plugins, with parameters
--Original Message-- From: Rick DeNatale Sender: rubyonrails-talk@googlegroups.com To: rubyonrails-talk@googlegroups.com ReplyTo: rubyonrails-talk@googlegroups.com Subject: Re: [Rails] Rails acts_as_* plugins, with parameters Sent: Feb 25, 2010 20:08 On Thu, Feb 25, 2010 at 7:32 AM, Paul PH li...@ruby-forum.com wrote: Hi all, I'm trying to write a plugin which will allow me to specify: acts_as_item :option=:value i need to be able to access the :options=:value hash from instances of the model also. I've tried with class_eval in the plugin, but can't get it working. I'm calling acts_as_item(options), and that method can see the options passed from a model. Then inside the class_eval, I'm adding a method (def self.configuration) which returns the options hash. I thought from an instance, I'd be able to do instance.class.configuration which would then return said options hash. Any ideas? thanks for reading. module Item #called by active record for us def self.included(base) base.extend ClassMethods end module ClassMethods def acts_as_item(options = {}) configuration = {:option=:value} class_eval { include InstanceMethods def self.configuration I think you want this to be def configuration Since this is in a module extended by the class. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Rails acts_as_* plugins, with parameters
J --Original Message-- From: Rick DeNatale Sender: rubyonrails-talk@googlegroups.com To: rubyonrails-talk@googlegroups.com ReplyTo: rubyonrails-talk@googlegroups.com Subject: Re: [Rails] Rails acts_as_* plugins, with parameters Sent: Feb 25, 2010 20:08 On Thu, Feb 25, 2010 at 7:32 AM, Paul PH li...@ruby-forum.com wrote: Hi all, I'm trying to write a plugin which will allow me to specify: acts_as_item :option=:value i need to be able to access the :options=:value hash from instances of the model also. I've tried with class_eval in the plugin, but can't get it working. I'm calling acts_as_item(options), and that method can see the options passed from a model. Then inside the class_eval, I'm adding a method (def self.configuration) which returns the options hash. I thought from an instance, I'd be able to do instance.class.configuration which would then return said options hash. Any ideas? thanks for reading. module Item #called by active record for us def self.included(base) base.extend ClassMethods end module ClassMethods def acts_as_item(options = {}) configuration = {:option=:value} class_eval { include InstanceMethods def self.configuration I think you want this to be def configuration Since this is in a module extended by the class. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Twitter: http://twitter.com/RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- You received 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: question on layouts
nirosh wrote: write the function @ application_controller that can be access in any controller. for more info read abt application controller doc. nirosh Hey thanks for the response. What about the image paths. This is in css and it's not linking to the images folder: background: #b8e5d1 url(/public/images/mastgrad.png) top left no-repeat; public/images incorrect path? I don't understand because it looks like thats the path structure in my app. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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 Error:uninitialized constant ActiveResource::Base
I'v just install rails3 for try it out. I was following getting started guide: rm public/index.html, change routes... and then i try to open page i'v got an error. OS: ubunto 10.04 Rails info: dp...@dpush-desktop:~/rails_proj/blog/public$ ruby -v ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux] dp...@dpush-desktop:~/rails_proj/blog/public$ rails -v Rails 3.0.0.beta3 dp...@dpush-desktop:~/rails_proj/blog/public$ gem list *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.0.beta3) actionpack (3.0.0.beta3) activemodel (3.0.0.beta3) activerecord (3.0.0.beta3) activeresource (3.0.0.beta3) activesupport (3.0.0.beta3, 2.3.6) arel (0.3.3) builder (2.1.2) bundler (0.9.25) erubis (2.6.5) i18n (0.3.7) mail (2.2.1) memcache-client (1.8.3) mime-types (1.16) polyglot (0.3.1) rack (1.1.0) rack-mount (0.6.3) rack-test (0.5.3) rails (3.0.0.beta3) railties (3.0.0.beta3) rake (0.8.7) text-format (1.0.0) text-hyphen (1.0.0) thor (0.13.6) treetop (1.4.5) tzinfo (0.3.20) ERROR NameError: uninitialized constant ActiveResource::Base /usr/lib/ruby/gems/1.8/gems/activeresource-3.0.0.beta3/lib/ active_resource/railties/log_subscriber.rb:11:in `logger' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta3/lib/action_view/ template.rb:107:in `to_proc' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ log_subscriber.rb:75:in `map' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ log_subscriber.rb:75:in `flush_all!' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/rack/ logger.rb:29:in `after_dispatch' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/rack/ logger.rb:15:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/runtime.rb:17:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta3/lib/ action_dispatch/middleware/static.rb:30:in `call' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ application.rb:132:in `call' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ application.rb:81:in `send' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ application.rb:81:in `method_missing' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/rack/ log_tailer.rb:15:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb: 13:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb: 48:in `service' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start' /usr/lib/ruby/1.8/webrick/server.rb:92:in `each' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb: 14:in `run' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in `start' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/commands/ server.rb:62:in `start' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ commands.rb:42 script/rails:9:in `require' script/rails:9 any help? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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 Error:uninitialized constant ActiveResource::Base
I'v just install rails3 for try it out. I was following getting started guide: rm public/index.html, change routes... and then i try to open page i'v got an error. OS: ubunto 10.04 Rails info: dp...@dpush-desktop:~/rails_proj/blog/public$ ruby -v ruby 1.8.7 (2010-01-10 patchlevel 249) [x86_64-linux] dp...@dpush-desktop:~/rails_proj/blog/public$ rails -v Rails 3.0.0.beta3 dp...@dpush-desktop:~/rails_proj/blog/public$ gem list *** LOCAL GEMS *** abstract (1.0.0) actionmailer (3.0.0.beta3) actionpack (3.0.0.beta3) activemodel (3.0.0.beta3) activerecord (3.0.0.beta3) activeresource (3.0.0.beta3) activesupport (3.0.0.beta3, 2.3.6) arel (0.3.3) builder (2.1.2) bundler (0.9.25) erubis (2.6.5) i18n (0.3.7) mail (2.2.1) memcache-client (1.8.3) mime-types (1.16) polyglot (0.3.1) rack (1.1.0) rack-mount (0.6.3) rack-test (0.5.3) rails (3.0.0.beta3) railties (3.0.0.beta3) rake (0.8.7) text-format (1.0.0) text-hyphen (1.0.0) thor (0.13.6) treetop (1.4.5) tzinfo (0.3.20) ERROR NameError: uninitialized constant ActiveResource::Base /usr/lib/ruby/gems/1.8/gems/activeresource-3.0.0.beta3/lib/ active_resource/railties/log_subscriber.rb:11:in `logger' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta3/lib/action_view/ template.rb:107:in `to_proc' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ log_subscriber.rb:75:in `map' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ log_subscriber.rb:75:in `flush_all!' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/rack/ logger.rb:29:in `after_dispatch' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/rack/ logger.rb:15:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/runtime.rb:17:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `synchronize' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/lock.rb:11:in `call' /usr/lib/ruby/gems/1.8/gems/actionpack-3.0.0.beta3/lib/ action_dispatch/middleware/static.rb:30:in `call' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ application.rb:132:in `call' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ application.rb:81:in `send' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ application.rb:81:in `method_missing' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/rack/ log_tailer.rb:15:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/content_length.rb: 13:in `call' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb: 48:in `service' /usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service' /usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run' /usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start' /usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread' /usr/lib/ruby/1.8/webrick/server.rb:95:in `start' /usr/lib/ruby/1.8/webrick/server.rb:92:in `each' /usr/lib/ruby/1.8/webrick/server.rb:92:in `start' /usr/lib/ruby/1.8/webrick/server.rb:23:in `start' /usr/lib/ruby/1.8/webrick/server.rb:82:in `start' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/handler/webrick.rb: 14:in `run' /usr/lib/ruby/gems/1.8/gems/rack-1.1.0/lib/rack/server.rb:155:in `start' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/commands/ server.rb:62:in `start' /usr/lib/ruby/gems/1.8/gems/railties-3.0.0.beta3/lib/rails/ commands.rb:42 script/rails:9:in `require' script/rails:9 any help? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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 happens when Rails 1.3.5 is installed on top of 2.3.5?
I would, just in case, not being sure of the repercussions that installing a prior version of the gem would have. On May 22, 10:48 pm, Jian Lin li...@ruby-forum.com wrote: pepe wrote: Just in case it applies here is an extract from the Pickaxe book (Second edition, page 217): Threre's a subtlety when it comes to installing different versions of the same application with RubyGems. Even though RubyGems keeps separate versions of the application's library files, it does not version the actual command you use to run the application. As a result, each install of an application effectively overwrites the previous one. so that means it will be safest if i re-run gem install rails or gem install rails -v2.3.5 again? -- 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 athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: question on layouts
On Sun, May 23, 2010 at 5:07 AM, John Merlino li...@ruby-forum.com wrote: nirosh wrote: write the function @ application_controller that can be access in any controller. for more info read abt application controller doc. Or create a utility controller, call it home or whatever, that handles all the non-model pages you need. That's pretty typical. What about the image paths. This is in css and it's not linking to the images folder: background: #b8e5d1 url(/public/images/mastgrad.png) top left no-repeat; public/images incorrect path? I don't understand because it looks like thats the path structure in my app. public is the root directory of all the static resources -- so you only want to use `background: #b8e5d1 url( /images/mastgrad.png ) ...` HTH, -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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] remote_function return No action responded error
On Sun, May 23, 2010 at 12:09 AM, nirosh kunalan.kand...@gmail.com wrote: ActionController::UnknownAction (No action responded to report_poem. Actions: create, destroy, edit, index, new, show, update): so anybody know what is the reason is? Either the generated URL is wrong -- you can check that easily using your browser's view source -- or that's not a recognized route -- run `rake routes` to determine, add as necessary. HTH, -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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: rake db:create = LIBMYSQL.DLL not found. how to solve??
Rails Terrorist wrote: [1] gem install mysql [2] you will see like error syntac but dont pay attention to it [3] find LIBMYSQL.DLL from your mysql/bin folder in your mysql folder not ruby folder. [4] copy paste that file to ruby/bin [5] restart your server or console, if you are already run it. Then Cheer, Reinhart http://teapoci.blogspot.com Thanx Reinhart this helps me to run rails on windows. -- 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: Looking for Easy Rails hosting
Victor Stan wrote: I'm sure its simple on average. For me, deploying on Site5 was simpler. I also use a blank repository from which i clone my production site next to it on the server and my dev site on my local machine through ssh. Same thing, git push, git pull, don't need heroku for that, too costly anyway unless you want to scale rapidly, which i don't. With Heroku there's no git pull -- just push the code and it does everything else. And no setup of the Rails environment -- it's done for you. I've done both (though other VPSs, not site5) quite often. Heroku really is simpler. I did, You did what? Please quote when replying so it's clear what you mean. maybe you can too: http://www.rackspacecloud.com/cloud_hosting_products/servers/pricing compare that to: http://www.site5.com/ Site5 is shared hosting, not a VPS, right? If so, then the two aren't really comparable -- and Rails generally really wants a VPS. Of course, first off, they both serve a different purpose and a different type of clientele. I wouldn't go for cloud computing just for the fun of it. Which is what I would do while I'm learning RoR... I wouldn't go for cloud computing for the fun of it either. The nice thing about Heroku and (I think) Rackspace Cloud is that they behave as if they're conventional servers. 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: question on layouts
John Merlino wrote: Hey all, Does any have suggestions to whether I should create a controller for every web page on my site or just create an action for every web page in same controller if those actions will never require database calls? Do neither. Use a single controller action for your static pages, and give it the name of the page as a parameter. It doesn't make sense to create a controller/model for a single web page if it isn';t going to require sql. That's poor reasoning. However, I do need the url to actual show the different page just as in any site. So I'm just curious what are best practices to approach this. Thanks for any response. You can use routing to make the URLs be anything you like. 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: List of radio buttons
On 21 Maj, 17:28, Hassan Schroeder hassan.schroe...@gmail.com wrote: On Fri, May 21, 2010 at 8:25 AM, Marnen Laibow-Koser li...@ruby-forum.com wrote: No, first learn about HTML form syntax (hint: the name attribute is significant here) Heh. Beat me by a minute :-) I was going to suggest that the OP has apparently never read this http://www.w3.org/TR/html401/interact/forms.html and that it'd be an excellent place to start... -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. Thanks guys for your responses. For the future - it would be great if you could to give some kind of hint or high level description how to approach soloving the problem. Such as reading about FORM, some links would be great. 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: remote_function return No action responded error
Do you have the js includes in the application layout? Happened to me a few times when playing with several projects. On May 23, 3:09 am, nirosh kunalan.kand...@gmail.com wrote: here i given my codes when i execute this remote_function rails give me this error ActionController::UnknownAction (No action responded to report_poem. Actions: create, destroy, edit, index, new, show, update): in my view span class=report_button onclick= %=remote_function(:url={:action=:report_poem,:id=@poem.id}) %Submit/span in my controller def report_poem @poem = Poem.find(params[:id]) respond_to do |format| format.js end end so anybody know what is the reason is? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Would you recommend some books about Ruby on Rails?
The best book on learning Rails that I have ever read is Simply Rails 2 published by Sitepoint (http://www.sitepoint.com/books/rails2/? historicredirect=rails1 ). It is laid out in a very good way and it's the only book where I went through all the examples. Later on I would recommend The Rails Way -http://www.rubyinside.com/ the-rails-way-by-obie-fernandez-679.html It goes into great detail about Rails. Remember that Rails 3.0 is just around the corner as well which is a bit different from 2.0. On May 22, 12:21 pm, goodchoi good...@gmail.com wrote: Hi everybody~ Vey nice to meet you on this group. I'm a only web service planner operating a site http://topics.co.kr/categories?q=iphone developed by Ruby-on-Rails engineers through payment. But I'm trying to do study Ruby on Rails by myself from now on. By the way, some engineers in my country South Korea said the only book translated in Korean has wrong exercises now because Ruby on Rails is not any more version 1.x. So I should buy a book composed by exercise including exercises with version 2.x. First of all I hope this book [http://amzn.to/bshhvk] is like so(above) but I'm not sure. And then I hope you great engineers will recommend an appropriate book to me, a beginner. Thank you geeks. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Rails default date format
There is also validates_date_time plugin http://agilewebdevelopment.com/plugins/validates_date_time if you also want to allow entry in other formats Tonypm -- You received 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 happens when Rails 1.3.5 is installed on top of 2.3.5?
On Sat, May 22, 2010 at 2:47 PM, pepe p...@betterrpg.com wrote: Just in case it applies here is an extract from the Pickaxe book (Second edition, page 217): Threre's a subtlety when it comes to installing different versions of the same application with RubyGems. Even though RubyGems keeps separate versions of the application's library files, it does not version the actual command you use to run the application. As a result, each install of an application effectively overwrites the previous one. That's actually not the whole story, and excerpt from the output of gem help install: Description: The install command installs local or remote gem into a gem repository. For gems with executables ruby installs a wrapper file into the executable directory by default. This can be overridden with the --no-wrappers option. The wrapper allows you to choose among alternate gem versions using _version_. For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer version is also installed. The actual command you use to run the application is actually a bit of boilerplate generated by gems which requires the gem and then calls the executable in the bin directory of the gem. If you use that _{version}_ option it requires a specific version of the gem. So if you have both rails 2.3.5 and 1.2.6 installed then either rails or rails _2.3.5_ will run version 2.3.5 which is the latest version installed. but rails _1.2.6_ will run version 1.2.6 HTH BTW, the OP gave rails version 1.3.5 as a example, as far as I know this a fictitious version since rails went from version 1.2.6 to version 2.0.0 -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- You received 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 happens when Rails 1.3.5 is installed on top of 2.3.5?
Rick Denatale wrote: That's actually not the whole story, and excerpt from the output of gem help install: Description: The install command installs local or remote gem into a gem repository. For gems with executables ruby installs a wrapper file into the executable directory by default. This can be overridden with the --no-wrappers option. The wrapper allows you to choose among alternate gem versions using _version_. For example `rake _0.7.3_ --version` will run rake version 0.7.3 if a newer version is also installed. What about if Rails 2.3.5 is installed and then 1.2.5 is installed? It seems like after that rails -v will still give 2.3.5. So the default executable is not overwritten or linked to 1.2.5 but to the newest version. Also, if we run rails _1.2.5_ the won't all the supporting files, script, etc, etc also need to be versioned? So probably that is automatically taken care of as well? So, supposedly, we can install rails in ANY ORDER -- 2.3.5 first, and then 2.2.2 and then 1.2.5 and they still all work well, and the default one is still the 2.3.5 version? wow, if only Windows application can do that too... -- 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: Newbie question about views folder
On Sat, May 22, 2010 at 8:35 PM, FrankMurphy sabir.a.ibra...@gmail.com wrote: Okay, I got it to work on the domain root by editing /etc/apache2/ sites-available/default to point to the app's public directory. Is that the right way to go about it, or is that just a hack? If that's what I'm supposed to do, it seems odd that this step isn't mentioned in the mod_rails user guide. I still can't get it to work on a sub-uri using an analogous technique (i.e., creating a virtual host file for the URI in /etc/apache2/sites-available)... On May 21, 9:23 pm, FrankMurphy sabir.a.ibra...@gmail.com wrote: Thanks everyone for your replies. Okay, so this is interesting. When I try deploying the app to the domain root, I can't see the Welcome aboard! page; instead, I see the index.html page that's in Apache's web root directory. Also, when I try http://server_addr/users, I see a directory listing of the (.erb) files that are in the demo_app/app/views/users. Does this mean that Passenger is not set up correctly? I don't know if it matters, but the server I'm using doesn't have a domain name; I'm accessing it using its IP address. Yes I think that matters, in the example you gave in the first post you had VirtualHost *:80 ServerName server_addr DocumentRoot /projects/demo_app/public RailsBaseURI /demo_app /VirtualHost This is what Apache calls a name-based virtual host http://httpd.apache.org/docs/2.2/vhosts/name-based.html If you use an ip address like 192.168.1.123 as the value for the ServerName directive, apache will do a reverse dns search to try to find a NAME. http://httpd.apache.org/docs/2.2/mod/core.html#servername If the server actually has a unique ip address for the app, then you might look at setting up an ip address based virtual host after reading the caveats in the first section of the first url I cited. But the simpler thing would probably be to use a name based vhost and configure the client's dns to resolve the name to the ip address so you can use it in the browser urls. Just putting a line in /etc/hosts (or the equivalent if the client is a doze machine) should be enough. -- Rick DeNatale Blog: http://talklikeaduck.denhaven2.com/ Github: http://github.com/rubyredrick Twitter: @RickDeNatale WWR: http://www.workingwithrails.com/person/9021-rick-denatale LinkedIn: http://www.linkedin.com/in/rickdenatale -- You received 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: List of radio buttons
On Sun, May 23, 2010 at 7:13 AM, Smok mariusz_waszc...@tlen.pl wrote: On 21 Maj, 17:28, Hassan Schroeder hassan.schroe...@gmail.com wrote: I was going to suggest that the OP has apparently never read this http://www.w3.org/TR/html401/interact/forms.html and that it'd be an excellent place to start... Thanks guys for your responses. For the future - it would be great if you could to give some kind of hint or high level description how to approach soloving the problem. Such as reading about FORM, some links would be great. Thanks ! Uh, isn't that exactly what I did? :-) -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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: remote_function return No action responded error
yes and sort it out. there is an entry missed in routes file -- You received 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: question on layouts
On Sun, May 23, 2010 at 9:12 AM, Marnen Laibow-Koser li...@ruby-forum.comwrote: John Merlino wrote: Hey all, Does any have suggestions to whether I should create a controller for every web page on my site or just create an action for every web page in same controller if those actions will never require database calls? Do neither. Use a single controller action for your static pages, and give it the name of the page as a parameter. If the OP is, in fact, talking about static pages, you might consider, for performance reasons, putting them in a structure under /public and letting Apache, et.al. deliver them without the involvement of mongrel / passenger / your rails app. HTH, Bill -- You received 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: Looking for Easy Rails hosting
With Heroku there's no git pull -- just push the code and it does everything else. The problem for me is that it wasn't that simple, the app didn't work. While in an environment like shared hosting (if were comparing low price things, Heroku has a small free option as well) I have control over the database, I don't get how heroku's databases work... I'll assume that through ActiveRecord it doesn't matter. But whatever, if you want to see what's in the database, Site5 gives you PhpMyAdmin, I don't know how you check what's in the database on Heroku. Site5 is shared hosting, not a VPS, right? If so, then the two aren't really comparable -- and Rails generally really wants a VPS. Well the question we are supposed to be answering here is what is easy rails hosting, not VPS vs shared. That's a whole other chapter. Site5 is shared, its easy. Its setup for you out of the box. That's all. - V On May 23, 10:08 am, Marnen Laibow-Koser li...@ruby-forum.com wrote: Victor Stan wrote: I'm sure its simple on average. For me, deploying on Site5 was simpler. I also use a blank repository from which i clone my production site next to it on the server and my dev site on my local machine through ssh. Same thing, git push, git pull, don't need heroku for that, too costly anyway unless you want to scale rapidly, which i don't. With Heroku there's no git pull -- just push the code and it does everything else. And no setup of the Rails environment -- it's done for you. I've done both (though other VPSs, not site5) quite often. Heroku really is simpler. I did, You did what? Please quote when replying so it's clear what you mean. maybe you can too: http://www.rackspacecloud.com/cloud_hosting_products/servers/pricing compare that to:http://www.site5.com/ Site5 is shared hosting, not a VPS, right? If so, then the two aren't really comparable -- and Rails generally really wants a VPS. Of course, first off, they both serve a different purpose and a different type of clientele. I wouldn't go for cloud computing just for the fun of it. Which is what I would do while I'm learning RoR... I wouldn't go for cloud computing for the fun of it either. The nice thing about Heroku and (I think) Rackspace Cloud is that they behave as if they're conventional servers. Best, -- Marnen Laibow-Koserhttp://www.marnen.org mar...@marnen.org -- 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 athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Would you recommend some books about Ruby on Rails?
I would recommend things by: The Pragmatic Bookshelf http://www.pragprog.com/titles Check out the Agile Web Development With Rails... On May 22, 12:21 pm, goodchoi good...@gmail.com wrote: Hi everybody~ Vey nice to meet you on this group. I'm a only web service planner operating a site http://topics.co.kr/categories?q=iphone developed by Ruby-on-Rails engineers through payment. But I'm trying to do study Ruby on Rails by myself from now on. By the way, some engineers in my country South Korea said the only book translated in Korean has wrong exercises now because Ruby on Rails is not any more version 1.x. So I should buy a book composed by exercise including exercises with version 2.x. First of all I hope this book [http://amzn.to/bshhvk] is like so(above) but I'm not sure. And then I hope you great engineers will recommend an appropriate book to me, a beginner. Thank you geeks. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Questionairee's questions - how to show all user's answers? How to update database with ALL user's answers?
I am using RoR 2.3.5. I would like to have list of questions with three possible answers. After having copleted a test I would like to update the database with user's answers. At the bottom of the page I would also like to list all selected answers for the user. In a table answers I have columns: question, a1, a2, a3 (these columns are answers to the question), a_u (user's answer), a_ok (correct answer). Below I have pasted the view that I am using for listing questions. But I have no idea how to list ALL answers at the bottom of the page (now I know how to show only one answer). And how (in the most effective way) to update the column a_u wtith ALL user's answers? Could you help me? #-index.htm.erb begin-- h1Listing answers/h1 % @answers.each do |answer| % form !-- action = \answers\selectedto gowno nie chce dzialac -- td%=h answer.question %/td input type=radio name=answer1 value= %=answer.a1% / %=h answer.a1 % input type=radio name=answer1 value= %=answer.a2% / %=h answer.a2 % input type=radio name=answer1 value= %=answer.a3% / %=h answer.a3 % input type=submit/ /form % end % br/ You selected %= @data11 % #-index.htm.erb end-- In answers_controller I have included: @data11 = params[:answer1] -- You received 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] server side programming, using the Ruby on Rails (RoR) framework help please
Hello , I have a home work shown below i did most of the things , i wrote rthml and database in netbeans but i cant run Homework and code i wrote are below what is missing here i dont know please help . I cant run it Implement a WEB application using the RAILS framework for maintaining an online directory on hotels. Each entry in the directory will have the following fields: hotel name city year built star classification (how many stars, integer) home many rooms pool (yes/no) You will need to create a database using the meta-data given above in either MYSQL, POSTRESQL or some other database system that is familiar to you. The table can be created either using SQL and the interface of your database system, or from within RoR, using migrations. The operations that should be implemented are: Create a new hotel Delete a hotel Show all hotels Find an entry by hotel name and display it Find and display hotels which have pools Include pictures of hotels in the database and show them also. RB FILE class Assignment ActiveRecord::Migration def self.up create_table : Hotels do |t| t.coloumn : hotel_name, :string t.coloumn : city, :string t.coloumn : yearbuilt, :int t.coloumn : star, :int t.coloumn : numofrooms, :int t.coloumn : pool, :string end Hotel.create : hotel_name = Anatolia Beach Hotel , city =Kemer, yearbuilt =2004,star=5,numofrooms=1200,pool=yes Hotel.create : hotel_name = Catamaran Resort , city =Fethiye, yearbuilt =2006,star=5,numofrooms=860,pool=yes Hotel.create : hotel_name = Oasis Beach Club , city =Kas, yearbuilt =2001,star=7,numofrooms=3600,pool=yes Hotel.create : hotel_name = Dedeman , city =Cesme, yearbuilt =2003,star=5,numofrooms=450,pool=yes end def self.down drop_table : hotels end end class Assignment ApplicationController def alllist @hotels = Hotel.find(:all) end end RHTML !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN http:// www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd html xmlns=http://www.w3.org/1999/xhtml; head html xmlns=http://www.w3.org/1999/xhtml; head meta http-equiv=Content-Type content=text/html; charset=utf-8 / titleList of Hotels/title /head body %for Hotel in @Hotels % li%=Hotel.hotel_name % /li %end% /body /html -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Introducing ResourceAwareness
Hi all, I want to invite you to check out ResourceAwareness, a small gem that makes available information about a Rails application's resources (as defined by the 'resource/s' routing DSL methods) at Rails.application.resources. http://github.com/ingoweiss/resource_awareness You can find a brief introductory post about it here: http://blog.ingoweiss.com/2010/05/10/resource-awareness.html There is also another post with a small example (dynamic ActiveResource client creation) for the kind of things that are possible once this resource information is available: http://blog.ingoweiss.com/2010/05/12/resource-awareness-and-active-resource.html Best Regards, Ingo Weiss http://github.com/ingoweiss -- You received 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] Introducing ResourceAwareness 0.1.0
Hi all, I want to invite you to check out ResourceAwareness, a small gem that makes available information about a Rails application's resources (as defined by the 'resource/s' routing DSL methods) at Rails.application.resources. http://github.com/ingoweiss/resource_awareness You can find a brief introductory post about it here: http://blog.ingoweiss.com/2010/05/10/resource-awareness.html There is also another post with a small example (dynamic ActiveResource client creation) for the kind of things that are possible once this resource information is available: http://blog.ingoweiss.com/2010/05/12/resource-awareness-and-active-resource.html Best Regards, Ingo Weiss http://github.com/ingoweiss -- You received 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] server side programming, using the Ruby on Rails (RoR) framework help please
On 23 May 2010 19:40, mustafacmpe mustafa.c...@gmail.com wrote: Hello , Hello! I have a home work shown below Homework and code i wrote are below what is missing here i dont know please help . I cant run it Well, I'm not prepared to *do* your homework for you; if you pass the course, and use the qualification to get a job, I doubt you'll be sending me the pay cheque! I would *assume* that you've been given all the info in your class to complete the homework, so I will help you out with some of the obvious problems so you can get it working yourself. class Assignment ActiveRecord::Migration def self.up create_table : Hotels do |t| There's two issues here. First, there shouldn't be a space after the colon, and the name of the table should be with a lower case H. So: create_table :hotels do |t| t.coloumn : hotel_name, :string You've misspelt column in all the rows, and again, there shouldn't be any spaces after the colons. Hotel.create : hotel_name = Anatolia Beach Hotel , city =Kemer, yearbuilt =2004,star=5,numofrooms=1200,pool=yes There *should* be colons in front of those hash-keys (and again, there shouldn't be a space after the colon). Also, you've created the fields :yearbuilt, :star and :numofrooms as integers in the DB, but you're assigning them as strings - Rails might sort that one for you, but better to be correct to begin with. So: Hotel.create :hotel_name = Anatolia Beach Hotel , :city =Kemer, :yearbuilt =2004, :star=5,numofrooms=1200, :pool=yes body %for Hotel in @Hotels % li%=Hotel.hotel_name % /li %end% /body /html There are some conventions in Ruby/Rails about naming objects, and one is that if a name begins with a capital letter it is a constant. So best not to name the variable in the loop Hotel (especially since that's the class of the object too (although you've not pasted any model code but you do have a hotel.rb file right?). Also, your instance varable is named @hotel in the controller, but you're accessing @Hotel here, so you would find out that the loop won't do anything, because @Hotel is nil. BTW, a more Ruby loop is to use an iterator instead of a for...each (but that's really a personal preference): % @hotels.each do |hotel| % li%= hotel.hotel_name % /li % end % That's a few issues that jump out of the code at me, and I guess there may be one or two more. But if you sort them out and try it again, it might run a little further. The next thing I suggest for you is a two-pronged attack: Firstly, when you come back and post your next message, give us some more information about *what you did*, and *what happened*. Saying I cant run it doesn't give us much to go on, but if you say I tried 'rake db:migrate' on my Ubuntu machine, and got a message that the db can't be found. How do I tell Rails about my db location? we can answer more accurately. Secondly, for your own personal development I would suggest concentrating a little more on the details - give it a little more attention. I spotted all those problems above with one look through your code; and I'm *sure* that if you had thought about it, you could have solved a few of them yourself :-) The Rails framework is an excellent tool, but like any tool you need to know how to use it properly to get the best results from it. Looking at the code, I guess you didn't use Rails generators to create a scaffolded application for you... it might be worth doing a quick Google, and approaching it that way, as the majority of the hard work will be done for you. But keep plodding through your problems one at a time, and eventually they all go, and you'll be left with lovely working code :-) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Questionairee's questions - how to show all user's answers? How to update database with ALL user's answers?
On 23 May 2010 17:52, Smoq smoq...@gmail.com wrote: In a table answers I have columns: question, a1, a2, a3 (these columns are answers to the question), a_u (user's answer), a_ok (correct answer). Below I have pasted the view that I am using for listing questions. Surely you have a Question model, which has the question text, and the three choices for answers (or even a Choice model, with a Question :has_may Choices relationship...), and in the Answer model you just store the question_id and the choice (or choice_id). But I have no idea how to list ALL answers at the bottom of the page (now I know how to show only one answer). And how (in the most effective way) to update the column a_u wtith ALL user's answers? For every question the user completes you have an Answer record (created when they answer a question, or updated if they're allowed to edit), so users have many answers, and you can iterate to display all wherever you wish. Could you help me? #-index.htm.erb begin-- h1Listing answers/h1 % @answers.each do |answer| % form !-- action = \answers\selected to gowno nie chce dzialac -- td%=h answer.question %/td input type=radio name=answer1 value= %=answer.a1% / %=h answer.a1 % input type=radio name=answer1 value= %=answer.a2% / %=h answer.a2 % input type=radio name=answer1 value= %=answer.a3% / %=h answer.a3 % input type=submit/ /form % end % br/ You selected %= @data11 % #-index.htm.erb end-- In answers_controller I have included: �...@data11 = params[:answer1] -- You received 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: Looking for Easy Rails hosting
Victor Stan wrote: With Heroku there's no git pull -- just push the code and it does everything else. The problem for me is that it wasn't that simple, the app didn't work. Yes, Heroku has certain limitations. But they don't apply to most apps. While in an environment like shared hosting (if were comparing low price things, Heroku has a small free option as well) More than small. Heroku's free dev hosting makes it excellent for projects in their early stages. Try doing that on Site5 or Slicehost. I have control over the database, I don't get how heroku's databases work... Standard PostgreSQL. No different from any other PostgreSQL installation. What's not to get? I'll assume that through ActiveRecord it doesn't matter. But whatever, if you want to see what's in the database, Site5 gives you PhpMyAdmin, That's a disadvantage -- PhpMyAdmin is apparently a known security hole. I don't know how you check what's in the database on Heroku. Then you didn't read their comprehensive documentation on this very subject. Site5 is shared hosting, not a VPS, right? If so, then the two aren't really comparable -- and Rails generally really wants a VPS. Well the question we are supposed to be answering here is what is easy rails hosting, not VPS vs shared. That's a whole other chapter. Site5 is shared, its easy. Its setup for you out of the box. That's all. And judging from the number of problems from Site5 users I've seen on this list, I doubt that it's easy. Rails is not generally easy on shared hosts. - V 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] Rails/JavaScript issue
Hey all, I have an application.js file in my javascripts folder of my Ruby on Rails application. The javascript is just a typical hide/show tabs effect, so when the user clicks on one link, the corresponding div is revealed and the other divs are hidden. Two pages require the javascript. However, while one page displays content of no tabs onload, the other page displays the content of the first tab onload. So the page that displays the content of no tab onload works fine. However, the page that displays the content of first tab onload is not working. I get the following error in FireBug: document.getElementById(tabs) is NULL var tabListItems = document.getElementById(tabs).childNodes; I think the issue is I'm calling multiple functions on page load (and hence since the one page doesn't have a tabs id it doesn't know what to do), even though I only need one function for each of the pages. But I wuld like to keep this tab effect in the same file. So I don't know what to do. Thanks for anyone's response: [CODE] window.onload = init; var tabLinks = new Array(); var contentDivs = new Array(); function init() { initProduct(); initAbout(); } function initProduct() { var tabListItems = document.getElementById(tabs).childNodes; for(var i=0; i tabListItems.length; i++) { if(tabListItems[i].nodeName == LI) { var tabLink = getFirstChildWithTagName(tabListItems[i], A); var id = getHash(tabLink.getAttribute(href)); tabLinks[id] = tabLink; contentDivs[id] = document.getElementById(id); tabLinks[id].className = ; contentDivs[id].className = tabContent hide; tabLinks[id].onclick = showTab; tabLinks[id].onfocus = function() { this.blur() }; } } } function initAbout() { var tabListItems = document.getElementById(tabAbout).childNodes; for(var i=0; i tabListItems.length; i++) { if(tabListItems[i].nodeName == LI) { tabLink = getFirstChildWithTagName(tabListItems[i], A) id = getHash(tabLink.getAttribute(href)); tabLinks[id] = tabLink; contentDivs[id] = document.getElementById(id); } } var i = 0; for(var id in tabLinks) { tabLinks[id].onclick = showTab; tabLinks[id].onfocus = function() { this.blur() } if(i == 0) { tabLinks[id].className = selected } i++ } var i = 0; for(var id in contentDivs) { if(i != 0) { contentDivs[id].className = tabContent hide; } i++ } } function showTab() { document.getElementById(product).className = tabContent hide var selectedId = getHash(this.getAttribute(href)); for(id in contentDivs) { if(id == selectedId) { tabLinks[id].className = selected; contentDivs[id].className = tabContent; } else { tabLinks[id].className = ; contentDivs[id].className = tabContent hide; } } return false; } function getFirstChildWithTagName(element, tagName) { for(var i=0; i element.childNodes.length; i++) { if(element.childNodes[i].nodeName == tagName) { return element.childNodes[i]; } } } function getHash(url) { var hashPos = url.lastIndexOf(#); return url.substring(hashPos + 1); } [/CODE] -- 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: [Rails 3] Trouble with named routes and form_for
I've also tried %= form_for @thread, :as = :thread % and this results in the error: undefined method `forum_threads_path' for ##Class:0x0103a45098:0x01039575a0 That would seem to be a bug to me. Shouldn't form_for be using :as = :thread to name that route appropriately? -M On May 23, 2010, at 2:52 AM, Michael Jurewitz wrote: Hi guys, I'm having trouble getting named routes and form_for to play nicely in quite the way I would expect. Here's a quick summary of what I've got going on: Named route: resources :thread, :class_name = forum_thread Controller name: forum_thread_controller Model object: forum_thread In both my new and edit actions I'm setting up an @thread variable: @thread = ForumThread.new 1.) My first attempt at writing the form_for looked something like this: %= form_for @thread do |f| % . % end This didn't work because @thread tries to use a path involving the string forum_thread, which doesn't have a matching route and which I don't want. 2.) So that's fine, I figured I'd just use named routes. So I tried this: %= form_for @thread, :as = :thread, :url = thread_path(@thread) do |f| % % end This works for edit actions, but not for new actions. On new I get the following error: No route matches {:action=destroy, :controller=forum_thread, :id=#ForumThread id: nil, .} 3.) So then I tried: %= form_for @thread, :as = :thread, :url = threads_path(@thread) do |f| % % end This doesn't work for edit, and sorta works for new except it outputs the following HTML, which makes the respond_to block unhappy: form action=/thread?format= class=thread_new id=thread_new method=post 4.) So then I tried: %= form_for @thread, :as = :thread, :url = threads_path do |f| % % end Now everything works for new, but not for edit! (Because the ID of the element being edited isn't emitted as part of the action): form action=/thread class=thread_edit id=thread_edit method=post So: 1. Is there some way to use a named route that uses a custom class name and still be able to reuse my form partial for both new and edit actions? Or am I stuck writing two forms? 2. Is the error I received in #2 a bug in Rails 3 or expected behavior? 3. Is the erroneous output in #3 a bug in Rails 3 or expected behavior? My sincere thanks in advance for your help! -Jury -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Rails/JavaScript issue
On Sun, May 23, 2010 at 2:21 PM, John Merlino li...@ruby-forum.com wrote: document.getElementById(tabs) is NULL var tabListItems = document.getElementById(tabs).childNodes; I think the issue is I'm calling multiple functions on page load (and hence since the one page doesn't have a tabs id it doesn't know what to do), even though I only need one function for each of the pages. But I wuld like to keep this tab effect in the same file. So I don't know what to do. 1) check the battery in your watch; it's so not 1997 anymore. :-) window.onload = init; That line looks resurrected from a seriously ancient tutorial -- read up on EventListeners to understand why it's a poor approach, and how you should be invoking your functions. 2) defensive coding: you can either test first to see if there is an element with the ID tabs or you can wrap the whole thing in a try/catch block. function initProduct() { var tabListItems = document.getElementById(tabs).childNodes; // } 3) Either way, it's strictly a JS question and has nothing to do with Rails. FWIW, -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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/JavaScript issue
In my initial post, I did say there was an element with an id of tabs, but that it was part of another page and not the page the error occured on. However,the same js file is being used for both pages. So that's the issue I'm trying to resolve here. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Rails/JavaScript issue
On Sun, May 23, 2010 at 3:27 PM, John Merlino li...@ruby-forum.com wrote: In my initial post, I did say there was an element with an id of tabs, but that it was part of another page and not the page the error occured on. However,the same js file is being used for both pages. So that's the issue I'm trying to resolve here. Yes, and I just explained how to do that. More than one way, actually. And it still has nothing to do with Rails :-) -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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/JavaScript issue
Also I don't think the getElementById() method was around in 1997. -- 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: Rails/JavaScript issue
On Sun, May 23, 2010 at 3:31 PM, John Merlino li...@ruby-forum.com wrote: Also I don't think the getElementById() method was around in 1997. ? Uh, well. I explicitly referenced the line window.onload = init; so, that has what now to do with getElementById ? :-) -- Hassan Schroeder hassan.schroe...@gmail.com twitter: @hassan -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-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: rendering in csv file
chewmanfoo wrote: I have an index page showing a table of network hosts with IP addresses, roles, hostname etc. Is it trivial to render that page to the browser as a csv file instead of html and link to that rendering on the index page? Yes. How is that done? The same way as you would for HTML -- specify a template to render. Check out respond_to for more. Is there a nice rails csv rendering for dummies page? You don't need one. Thanks in advance, 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] derived model associates with a model that base associates with in a different way
Hello, So I have an Attribute model with lists the attributes of an object. The attributes can be of different types so I have derived classes as well, in this case I have a derived SubjectiveAttribute. The problem I'm having revolves around my User model. A user is allowed to give each attribute a weighting (which tells the system how important an attribute is to a user). So, there's a Weight model and then Attribute has the associations has_many :weights and has_many :users, :through = :weights. The problem is that SubjectiveAttribute is related to the users in a different way, subjective attributes can be rated as well as weighted. So SubjectiveAttribute has the association has_many :ratings and has_many :users, :through = :ratings. def Attribute belongs_to :attributable, :polymorphic = true has_many :weights has_many :users, :through = :weights def SubjectiveAttribute Attribtue has_one :attribute, :as = :attributable has_many :ratings has_many :users, :through = :ratings Is this ok or are there problems which could occur that I'm no seeing? Are there going to be clashes or confusion when I do something like sub_attribute.users or attribute.users? Thanks in advance. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Would you recommend some books about Ruby on Rails?
goodchoi wrote: Hi everybody~ Vey nice to meet you on this group. I'm a only web service planner operating a site http://topics.co.kr/categories?q=iphone developed by Ruby-on-Rails engineers through payment. But I'm trying to do study Ruby on Rails by myself from now on. [...] I know my viewpoint is in the minority, but I don't recommend learning Rails from books -- the framework changes too fast, and paper book publishing just can't keep up. Read Programming Ruby (on the Web or on paper), read the Rails Guides, and play around. That's what worked for me (and I'm now doing high-profile Rails development at a Fortune 100 company). 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: attachment_fu and paperclip comparison needed
Hi I did not get a reply to this. Any comment please? 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] Installing merb - connection reset, retrying, connection reset, retrying....
This is my output. I don't know what to do to make this work. I have installed other gems without any problems. Suggestions? debian:/home/kevin# gem source -a http://www.rubygems.org http://www.rubygems.org added to sources debian:/home/kevin# gem install merb -V GET 302 Found: http://gems.rubyforge.org/latest_specs.4.8.gz GET 304 Not Modified: http://production.s3.rubygems.org/latest_specs.4.8.gz GET 301 Moved Permanently: http://www.rubygems.org/latest_specs.4.8.gz GET 302 Found: http://rubygems.org/latest_specs.4.8.gz GET 304 Not Modified: http://production.s3.rubygems.org/latest_specs.4.8.gz GET 302 Found: http://gems.rubyforge.org/specs.4.8.gz GET 304 Not Modified: http://production.s3.rubygems.org/specs.4.8.gz connection reset after 2 requests, retrying GET 301 Moved Permanently: http://www.rubygems.org/specs.4.8.gz connection reset after 2 requests, retrying -- You received 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: Installing merb - connection reset, retrying, connection reset, retrying....
I did gem update --system This seems to have fixed the problem. Who knows :) On May 24, 1:17 am, sso strongsilent...@gmail.com wrote: This is my output. I don't know what to do to make this work. I have installed other gems without any problems. Suggestions? debian:/home/kevin# gem source -ahttp://www.rubygems.orghttp://www.rubygems.orgadded to sources debian:/home/kevin# gem install merb -V GET 302 Found:http://gems.rubyforge.org/latest_specs.4.8.gz GET 304 Not Modified:http://production.s3.rubygems.org/latest_specs.4.8.gz GET 301 Moved Permanently:http://www.rubygems.org/latest_specs.4.8.gz GET 302 Found:http://rubygems.org/latest_specs.4.8.gz GET 304 Not Modified:http://production.s3.rubygems.org/latest_specs.4.8.gz GET 302 Found:http://gems.rubyforge.org/specs.4.8.gz GET 304 Not Modified:http://production.s3.rubygems.org/specs.4.8.gz connection reset after 2 requests, retrying GET 301 Moved Permanently:http://www.rubygems.org/specs.4.8.gz connection reset after 2 requests, retrying -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group athttp://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-t...@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.