[Rails] Re: RUBY ON RAILS MIGRATION
I highly recommend against composite keys. The composite gem breaks in every new rails version, and has broken edge cases. Stick with an integer primary key, and an integer for foreign keys. I wrote the foreigner gem. It expects that you are following the Rails conventions. It has no effect on your application's logic, it simply prevents bad data from getting into the database. The primary feature of it is that it creates a correct schema.rb, which is essential for my testing. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/1Bq5RqaqDU0J. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Faye server with rails 3.1
I want to use Faye on production server. how can I start faye server automatically or as a daemon process. Because when I start faye server using SSH it shutdown as i close ssh connection. Please guide me its really urgent. I can run faye server on local but how I can rub this on live site. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] fulltime job oppurtunity
We have multiple full time positions with our Client for talented Cloud Infrastructure Engineers and Architects. They are starting a large scale full life cycle project and are interviewing candidates within various disciplines. Underlying architecture will be a LAMP stack with CSS/AJAX/JavaScript based UI. Most part of the other developments will be carried out using technologies such as Java, JMS, Ruby On Rails, Python and MySQL. Job location can be Austin, TX or San Jose, CA. Kindly respond to this email with your resume if you are interested learning more about these positions. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: file uploading controller
you told to me this solution If you're using Paperclip or CarrierWave, just add two separate file attributes to your base model, following the usual instructions for either. If you want to be able to attach N number of files of any format to a base model, consider the nested_form Gem by Ryan Bates, and be sure to watch his Railscast on Complex Forms 1 2 to make sure you grasp what the gem is making for you. but,i am the fresher please told me how to add two separate file attributes in our model? kindly give me the solution with small 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] RJS error rails 1.2.3 + firefox 4 and above
Hi, In my application I used in admin module to expand and collpase functionality using ajax(link_to_remote) method. It's working fine in mozilla 3 and below version.. But when I using in mozilla 4 expand functinality was working fine but collapse are not work, it's just 'wrinkls'. My code is like below tr id=%= content_element_id % %= link_to_collapse(:school, content_element_id, icon_for_backend_collapse) % %= link_to_expand(:school, content_element_id, icon_for_backend_expand) % def link_to_expand(model_name, content_element_id, link_text) link_to_remote(link_text, :url = { :controller = manage/schools, :action = :show, :id = params[:id], :update = content_element_id, :partial= /manage/schools/expanded_table_row }, :alt = 'expand') end def link_to_collapse(model_name, content_element_id, link_text) link_to_remote(link_text, :url = { :controller = manage/schools, :action = :show, :id = params[:id], :update= content_element_id, :partial = /manage/schools/collapsed_table_row }, :alt = 'collapse') end any help regarding this would be appreciated.. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to use Oniguruma in ruby 1.9.2?
So what are the changes i have make in my ruby 1.8.7 syntax to parse my regular expressions for ruby 1.9.2 , Can you provide me some kind of link. On Aug 17, 11:54 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Aug 17, 3:26 pm, nishant nishantnig...@gmail.com wrote: Hello Guys , Can anyone explain me how to use Oniguruma in ruby 1.9.2 , I guess in ruby 1.9.2 its a default library so there is no need to install externally? I was using Oniguruma::ORegexp.new( in ruby 1.8.7 . Onigurama is the regular expression engine for 1.9.x - /foo/ will use onigurama Fred Thanks Nishant -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Best Rails install for production.
apache + mod_fcgi - I get better performance than when I tried apache/passenger and apache/mongrel. I'm running this set up under FreeBSD, CentOS 5.x and Mac OS X 10.6 Can be a bit tricky to set up.. Cheers, Eric On 14 aug 2011, at 12:45, Frederick Cheung wrote: On Aug 14, 10:33 am, Yaroslav Govorunov govoru...@gmail.com wrote: Hello! Which Ruby on Rails installation scenario is the best for performance and durability in production: - Ubunthu + Apache + Passanger - Ubunthu + Nginx + Unicorn - Ubunthu + Apache + Mongrel - Any other option? Well you've also got nginx + passenger. If you move to jruby then you get a bunch of other deploy options too. Personally I'm very happy with apache + passenger. Fred And could someone provide links to some best practice or guidelines to install Rails in production? Thank you! -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: how to work in group?
Rodrigo, take a look at Distributed Workflow section in Git Community Book: http://book.git-scm.com/3_distributed_workflows.html It is assumed there however that everybody in your project has access to the full code. Alexey. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: why callback does not work
On 17 August 2011 15:31, Angelo Cordova acord...@gmail.com wrote: Debugging will tell you whether the callback is being called. If you assign the result of Storage.create! to a variable and break after that then you will be able to inspect that object. I tried this def before_create debugger stg = Storage.create!(:product_id = self.product_id, :current_quantity = self.quantity, :stg_data = purchase.prc_data) end and when I inspect the variable stg I got stg = nil as result That is not surprising since you have broken *before* the line that allocates stg. Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Getting started problems
On 17 August 2011 17:45, Murtuza murtuzafi...@gmail.com wrote: I am a newbie to Ruby on Rails. I created a new rails project, but when i go to that directory and do rails server to start the server, it asks me whether i want to overwrite config/initializations/session_store.rb Which version of rails are you using? rails -v Colin Due to which I am unable to see the normal index.html, when I type localhost:3000 on my browser. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: autoloading LoadError: Expected known_ip.rb to define KnownIp
I couldn't make it work with Admin:: namespace and submitted a bug report: https://github.com/rails/rails/issues/2572 Please comment. Alexey. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Multiple Errors with RRD and Rake
Hello all, I am trying to install the SequreISP application (link below) but I'm facing an error that I cannot resolve and any help is much appreciated. The application I am trying to install is: https://github.com/sequre/sequreisp Here's some information about my system: OS: Centos 5.4 (Final) uname -a Linux gateway 2.6.18-164.el5 #1 SMP Thu Sep 3 03:33:56 EDT 2009 i686 i686 i386 GNU/Linux ruby 1.9.2p290 Rails 2.3.11 gem version 1.8.7 rake version 0.9.2 The command that's giving me errors is: rake db:migrate RAILS_ENV=production --trace The errors are: rake/rdoctask is deprecated. Use rdoc/task instead (in RDoc 2.4.2+) ** Invoke db:migrate (first_time) ** Invoke environment (first_time) ** Execute environment rake aborted! Could not open library 'rrd': rrd: cannot open shared object file: No such file or directory. Could not open library 'librrd.so': librrd.so: cannot open shared object file: No such file or directory /usr/local/lib/ruby/gems/1.9.1/gems/ffi-1.0.9/lib/ffi/library.rb:75:in `block in ffi_lib' /usr/local/lib/ruby/gems/1.9.1/gems/ffi-1.0.9/lib/ffi/library.rb:54:in `map' /usr/local/lib/ruby/gems/1.9.1/gems/ffi-1.0.9/lib/ffi/library.rb:54:in `ffi_lib' /usr/local/lib/ruby/gems/1.9.1/gems/rrd-ffi-0.2.7/lib/rrd/wrapper.rb:44:in `singletonclass' /usr/local/lib/ruby/gems/1.9.1/gems/rrd-ffi-0.2.7/lib/rrd/wrapper.rb:41:in `class:Wrapper' /usr/local/lib/ruby/gems/1.9.1/gems/rrd-ffi-0.2.7/lib/rrd/wrapper.rb:6:in `module:RRD' /usr/local/lib/ruby/gems/1.9.1/gems/rrd-ffi-0.2.7/lib/rrd/wrapper.rb:2:in `top (required)' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:184:in `require' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:184:in `require' /usr/local/lib/ruby/gems/1.9.1/gems/rrd-ffi-0.2.7/lib/rrd.rb:4:in `top (required)' /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `require' /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:68:in `block (2 levels) in require' /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:66:in `block in require' /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler/runtime.rb:55:in `require' /usr/local/lib/ruby/gems/1.9.1/gems/bundler-1.0.18/lib/bundler.rb:120:in `require' /opt/sequreisp/deploy/sequreisp/config/boot.rb:116:in `load_gems' /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/initializer.rb:164:in `process' /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/initializer.rb:113:in `run' /opt/sequreisp/deploy/sequreisp/config/environment.rb:13:in `top (required)' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `block in require' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:547:in `new_constants_in' /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.11/lib/active_support/dependencies.rb:182:in `require' /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.11/lib/tasks/misc.rake:4:in `block in top (required)' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `call' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:205:in `block in execute' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:200:in `execute' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:158:in `block in invoke_with_call_chain' /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:176:in `block in invoke_prerequisites' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:174:in `invoke_prerequisites' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:157:in `block in invoke_with_call_chain' /usr/local/lib/ruby/1.9.1/monitor.rb:201:in `mon_synchronize' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:151:in `invoke_with_call_chain' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/task.rb:144:in `invoke' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:112:in `invoke_task' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block (2 levels) in top_level' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `each' /usr/local/lib/ruby/gems/1.9.1/gems/rake-0.9.2/lib/rake/application.rb:90:in `block in top_level'
[Rails] I18n and routing: bug?
Hello! It seems I have the same bug in Rails 3.0.9... https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/4896 Why? Was it a bug? Is it a bug? Thank you! -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] how render to file
Hi I have a question when you open page from browser application renders the page and gives it to the browser how do that in action and save render page in html file 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] multiple fields_for behavior
With the following code and result below, why does the cars_attributes index (i.e. name=owner[cars_attributes][0][color]) increment in the second fields_for block when only one car is built? Shouldn't it stay the same because only one car was built? Is this standard behavior? If so, what is the standard way to force both indexes to be 0 (or increment together if there are more records)? This is an over-simplified example. The reason I want two fields_for blocks is due the arrangement of partials in another complex form. Much thanks! Matt # owners_controller.rb # ... def new @owner = Owner.new @owner.cars.build respond_to do |format| format.html # new.html.erb format.xml { render :xml = @owner } end end # ... # owner.rb class Owner ActiveRecord::Base has_many :cars accepts_nested_attributes_for :cars end # car.rb class Car ActiveRecord::Base belongs_to :owner end # new.html.erb %= form_for(@owner) do |f| % % if @owner.errors.any? % div id=error_explanation h2%= pluralize(@owner.errors.count, error) % prohibited this owner from being saved:/h2 ul % @owner.errors.full_messages.each do |msg| % li%= msg %/li % end % /ul /div % end % div class=field %= f.label :name %br / %= f.text_field :name % /div h2Cars/h2 %= f.fields_for :cars do |car_fields| % div class=field %= car_fields.label :color %br / %= car_fields.text_field :color % /div % end % === %= f.fields_for :cars do |car_fields| % div class=field %= car_fields.label :plate %br / %= car_fields.text_field :plate % /div % end % div class=actions %= f.submit % /div % end % # http://localhost:8081/owners/new # ... h2Cars/h2 div class=field label for=owner_cars_attributes_0_colorColor/labelbr / input id=owner_cars_attributes_0_color name=owner[cars_attributes][0][color] size=30 type=text / /div === div class=field label for=owner_cars_attributes_1_platePlate/labelbr / input id=owner_cars_attributes_1_plate name=owner[cars_attributes][1][plate] size=30 type=text / /div # ... -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to use Oniguruma in ruby 1.9.2?
On Aug 18, 7:58 am, nishant nishantnig...@gmail.com wrote: So what are the changes i have make in my ruby 1.8.7 syntax to parse my regular expressions for ruby 1.9.2 , Can you provide me some kind of link. I think it's all backwards compatible - your existing regular expressions should still work, but you now also have access to more features. Do you have any particular examples of things that aren't working as you expect? Fred On Aug 17, 11:54 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Aug 17, 3:26 pm, nishant nishantnig...@gmail.com wrote: Hello Guys , Can anyone explain me how to use Oniguruma in ruby 1.9.2 , I guess in ruby 1.9.2 its a default library so there is no need to install externally? I was using Oniguruma::ORegexp.new( in ruby 1.8.7 . Onigurama is the regular expression engine for 1.9.x - /foo/ will use onigurama Fred Thanks Nishant -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Faye server with rails 3.1
On 17 Aug 2011, at 23:31, ADNAN TAHIR wrote: I want to use Faye on production server. how can I start faye server automatically or as a daemon process. Because when I start faye server using SSH it shutdown as i close ssh connection. Please guide me its really urgent. I can run faye server on local but how I can rub this on live site. You may get a better response on the Faye mailing list: http://groups.google.com/group/faye-users But in general if you want to run a process automatically as a daemon, you want to add it to your system's init scripts, and/or put it under the control of some kind of monitoring system (e.g. Monit). As a temporary quick-and-dirty fix, you can keep a shell session on the server active by running it inside a terminal multiplexer like GNU Screen or tmux. This is not a long-term solution, though. Chris -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] how to work in group?
On 17 Aug 2011, at 19:23, Rodrigo Ruiz wrote: hi, I've started developing websites with rails about 3 months ago, and now I need to work with for people at the same project. How can I do that? first, I can't allow access of the entire code to everyone for security purpose; second, it seems to me that rails works in a very coupled way, I don't understand how I would be able to split the project in parts so I can delegate one part to each member of the team. It is possible to break up a Rails app (e.g. push bits of functionality out to gems/engines/etc.) but unless those bits of functionality are genuinely self-contained and well-defined then it's likely to be a hassle, and/or you'll end up having to do a bunch of speculative architecture design up-front. I would seriously consider whether it is worth this extra burden. There was a similar thread on this topic a few months ago: https://groups.google.com/forum/#!topic/rubyonrails-talk/QeyLmeaR9bM Chris -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to use Oniguruma in ruby 1.9.2?
I changed Oniguruma::ORegexp.new with Regexp.new for example contents.to_s.gsub!(regular_expression, replace text) but it returns a nil value and does`nt seem to working as expected like (\/p)\s+(p) for removing paragraph tags form the content and i keep recieving this error message in the terminal /home/user/.rvm/gems/ruby-1.9.2-p290/gems/activesupport-2.3.11/lib/ active_support/dependencies.rb:406: warning: nested repeat operator + and ? was replaced with '*': /li(?:\s+)?(.*?)(?:\s+)?\/li/ On Aug 18, 2:55 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Aug 18, 7:58 am, nishant nishantnig...@gmail.com wrote: So what are the changes i have make in my ruby 1.8.7 syntax to parse my regular expressions for ruby 1.9.2 , Can you provide me some kind of link. I think it's all backwards compatible - your existing regular expressions should still work, but you now also have access to more features. Do you have any particular examples of things that aren't working as you expect? Fred On Aug 17, 11:54 pm, Frederick Cheung frederick.che...@gmail.com wrote: On Aug 17, 3:26 pm, nishant nishantnig...@gmail.com wrote: Hello Guys , Can anyone explain me how to use Oniguruma in ruby 1.9.2 , I guess in ruby 1.9.2 its a default library so there is no need to install externally? I was using Oniguruma::ORegexp.new( in ruby 1.8.7 . Onigurama is the regular expression engine for 1.9.x - /foo/ will use onigurama Fred Thanks Nishant -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: file uploading controller
On Aug 18, 2011, at 2:30 AM, Kapil K. wrote: you told to me this solution If you're using Paperclip or CarrierWave, just add two separate file attributes to your base model, following the usual instructions for either. If you want to be able to attach N number of files of any format to a base model, consider the nested_form Gem by Ryan Bates, and be sure to watch his Railscast on Complex Forms 1 2 to make sure you grasp what the gem is making for you. but,i am the fresher please told me how to add two separate file attributes in our model? kindly give me the solution with small code? Assuming you are using Paperclip, and you have a Foo model, and you have read the ReadMe on the Paperclip GitHub page, you would do this: rails generate paperclip Foo image_one rails generate paperclip Foo image_two rake db:migrate Now you have the proper bits in your database. If you are using attr_accessible in your model (please say yes) then you have to add :image_one, :image_two, to the beginning of the list of accessible attributes. Add has_attached_file :image_one, :styles = {} has_attached_file :image_two, :styles = {} to your model. In your view's form_for call, add :html = { :multipart = true } before the do, so it looks like this: %= form_for @foo, :html = { :multipart = true } do |f| % In your form body, add a field for each image: %= f.file_field :image_one % %= f.file_field :image_two % And you're done. Files will upload to your public/system/foos/ image_[one|two]/original/ folder, off the top of my head. You can configure EVERYTHING, just read the Wiki. Walter -- 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: why callback does not work
I tried this def before_create debugger stg = Storage.create!(:product_id = self.product_id, :current_quantity = self.quantity, :stg_data = purchase.prc_data) end and when I inspect the variable stg I got stg = nil as result That is not surprising since you have broken *before* the line that allocates stg. Colin If I break after that line... stg does not appear -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] rails 3.1 select multiple with serialized data
In my Users model I have serialize :roles Letting it default to yml I enter roles as a text array. e.g., u.roles = [member,scorer] It displays as an array @user.roles.type returns Array All is fine except if I try to use the select form helper to input the values with multiple = true I've tried several version and I can't get the set values to trigger selected in the options tag. f.select(:roles, options_for_select(role_options,@user.roles),{}, {:multiple = true, :size = 5}) f.select(:roles, role_options,{},{:multiple = true, :size = 5}) (role_options is a helper method that return an array of valid role options. I had this working under 3.0, but using a kludge to put roles into a json hash. Steve -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: rails 3.1 select multiple with serialized data
Happens every time - I find the problem after the post. In the rails 3.0 version I capitalized the roles. In the rails 3.1 version I lower cased the roles. One of the few things I hate about ruby/rails case sensitivity. On Aug 18, 9:05 am, AppleII717 sa...@mac.com wrote: In my Users model I have serialize :roles Letting it default to yml I enter roles as a text array. e.g., u.roles = [member,scorer] It displays as an array @user.roles.type returns Array All is fine except if I try to use the select form helper to input the values with multiple = true I've tried several version and I can't get the set values to trigger selected in the options tag. f.select(:roles, options_for_select(role_options,@user.roles),{}, {:multiple = true, :size = 5}) f.select(:roles, role_options,{},{:multiple = true, :size = 5}) (role_options is a helper method that return an array of valid role options. I had this working under 3.0, but using a kludge to put roles into a json hash. Steve -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: rails 3.1 select multiple with serialized data
Add a before_save filter and downcase/upcase/titleize them for uniformity! Walter On Aug 18, 2011, at 10:22 AM, AppleII717 wrote: Happens every time - I find the problem after the post. In the rails 3.0 version I capitalized the roles. In the rails 3.1 version I lower cased the roles. One of the few things I hate about ruby/rails case sensitivity. On Aug 18, 9:05 am, AppleII717 sa...@mac.com wrote: In my Users model I have serialize :roles Letting it default to yml I enter roles as a text array. e.g., u.roles = [member,scorer] It displays as an array @user.roles.type returns Array All is fine except if I try to use the select form helper to input the values with multiple = true I've tried several version and I can't get the set values to trigger selected in the options tag. f.select(:roles, options_for_select(role_options,@user.roles),{}, {:multiple = true, :size = 5}) f.select(:roles, role_options,{},{:multiple = true, :size = 5}) (role_options is a helper method that return an array of valid role options. I had this working under 3.0, but using a kludge to put roles into a json hash. Steve -- You received 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to pass an ERB template as string?
Hello everyone, I'm using a gem called aws-ses and I'm trying to sophisticate the email I am sending, here is the code currently: ses = AWS::SES::Base.new(:access_key_id = 'foo', :secret_access_key = 'bar') email ={ :to = #{subscriber.email}, :source = '#{ag.name}' no-reply@#{ag.domain}', :subject = 'Hello', :html_body = h1#{subscriber.name}/h1 } ses.send_email email However, instead of passing a hard coded string to the :html_body key, I want to pass a template in app/views/layouts/mail.html.erb Is there any method/Rails helper that lets me convert an entire template to string and pass to the html_body key? P.S: If you have already used this gem and know a/another way to help me please do it ;) Thanks in advance, everyone! -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: why callback does not work
On 18 August 2011 14:50, Angelo Cordova acord...@gmail.com wrote: I tried this def before_create debugger stg = Storage.create!(:product_id = self.product_id, :current_quantity = self.quantity, :stg_data = purchase.prc_data) end and when I inspect the variable stg I got stg = nil as result That is not surprising since you have broken *before* the line that allocates stg. Colin If I break after that line... stg does not appear what do you mean it does not appear? Remember that you can inspect data and evaluate expressions in the debugger. Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] String column - Text, 255 limit?
On Aug 17, 2011, at 7:38 PM, Philip Hallstrom wrote: On Aug 17, 2011, at 3:32 PM, John Hinnegan wrote: So I'm using a column in my database to serialize a hash of extra data about an object. Stuff I'd want when displaying, but not anything else I care to have structured access to in my DB. I recently started storing an URL in field, so I decided I'd better change the column type from string (which it probably should never have been) to text. I did so with a standard migration def self.up change_column :my_table, :related_data, :text end Looking in my schema.db file, I see: t.text related_data, :limit = 255 I think I know how to fix it, but want some reinforcement I'm on the right track before I spend the time. Looks like what I really need is: def self.up add_column :my_table, :new_related_data, :text # copy data from related_data to new_related_data remove_column :my_table, :related_data rename_column :my_table, :new_related_data, :related_data end yes? Or just... change_column :my_table, :related_data, :text, :limit = 123456789 # or whatever you think is large enough -philip I think that the limit can be 2048 as I recall that is the max for a URL. I can't find a reference to back that up at the moment, but I think that this is what the sitemap specification (see Google) allows, too. -Rob Rob Biedenharn r...@agileconsultingllc.com http://AgileConsultingLLC.com/ r...@gaslightsoftware.com http://GaslightSoftware.com/ -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Namespaces and nested resources
Hello! I'm developing online game (Heroes fighting against Clans) and i'm planning next structure of my app: i've got top-level resources Heroes (profiles of supermembers) and Clans (profiles of groups of members). So i've got both HeroesController and ClansController. What i wanna do is give Heroes and Clans' leaders opportunities to add Content Resources to their profile area or to the clan area, respectively. Content Resources is different singular resources such as Gallery, Blog, Shop and others. So Gallery has many Photoalbums (that have many Photos), Blog has many Posts, Shop has goods and so on. Hero can turn on/off each of singular Content Resources, and after that he get its full functionallity on his own profile page The same thing with Clans - clan leader can connect in settings area for example Forum. So the question is how to organize this structure well. I think about that way: /controllers HeroesController ClansController /blog/ Blog::BlogsController Blog::PostsController /gallery/ Gallery::GalleriesController Gallery::PhotoalbumsController Gallery::PhotosController /models Hero Clan module Blog /blog/ Blog::Blog Blog::Post module Gallery /gallery/ Gallery::Gallery Gallery::Photoalbums Gallery::Photos And routes: resources :clans do scope :module = 'blog' do resource :blog do resources :posts end end scope :module = 'gallery' do resource :gallery do resources :photoalbums resources :photos end end end resources :heroes do .. the same things... end And here i've got a first problem - when i run /clan/1/blog/posts and even /clan/1/blog/posts/1/edit it all goes quite well, but it fails in simple /clan/1/blog saying: [No route matches {:action=show, :controller=clubs}] May be i'm doing everything wrong. May be i should choose another way instead of nested resources and/or namespaces, because i've heard it may be a bad practice :( I'm new in Rails, and i'm sorry for maybe easy questions :) Grateful for any help, suggestions and advises! Thank you! -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Trivial SQL query - how to do it with ActiveRecord?
Hi, I've been trying to read ActiveRecord tutorials etc. but haven't figured out how to get the information I want. Let's say I have a users who own one to many bookshelves and some of these bookshelves contain books. Now I would like to get a list of books that belong to user named Timeon: SELECT books.name FROM books, shelves, users WHERE books.shelve_id=shelves.id AND shelves.owner_id=users.id AND users.name='Timeon'; The models would be something like this (from the top of my head, may not be correct): Class User ActiveRecord::Base has_many :book_shelves end Class BookShelve ActiveRecord::Base belongs_to :user has_many :books end Class Book ActiveRecord::Base belongs_to :book_shelves end So, how to get a list of Book objects that belong to user named Timeon with a single line of code? Most examples I've seen first find the user, then they list the shelves etc. but I would expect something this trivial to be simple to achieve with a single call. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to disable rails from serving images in rails 3.1
Hello!! How can i disable the rails 3.1 in development mode from serving images? I have some pages with tons of images and sometimes the page takes more than 10 seconds to load... 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Rails 3.1rc6 assets / precompile change
I'm currently using Rails 3.1rc5, and deploy with capistrano. During deploy, I precompile the assets on the server using assets:precompile after deploy:symlink. I noticed that group :assets gems in my gemfile were being included in my production application processes (and adding a lot of memory usage), even though they are only used during the deploy. It looks like this change to rails 3.1rc6 - https://github.com/rails/rails/commit/0c57ae102f938b8f3d14d7cc37ab15b87bdaa4f5 - mean that assets will now not be included in production by default. Does this mean though that I need to precompile on my development PC first before deploying with capistrano, or will it also work as I currently have it - precompiling on the server ? I.e. will the asset gems still be available on the server, but just used for the precompile ? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Rails 3.1rc6 assets / precompile change
Correct url above should be https://github.com/rails/rails/commit/0c57ae102f938b8f3d14d7cc37ab15b87bdaa4f5 -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to navigate between view using select
Hi, im new to rails and I got a mind boggling issue. I have a select form populated with Institutes names e.g University of Yale. These records are obtained from the Institute ActiveRecord.The institutes table has a many to many relationships with the course table. My application should work such that when you select a certain institute using a select() component and press the button proceed to view courses available for the institute chosen. This will take you to a new page with the courses. My problem is that i don't know how i will store selected institute id and use it to select specific courses using the many to many relationships.. below are my code snippets == /app/controller/Course.rb class CourseController ApplicationController layout 'standard' def list @courses = Course.find(:all) end def show @course = Course.find(params[:id]) end def new @courses = Course.new @institutes = Institute.find(:all) # @cfilters = CourseFilter.find(params[:id]) end def create @course = Course.new(params[:course]) if @course.save redirect_to :action = 'list' else flash[:warning]=Failed to @courses = Course.find(:all) render :action = 'new' end end end == /app/views/institute/list.html.erb % if @institutes.blank? % pThere are not any institutes currently in the system./p % else % puSelect your chosen Institution/u/p form action=/course/show method=submit id = course_id %= select (submit, name, Institute.find(:all).collect {|c| [ c.name, c.id ] }, :prompt = Select Institute, :onchange = this.form.submit();)% %= submit_tag Proceed To Courses% /form %end% p%= link_to Add new College, {:action = 'new' }%/p === /app/views/courses/list.html.erb % if @courses.blank? % pThere are not any courses currently in the system./p % else % puSelect your chosen Course/u/p ul id=courses % Course.find(params[:id]).each do |c| % li%= link_to c.course_name, :action = show, :id = c.id %/li % end % /ul %= collection_select(:course,:id,@courses,:id,:course_name) %/p /ul-- form action=/unit/list method=submit %= submit_tag Proceed % /form % end % p%= link_to Add new College, {:action = 'new' }%/p === Would really need you help people. Thanx -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] need 2 lines of code in Ruby
Tell us which school/organization you wish to support The attached image is what the second line should look like - http://tinypic.com/r/2rehzlx/7 -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to navigate between view using select
Got the same problem myself and I'm yet to crack it! -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: why callback does not work
I tried this def before_create debugger stg = Storage.create!(:product_id = self.product_id, :current_quantity = self.quantity, :stg_data = purchase.prc_data) end and when I inspect the variable stg I got stg = nil as result That is not surprising since you have broken *before* the line that allocates stg. Colin If I break after that line... stg does not appear what do you mean it does not appear? Remember that you can inspect data and evaluate expressions in the debugger. Colin When I used debugger the first time (in the line before the callback) I chose option var local and I got stg = nil But when I use debugger after that line I get this blk = #Proc:0xc302b34@/usr/local/ruby/lib/ruby/gems/1.9.1/gems/ activerecord-3.0.9/lib/active_record/callbacks.rb:277 halted = false key = nil name = nil result = true value = 88 And if I try to inspect stg I get var instance stg NameError Exception: undefined local variable or method `stg' for #DetailPurchase:0xb4d3054 -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] How to navigate between view using select
There are few issue in this: 1. You should not be doing sql queries directly from views, instead set the instance variable in controller and pass it to view. 2. Your form is submitting to /course/show, instead it should be /course/list 3. Controller name should be plural, you have got the name as Course Controller, but the corresponding views directory is courses 4. To follow along with rails standards, you should be name of your list action should be index 5. Your select field should set institute, id instead of select, name 6. Course list action should filter the course list based on the institute id, something like Course.find_by_institute_id(params[:institute][:id]) Fix these and maybe you will figure out a solution. Chirag http://sumeruonrails.com On Thu, Aug 18, 2011 at 10:10 PM, kevin ng'eno li...@ruby-forum.com wrote: Hi, im new to rails and I got a mind boggling issue. I have a select form populated with Institutes names e.g University of Yale. These records are obtained from the Institute ActiveRecord.The institutes table has a many to many relationships with the course table. My application should work such that when you select a certain institute using a select() component and press the button proceed to view courses available for the institute chosen. This will take you to a new page with the courses. My problem is that i don't know how i will store selected institute id and use it to select specific courses using the many to many relationships.. below are my code snippets == /app/controller/Course.rb class CourseController ApplicationController layout 'standard' def list @courses = Course.find(:all) end def show @course = Course.find(params[:id]) end def new @courses = Course.new @institutes = Institute.find(:all) # @cfilters = CourseFilter.find(params[:id]) end def create @course = Course.new(params[:course]) if @course.save redirect_to :action = 'list' else flash[:warning]=Failed to @courses = Course.find(:all) render :action = 'new' end end end == /app/views/institute/list.html.erb % if @institutes.blank? % pThere are not any institutes currently in the system./p % else % puSelect your chosen Institution/u/p form action=/course/show method=submit id = course_id %= select (submit, name, Institute.find(:all).collect {|c| [ c.name, c.id ] }, :prompt = Select Institute, :onchange = this.form.submit();)% %= submit_tag Proceed To Courses% /form %end% p%= link_to Add new College, {:action = 'new' }%/p === /app/views/courses/list.html.erb % if @courses.blank? % pThere are not any courses currently in the system./p % else % puSelect your chosen Course/u/p ul id=courses % Course.find(params[:id]).each do |c| % li%= link_to c.course_name, :action = show, :id = c.id %/li % end % /ul %= collection_select(:course,:id,@courses,:id,:course_name) %/p /ul-- form action=/unit/list method=submit %= submit_tag Proceed % /form % end % p%= link_to Add new College, {:action = 'new' }%/p === Would really need you help people. Thanx -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: why callback does not work
On 18 August 2011 17:48, Angelo Cordova acord...@gmail.com wrote: I tried this def before_create debugger stg = Storage.create!(:product_id = self.product_id, :current_quantity = self.quantity, :stg_data = purchase.prc_data) end and when I inspect the variable stg I got stg = nil as result That is not surprising since you have broken *before* the line that allocates stg. Colin If I break after that line... stg does not appear what do you mean it does not appear? Remember that you can inspect data and evaluate expressions in the debugger. Colin When I used debugger the first time (in the line before the callback) I chose option var local and I got stg = nil But when I use debugger after that line I get this blk = #Proc:0xc302b34@/usr/local/ruby/lib/ruby/gems/1.9.1/gems/ activerecord-3.0.9/lib/active_record/callbacks.rb:277 halted = false key = nil name = nil result = true value = 88 And if I try to inspect stg I get var instance stg NameError Exception: undefined local variable or method `stg' for #DetailPurchase:0xb4d3054 I have occasionally had problems with the debugger statement at the end of a method with it apparently dropping out of the method before breaking, so that variables are no longer accessible. Add an extra line after the debugger statement (i=0 for example) to give it something to break on. On a separate issue, looking at the message you get, are you using ruby 1.9.1? If so then upgrade to 1.9.2 or go back to 1.8.7, ruby 1.9.1 does not work reliably with rails. This may have nothing to do with your problem. I note that you still have not answered my question (unless I missed it), have you any validations on the Storage model? Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Validates attributes that aren't even being changed
I temporarily solved the username attribute by not letting the user update the username. So the validation only works :on = :create So username attribute validation problem solved. Now I got the password validation problem. Ok, it seems the problem was kinda of obvious but I couldn't see it. In user.rb I have this... - validates :password, :presence = true, :length = { :minimum = 6, :maximum = 20, :message = 'should have between 6 to 12 characters' }, :confirmation = true -- but the password attribute doesn't even exist because it's a virtual attribute. The real attributes are password_hash and password_salt. So the Change Password and Password Reset controllers and forms work well. When I go to the Edit User page, user can edit... * first name * last name * email * there is NO Password field PROBLEM: So when the user tries to update his, let's say, first name and clicks on Save Changes, I get a password length and password can't be blank validation error. I'm searching for something like rails validation exception to solve this problem. If you have any suggestions please let me 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] need 2 lines of code in Ruby
On 18 August 2011 16:52, himanshu soni soni.himanshu...@gmail.com wrote: Tell us which school/organization you wish to support The attached image is what the second line should look like - http://tinypic.com/r/2rehzlx/7 Is there a question there somewhere? Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to navigate between view using select
Chirag Singhal wrote in post #1017338: There are few issue in this: Thanx alot Chirag, let me try out your hints . Will get back to you -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Rails 3 - Production Environment
Hello Everyone, I need some help related to the below requirements: - I need to setup production environment without installing Ruby or Rails or other related gems into it. I did accomplish the same using JRuby, bundler and warbler plugin. And deployed the WAR file into Apache Tomcat server. But now I have to do this without JRuby Apache Tomcat. - I have to setup Apache with Passenger module in production environment. So is there any way to just install and configure apache and passenger alone, and no need to install Ruby or Rails or any other gems? - Performance wise - which is better among the following options: 1) Apache + Passenger (using Ruby) 2) Ngnix + Passenger (using Ruby) 3) Apache + Mongrel cluster (using Ruby) 4) Tomcat using JRuby 5) Glassfish + Apache using JRuby - I personally found in development machines that Ruby (webrick) is faster than JRuby (webrick). Am I correct? Will it be the same in Production environment too? Also, let me know if there is any tutorial for installing and configuring Apache Passenger module. Thanks in advance. Regards, Vasanth -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Validates attributes that aren't even being changed
Can someone help me complete this piece of code? I'm thinking about using :unless because the only place where I wouldn't like the password validation is in the Edit User page. validates :password, :presence = true, :length = { :minimum = 6, :maximum = 20, :message = 'should have between 6 to 12 characters' }, :confirmation = true, :unless = I tried... :unless = params[:controller] == 'users' and params[:action] == 'edit' but I got the following error... Routing Error undefined local variable or method `params' for #Class:0x7f92ca83a518 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] difference between %= and %
Hi all what is the difference between %= and % in a view file? 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: How to disable rails from serving images in rails 3.1
Nvm, the problem was with mongoid! MODEL PRELOADING In order to properly set up single collection inheritance, Mongoid needs to preload all models before every request in development mode. This can get slow, so if you are not using any inheritance it is recommended you turn this feature off. config.mongoid.preload_models = false -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] namespaces as scope :module
Hello! I've got Gallery resource with namespaces: /gallery/galleries_controller.rb /gallery/albums_controller.rb /gallery/photos_controller.rb and models Gallery::Gallery, Gallery::Album and Gallery::Photo in my / models/gallery/ folder I want my Gallery work like standart resource: site.com/galleries/2/ albums/3, but being incapsulated in own folders, so i write in routes.rb this rules: scope :module = gallery do resources :galleries do resources :albums end end And then i've trouble using, i.e. @gallery = Gallery::Gallery.find(1); redirect_to(@gallery); undefined method `gallery_gallery_url' -- but why `gallery_gallery_url' when i expect just `gallery_url' like it is in rake routes? next time i write % @gallery = Gallery::Gallery.find(1); % %= form_for @gallery do |f| % undefined method `gallery_galleries_path' -- i need to manualy add :url option: %= form_for @gallery, :url = galleries_path do |f| % What's wrong? What i have to do with this issue? Thanks for 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Math with table rows
Lets supose I have a User table, and on this table I have height, weight and result rows. In a form I input height and weight values and want to multiply those two values and store on the resulta row on database. I was trying something like that def criar @user = User.new(params[:user]) @result = @user.height * @user.weight @user.result = @result But its not working, what am i doing wrong? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Math with table rows
2011/8/18 Cássio Godinho cassiopgodi...@gmail.com: In a form I input height and weight values and want to multiply those two values and store on the resulta row on database. I was trying something like that def criar @user = User.new(params[:user]) @result = @user.height * @user.weight @user.result = @result But its not working, what am i doing wrong? What does not working mean? -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschroeder 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] How to get all urls of my application?
Hello everyone, how can I get all available urls of my application, I don't mean rake routes I mean some code that returns literally all the urls (or paths) for example let's say it's a blog application, with this code I should be able to see: / /about /contact /posts /posts/2011-08-18 /posts/2011-08-18/blah-blah /posts/2011-08-15/lalala /posts/2011-08-18/foo /posts/2011-08-18/bar /posts/2011-08-18/baz Well, this is the point.. do you have any idea on how to do it? A appreciate any reply! 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: how render to file
done. example how do that. after_filter :write_file def index end protected def write_file File.open('public/test.html', 'w+') do |f| f.write response.body end end On Aug 18, 5:41 am, Shukhrat Tursunov shuhra...@gmail.com wrote: Hi I have a question when you open page from browser application renders the page and gives it to the browser how do that in action and saverenderpage in htmlfile 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: why callback does not work
On a separate issue, looking at the message you get, are you using ruby 1.9.1? If so then upgrade to 1.9.2 or go back to 1.8.7, ruby 1.9.1 does not work reliably with rails. This may have nothing to do with your problem. I'm using ruby 1.9.2 I note that you still have not answered my question (unless I missed it), have you any validations on the Storage model? I have validations for presence (product_id, current_quantity and stg_data) and for numericality (current_quantity) -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Fedena 2.1 is released
The long-awaited release of Fedena 2.1 is now available at Project Fedena. There are lot of new features added and all the identified issues of version 2.0 is resolved in this release. Official Blogpost - http://blog.foradian.com/fedena-21-is-released Github - https://github.com/projectfedena/fedena_v2.1 Release notes - http://projectfedena.org/changelog Related Downloads - http://projectfedena.org/download Installation Instructions - http://projectfedena.org/install -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] LDAP Models
I'm running Rails 3.09/Ruby 1.8.7, and I'm looking for some advice on how to create models from LDAP servers. I see there is an ActiveLDAP gem floating around out there, but it's Rails 3 support is only for 3.1rc4. Specifically, I'm trying to compare my user base on one LDAP server to another LDAP server. Thanks, Eric -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: why callback does not work
On a separate issue, looking at the message you get, are you using ruby 1.9.1? If so then upgrade to 1.9.2 or go back to 1.8.7, ruby 1.9.1 does not work reliably with rails. This may have nothing to do with your problem. No, I'm using ruby 1.9.2 I note that you still have not answered my question (unless I missed it), have you any validations on the Storage model? Finally, I found the problem. It was a validation on storage, I removed it, and everything works perfect Thanks for your help, thanks for your patience -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Opening a folder for file selection
Could you provide a code example of the connection between the links and an action that sends the file? I now have a list of links on a page but clicking them gives: Firefox doesn't know how to open this address, because the protocol (c) isn't associated with any program. Thanks, Barney On Aug 17, 8:43 pm, Barney bsper...@gmail.com wrote: Thanks, I'll give those steps a try. The name is leftover from earlier work and should be changed, as you've pointed out. Barney On Aug 17, 7:52 pm, 7stud -- li...@ruby-forum.com wrote: One way: 1) Get thefilenames: Dir.foreach or Dir.glob. 2) Create a view that provides a list oflinks, one for each file. 3) Thelinksconnect to another action, which sends the file. Why is your action named 'upload'? How about 'download'? -- 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: difference between %= and %
And you couldnt just try that out yourself? :D On Aug 18, 7:39 pm, Pepe Sanchez li...@ruby-forum.com wrote: Hi all what is the difference between %= and % in a view file? thanks -- 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] newbie: handling a method error
Hi... I have 2 tables, connected with belongs_to and has_one and everything works ok until I get one entry in base where I dont have set id of belongs_to entry. How can I prevent it(except that that all entry has ids :) or dont print anithing in view? this is what I am talking about: I have customer and it has firm_id trable firm has id and name so when I try to print customer.firm.name I got error. Thank you -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] How to get all urls of my application?
On Aug 18, 2011, at 2:25 PM, Rodrigo Alves Vieira wrote: Hello everyone, how can I get all available urls of my application, I don't mean rake routes I mean some code that returns literally all the urls (or paths) for example let's say it's a blog application, with this code I should be able to see: / /about /contact /posts /posts/2011-08-18 /posts/2011-08-18/blah-blah /posts/2011-08-15/lalala /posts/2011-08-18/foo /posts/2011-08-18/bar /posts/2011-08-18/baz Well, this is the point.. do you have any idea on how to do it? Assuming you have linked all of these, you could crawl the site with wget, pipe the filenames to cat and build a text file. What form are you looking for these paths? Do you need a text file, or do you want to generate a sitemap or something like that? Walter A appreciate any reply! 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 . -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Conflicts with Scriptaculous and jQuery
Hi all, I have this rails website that works fine, but I wanted to experiment with jQuery a little so I added all the necessary file to my JavaScript folder and, well, all hell broke lose in that adding jQuery causes Scriptaculous/Prototype not to work while jQuery works kinda-fine. Doing a search on Google and even here, the overwhelming majority of people suggested the solution of using jQuery.noConflict(); to relinquish control of the $ variable back to Prototype. However, after struggling with this for almost a full day I can say with 100% certainty that this is not the cause of my problem. I also tried: (function($) { $(document).ready(function(){ . }); })(jQuery); with no luck. I get no JavaScript errors, but what I do get is a line under my text_boxes, which use auto_complete, which usually only happens when I have multiple tags with the same id on the same page, but I know for a fact that is not the problem here. So I am really at a loss, just wondering if anybody has had this same issue and how did they fix it? I'm using Rails 2.3.4 and jQuery 1.5.2. Thanks, -S -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Conflicts with Scriptaculous and jQuery
I fixed it. Here was the problem. In my JavaScript include lines I had this: %= javascript_include_tag :defaults, 'scriptaculous', 'prototype', 'effects', 'controls', 'date-picker', 'jquery', 'jquery.min', 'application' % script // Don't take this out as long as you are using the jQuery and Scriptacous libraries together. They don't play well together. var $j = jQuery.noConflict(); /script And I changed it to this: %= javascript_include_tag 'jquery', 'jquery.min' % script // Don't take this out as long as you are using the jQuery and Scriptacous libraries together. They don't play well together. var $j = jQuery.noConflict(); /script %= javascript_include_tag :defaults, 'scriptaculous', 'prototype', 'effects', 'controls', 'date-picker', 'application' % Apparently the relinquishing of this all import variable $ must be done after I include the necessary jQuery script files but before I include the Sciptaculous/Prototype script files. Hopefully this helps someone. -S -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] newbie: handling a method error
On 18 August 2011 21:58, Dorijan Jelincic dma...@gmail.com wrote: Hi... I have 2 tables, connected with belongs_to and has_one and everything works ok until I get one entry in base where I dont have set id of belongs_to entry. How can I prevent it(except that that all entry has ids :) or dont print anithing in view? this is what I am talking about: I have customer and it has firm_id trable firm has id and name so when I try to print customer.firm.name I got error. %= customer.firm.name if customer.firm % Or possibly better to provide a method, say firm_name, of Customer that tests self.firm and returns the name or nil or maybe a default string if that is what you want, then do %= customer.firm_name % Colin -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: difference between %= and %
Tim Shaffer wrote in post #1017353: %= prints the contents of the tag, Well, it never meant that. %= tells ruby to print the result of the expression between the tags. For instance, %= 2+2 % would not print '2 + 2', it would print '4'. But even the result of the expression isn't an entirely accurate description--because in rails 3 you write: %= form_for(@user) do |f| % which doesn't fit that description. In ruby, 'form_for(@user) do |f|' isn't an expression--it's the first half of a loop/block, so it's an incomplete expression. In other words, in ruby if you wrote: result = some_func(arg) do |x| you would get an error. Maybe its best to think of %= form_for() as an exception to the rule? One example of how %= and % differ is this: % 3.times do |i| % divloop: %= i %/div % end % The % tags just execute the ruby code and don't enter any text onto the page, which causes ruby/.erb to loop over the div tag 3 times. The %= tag inside the loop prints the value of the variable i. So you get: divloop: 0/div divloop: 1/div divloop: 2/div -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] newbie: handling a method error
On Thu, Aug 18, 2011 at 2:51 PM, Colin Law clan...@googlemail.com wrote: customer.firm.name I got error. %= customer.firm.name if customer.firm % Or possibly better to provide a method, say firm_name, of Customer that tests self.firm and returns the name or nil or maybe a default string if that is what you want, then do %= customer.firm_name % FWIW, I found Avdi Grimm's e-book on this topic well worth the price: http://exceptionalruby.com/ -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschroeder 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Example of work with mongo
More examples: Save any pure Ruby object (also complex nested) in MongoDB https://github.com/alexeypetrushin/mongo_db + driver API enhancements (100% backward-compatible with original API), makes API more friendly handy, no extra abstraction or complexities introduced, all things are exactly the same as in MongoDB. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: namespaces as scope :module
Spent a few hours looking through RoR sources and seems like i found some kind of solution: If we override property @_model_name in our models we can strip out Gallery:: from it: class Gallery::Gallery ActiveRecord::Base @_model_name = Gallery.model_name(self) end And in module: module Gallery def self.table_name_prefix 'gallery_' end def self.model_name(klass) @_model_name = ActiveModel::Name.new(klass, false, klass.name.sub(Gallery::, )) end end And it works! Now form_for(@gallery) and link_to(@gallery) use galleries_path for action instead of non-existent gallery_galleries_path The only thing i want to know now is - am i criminal now after doing theese practices? Is it legal to override this property for this reason? Thank you. On Aug 18, 9:44 pm, Ajaxy alx.zinc...@gmail.com wrote: Hello! I've got Gallery resource with namespaces: /gallery/galleries_controller.rb /gallery/albums_controller.rb /gallery/photos_controller.rb and models Gallery::Gallery, Gallery::Album and Gallery::Photo in my / models/gallery/ folder I want my Gallery work like standart resource: site.com/galleries/2/ albums/3, but being incapsulated in own folders, so i write in routes.rb this rules: scope :module = gallery do resources :galleries do resources :albums end end And then i've trouble using, i.e. @gallery = Gallery::Gallery.find(1); redirect_to(@gallery); undefined method `gallery_gallery_url' -- but why `gallery_gallery_url' when i expect just `gallery_url' like it is in rake routes? next time i write % @gallery = Gallery::Gallery.find(1); % %= form_for @gallery do |f| % undefined method `gallery_galleries_path' -- i need to manualy add :url option: %= form_for @gallery, :url = galleries_path do |f| % What's wrong? What i have to do with this issue? Thanks for 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: ActiveRecord (not Rails!)
7stud -- wrote in post #1017182: Do you have mysql installed? mysql and the ruby mysql adapter are different things. Yes of course! And I have a database ready to be used with an activerecord application. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: ActiveRecord (not Rails!)
7stud -- wrote in post #1017183: Also, if you post your question plus the 'gem environment' output in the Ruby forum, they will be able to pinpoint what is going on very quickly. Your question is really a rubygems question, so posting it in the main Ruby forum is more appropriate. I posted there without any success, which is why I tried this topic list. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: ActiveRecord (not Rails!)
Do you have installed the libmysqlclient? If not, install the libmysqlclient and reinstall the mysql gem. 2011/8/18 Marc Chanliau li...@ruby-forum.com 7stud -- wrote in post #1017183: Also, if you post your question plus the 'gem environment' output in the Ruby forum, they will be able to pinpoint what is going on very quickly. Your question is really a rubygems question, so posting it in the main Ruby forum is more appropriate. I posted there without any success, which is why I tried this topic list. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- Fernando Almeida www.fernandoalmeida.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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Question about query
Hi guys, I have the following problem: In my application there is 3 entities that have this relationship: -1 post has many comments -1 comment belongs to one user and to one post -1 comment could be voted by many users My problem is how can I make a query to search for the best rated comment, in other words, How can I get the comment from one user which has the most quantity of good votes? I don't know how to make this query... ;/ my entities are structure like this: class Post ActiveRecord::Base belongs_to :user belongs_to :post_type has_many :post_comments end class PostComment ActiveRecord::Base belongs_to :user belongs_to :post has_many :post_comment_votes end class PostCommentVote ActiveRecord::Base belongs_to :vote_type belongs_to :user belongs_to :post_comment end class VoteType ActiveRecord::Base has_many :post_comment_votes end Thx ;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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: ActiveRecord (not Rails!)
On Thu, Aug 18, 2011 at 4:57 PM, Marc Chanliau li...@ruby-forum.com wrote: Your question is really a rubygems question, so posting it in the main Ruby forum is more appropriate. I posted there without any success, which is why I tried this topic list. What would you call success? I responded to your ruby-list posting but didn't see any response to my suggestions :-) -- Hassan Schroeder hassan.schroe...@gmail.com http://about.me/hassanschroeder 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-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] How to pass an ERB template as string?
On Thu, Aug 18, 2011 at 11:09 PM, Rodrigo Alves Vieira rodrig...@gmail.comwrote: Hello everyone, I'm using a gem called aws-ses and I'm trying to sophisticate the email I am sending, here is the code currently: ses = AWS::SES::Base.new(:access_key_id = 'foo', :secret_access_key = 'bar') email ={ :to = #{subscriber.email}, :source = '#{ag.name}' no-reply@#{ag.domain}', :subject = 'Hello', :html_body = h1#{subscriber.name}/h1 } ses.send_email email However, instead of passing a hard coded string to the :html_body key, I want to pass a template in app/views/layouts/mail.html.erb Is there any method/Rails helper that lets me convert an entire template to string and pass to the html_body key? P.S: If you have already used this gem and know a/another way to help me please do it ;) Sorry, I haven't used the gem yet but if you want to evaluate an erb file, you might want to check out the ERB class. http://ruby-doc.org/stdlib/libdoc/erb/rdoc/classes/ERB.html Thanks in advance, everyone! -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- - visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: how to work in group?
Thank you everyone, and that link helped me with git. Well, setting aside the code access concern, the other thing I wanted to know is how to work in a team with rails, and I mean, how should I split my project? For example, one member will do the Controllers, other will do the Models, other will do the Views, one for Mailers, and one for Tests. That is probably a wrong example, so thats what I need to know, how to explicitly split parts of my project for each one to work on. It seems to me that rails is like a one way straight coding, you can't work on one part of the code without completing all the others that should come before. I don't know if I was very clear, so please give me some feedback if I wasn't. If I was, thought, please give me answers =) Thank you guys. Ps.: Ruby (or Rails) community is awesome, every single question I've made was answered. On Thu, Aug 18, 2011 at 4:12 AM, Alexey Muranov li...@ruby-forum.comwrote: Rodrigo, take a look at Distributed Workflow section in Git Community Book: http://book.git-scm.com/3_distributed_workflows.html It is assumed there however that everybody in your project has access to the full code. Alexey. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] LDAP Models
Devise + LDAP is a good idea to do it https://github.com/cschiewek/devise_ldap_authenticatable 2011/8/18 Beerlover88 ericschovi...@gmail.com I'm running Rails 3.09/Ruby 1.8.7, and I'm looking for some advice on how to create models from LDAP servers. I see there is an ActiveLDAP gem floating around out there, but it's Rails 3 support is only for 3.1rc4. Specifically, I'm trying to compare my user base on one LDAP server to another LDAP server. Thanks, Eric -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] LDAP Models
I have had good success using the net-ldap gem (http://rubygems.org/gems/net-ldap). Though you will need to map the attribute values to your model by hand. Long --- On Thu, 8/18/11, Beerlover88 ericschovi...@gmail.com wrote: From: Beerlover88 ericschovi...@gmail.com Subject: [Rails] LDAP Models To: Ruby on Rails: Talk rubyonrails-talk@googlegroups.com Date: Thursday, August 18, 2011, 6:24 PM I'm running Rails 3.09/Ruby 1.8.7, and I'm looking for some advice on how to create models from LDAP servers. I see there is an ActiveLDAP gem floating around out there, but it's Rails 3 support is only for 3.1rc4. Specifically, I'm trying to compare my user base on one LDAP server to another LDAP server. Thanks, Eric -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Opening a folder for file selection
Okay. But I am a beginner too, so I don't know if this is the best way. I'm assuming the path to your folder is: /public/files_to_read class PagesController ApplicationController def home @title = Home end def get_files dir_path = 'public/files_to_read' Dir.chdir(dir_path) do @fnames = Dir.glob(*) end end def download dir_path = 'public/files_to_read' fname = params[:fname] Dir.chdir(dir_path) do allowed_fnames = Dir.glob(*) if allowed_fnames.include?(fname) send_file(#{RAILS_ROOT}/#{dir_path}/#{fname}, :filename = fname) else @title = 'Home' render 'home' end end end end === Test2App::Application.routes.draw do root :to = pages#home get 'pages/get_files' get 'pages/download' === h1Pages#home/h1 pFind me in app/views/pages/home.html.erb/p %= link_to Read a file, {:controller = 'pages', :action = 'get_files'} % === h1Pages#get_files/h1 divFind me in app/views/pages/get_files.html.erb/div h3Click the file you want to download:/h3 % @fnames.each do |fname| % div%= link_to fname, :controller = 'pages', :action = 'download', :fname = fname %/div % end % === !DOCTYPE html html head title%= @title %/title %= csrf_meta_tag % /head body %= yield % /body /html === http://localhost:3000 = home.html.erb click on Read file link = get_file.html.erb click on a filename link = computer downloads the file The reason for the code: if allowed_names.include?( ) is to prevent a hacker from going to the page of links, and then instead of clicking on a link, entering: http://localhost:3000/pages/download?fname=/path/to/secrets.txt If you don't check the fname that the server receives, a hacker can download any file they want. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: multiple fields_for behavior
I solved this using content_for. I put everything in the first fields_for but the fields I wanted to move to a different partial, I placed in the content_for block. See the example below. Hope this helps, Matt # example %= f.fields_for :cars do |car_fields| % div class=field %= car_fields.label :color %br / %= car_fields.text_field :color %br / /div % content_for :plate_fields do % div class=field %= car_fields.label :plate %br / %= car_fields.text_field :plate %br / /div % end % % end % === %# This can go anywhere... i.e. another partial % %= content_for :plate_fields % On Aug 17, 11:40 pm, Matt Smith matthewcalebsm...@gmail.com wrote: With the following code and result below, why does the cars_attributes index (i.e. name=owner[cars_attributes][0][color]) increment in the second fields_for block when only one car is built? Shouldn't it stay the same because only one car was built? Is this standard behavior? If so, what is the standard way to force both indexes to be 0 (or increment together if there are more records)? This is an over-simplified example. The reason I want two fields_for blocks is due the arrangement of partials in another complex form. Much thanks! Matt # owners_controller.rb # ... def new @owner = Owner.new @owner.cars.build respond_to do |format| format.html # new.html.erb format.xml { render :xml = @owner } end end # ... # owner.rb class Owner ActiveRecord::Base has_many :cars accepts_nested_attributes_for :cars end # car.rb class Car ActiveRecord::Base belongs_to :owner end # new.html.erb %= form_for(@owner) do |f| % % if @owner.errors.any? % div id=error_explanation h2%= pluralize(@owner.errors.count, error) % prohibited this owner from being saved:/h2 ul % @owner.errors.full_messages.each do |msg| % li%= msg %/li % end % /ul /div % end % div class=field %= f.label :name %br / %= f.text_field :name % /div h2Cars/h2 %= f.fields_for :cars do |car_fields| % div class=field %= car_fields.label :color %br / %= car_fields.text_field :color % /div % end % === %= f.fields_for :cars do |car_fields| % div class=field %= car_fields.label :plate %br / %= car_fields.text_field :plate % /div % end % div class=actions %= f.submit % /div % end % #http://localhost:8081/owners/new # ... h2Cars/h2 div class=field label for=owner_cars_attributes_0_colorColor/labelbr / input id=owner_cars_attributes_0_color name=owner[cars_attributes][0][color] size=30 type=text / /div === div class=field label for=owner_cars_attributes_1_platePlate/labelbr / input id=owner_cars_attributes_1_plate name=owner[cars_attributes][1][plate] size=30 type=text / /div # ... -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Sortable Nested Set for Rails 3.1.rc6 (Jquery + Nested set gem) released
Hello! Dreaming about Drag and Drop for Nested Sets? It’s should be with JQuery? Here’s the solution! https://github.com/the-teacher/Sortable-Nested-Set Installing cd ~ git clone g...@github.com:the-teacher/Sortable-Nested-Set.git cd Sortable-Nested-Set/ sudo bundle install change config/database.yml rake app:create rails s PLAY! I hope this will be useful for someone. -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Re: Validates attributes that aren't even being changed
Try this :unless = Proc.new {|user| user.password.nil?} Essentially it will check if you are sending a password attribute to the user or not while updating the user record and will check for this validation only if password attribute is present. Chirag http://sumeruonrails.com On Thu, Aug 18, 2011 at 11:05 PM, Leonel *.* li...@ruby-forum.com wrote: Can someone help me complete this piece of code? I'm thinking about using :unless because the only place where I wouldn't like the password validation is in the Edit User page. validates :password, :presence = true, :length = { :minimum = 6, :maximum = 20, :message = 'should have between 6 to 12 characters' }, :confirmation = true, :unless = I tried... :unless = params[:controller] == 'users' and params[:action] == 'edit' but I got the following error... Routing Error undefined local variable or method `params' for #Class:0x7f92ca83a518 -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Re: [Rails] Math with table rows
You should be doing this in the model, not controller. If you want to do this everytime the user record is saved, then define a before_save callback in your model and add this in the method def udpate_result self.result = self.height*self.weight end Note: You will have to convert height and weight to integer/float if you have not defined those columns as just string in the database. Chirag http://sumeruonrails.com 2011/8/18 Cássio Godinho cassiopgodi...@gmail.com Lets supose I have a User table, and on this table I have height, weight and result rows. In a form I input height and weight values and want to multiply those two values and store on the resulta row on database. I was trying something like that def criar @user = User.new(params[:user]) @result = @user.height * @user.weight @user.result = @result But its not working, what am i doing wrong? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] blog creation
hi all, i am tryin to develop a blog in rails3...that should have all the basic functionalities of blog like *creating a article *,*posting* ,*comments *can anybody help me with this to start from the scratch.. is there any plugin to be installed? -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
[Rails] Re: Rails 3 - Production Environment
Can anyone shed some light on this? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups Ruby on Rails: Talk group. To post to this group, send email to rubyonrails-talk@googlegroups.com. To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.