[Rails] Re: Problem creating Hello World app in Ruby on Rails
David Park wrote: > Hi All, > > I just installed Ruby on Rails on my MacBook Pro and tried to create the > Hello World app that is documented in the Agile Development with Rails > book. I followed all the instructions for creating the Hello World app > but get the following error when I try to load > http://localhost:3000/say/hello > > MissingSourceFile in SayController#index > > no such file to load -- sqlite3 > If you want to use mysql, then set up your rails project like this: % rails --database=mysql If you leave out the database option, rails will assume you want sqlite3. (I think mysql used to be the default some time ago). You can alter the database and connection settings in config/ database.yaml. -- Daniel Bush --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Problem creating Hello World app in Ruby on Rails
Hi All, I just installed Ruby on Rails on my MacBook Pro and tried to create the Hello World app that is documented in the Agile Development with Rails book. I followed all the instructions for creating the Hello World app but get the following error when I try to load http://localhost:3000/say/hello MissingSourceFile in SayController#index no such file to load -- sqlite3 Can anyone please let me know what I need to do to fix this issue? Thanks! P.S., I have the following things installed on my MacBook Pro: 1. Ruby 1.8.6 2. Rails 2.1.2 3. MySQL 5.0.67 -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] SOAP::MAPPING::OBJECT
Hi, I have written a SOAP4R client and have called a method on the Server. This method return me a SOAP::MAPPING::OBJECT. My problem is that I dont know how to access the contents of this SOAP::MAPPING::OBJECT. The method inspect displays the data but its displays it as a string. I want to access and display individual elements so the method inspect is of no use to me. Any help will be appreciated. Thanks and Regards, Pallavi -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: pagination in ajax
Sijo Kg wrote: > Hi > If u use gem install to install will_paginate the library files you > can find inside /usr/lib/ruby/gems/#versionNo/gems/ (For linux) for > windows you have to find out where the location..I think in > ProgramFiles(right?) > You can find all the installed gems there .And go to will_paginate > directory there Inside that go to lib directory .There you can find out > the required file.. > > Sijo Thanks,Sijo, i apply all these code ,but it is not working as i need. i want only particular div is replaced but total page is refresh.here is my code. in controller:: @user = User.paginate :page => params[:page], :per_page => 2 in view :: <% for usr in @user%> <%=usr.user_name%> <%= link_to_remote 'Edit User', :update => 'GeneralDiv', :complete => "Element.show('GeneralDiv');", :url => "/userinfo/edituser/#{usr.id}" %> <%= link_to_remote 'Delete User', :confirm => 'Are you sure?', :update => 'GeneralDiv', :complete => "Element.show('GeneralDiv');", :url => "/userinfo/deleteuser/#{usr.id}" %> <% end %> <%= will_paginate @user, :update=>'GeneralDiv', :params=>{:controller=>'userinfo',:action=>'showuser'}, :complete=>"Element.show('GeneralDiv');", :container => false %> and i also apply ur code in view_helpers.rb. i attach this file. any suggestion, thanks. Attachments: http://www.ruby-forum.com/attachment/2861/view_helpers.rb -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Problem starting WEBrick
Since rails comes in as a gem, it's doubtful that you don't have rubygems installed. It is possible that you have ruby and gems installed in non-standard locations. On my mac: which ruby => /opt/local/bin/ruby which gem => /opt/local/bin/gem which rails => /opt/local/bin/rails ruby --version => ruby 1.8.7 (2008-08-11 patchlevel 72) [powerpc- darwin9] gem --version => 1.3.0 rails --version => Rails 2.2.0 NOTE: This is not what ships on the mac - that's all found below: /System/Library/Frameworks/Ruby.framework/... You would probably do best if you go to: http://www.rubyonrails.org/down and follow the directions there. On Oct 28, 12:14 am, John Jc <[EMAIL PROTECTED]> wrote: > Ruby nuby here, but this seems like I overlooked something. I'm running > Rails 2.1.1 on Mac OS Leopard. > > I go into terminal and create an app: > > rails whatever > > I move into my app and try to start WEBrick > > cd ./whatever > ruby script/server > > And I get the following error: > > Rails requires RubyGems >= . Please install RubyGems and try > again:http://rubygems.rubyforge.org > > However, I already have RubyGems 1.3.0 installed, so I'm not sure where > this issue comes from. The fact that the error also doesn't denote a > RubyGems version seems strange. > > Any ideas? I'm really stuck on this and can't find anything via Google > or the forum. > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: pagination in ajax
Hi If u use gem install to install will_paginate the library files you can find inside /usr/lib/ruby/gems/#versionNo/gems/ (For linux) for windows you have to find out where the location..I think in ProgramFiles(right?) You can find all the installed gems there .And go to will_paginate directory there Inside that go to lib directory .There you can find out the required file.. Sijo -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Backwards N+1 problem
That knocked off about 1000ms, thanks for the help! Is it possible to re-arrange the order of your database all together?? When I take out the :order => 'rank desc' my sql call time gets cut in half, is there any way to tell RoR to automatically sort my definitions (in the DB) by rank descending?? I already have this code in my phrase.rb "has_many :definitions, :order => 'rank DESC'" but is it possible to have an entire model be automatically ordered by a specific column inside of the database?? In this case by rank. -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Rmagick wouldn't load on server for windows
yes i'm running on windows at the moment. well i got the rmagick to load and put the required "Rmagick" in the environment.rb but when i try to post something with image it rolls back and does not post. i followed the guide from the advanced rails recipes and just changed the names around but bleh. the view: <% form_for(@item, :html => { :multipart => true }) do |f| %> <%= error_messages_for :item, :image %> <%= f.label :title %> <%= f.text_field :title %> <%= f.label :description %> <%= f.text_area :description %> <%= label :item, :image %> <%= file_field_tag :image_file %> We accept JPEG, GIF, or PNG files up to 500 KB. <%= f.label :price %> <%= f.text_field :price %> <%= f.submit "Create" %> <% end %> controller def new @item = Item.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @item } end end # GET /items/1/edit def edit @item = Item.find(params[:id]) end # POST /items # POST /items.xml def create @item = Item.new(params[:item]) @image = Image.new(:uploaded_data => params[:image_file]) @service = ItemService.new(@item, @image) respond_to do |format| if @service.save flash[:notice] = 'Item was successfully created.' format.html { redirect_to(@item) } format.xml { render :xml => @item, :status => :created, :location => @item } else format.html { render :action => "new" } format.xml { render :xml => @item.errors, :status => :unprocessable_entity } end end items_helper.rb module ItemsHelper def image_for(item, size = :medium) if item.image image_image = item.image.public_filename(size) link_to image_tag(image_image), item.image.public_filename else image_tag("blank-image-#{size}.png" ) end end end item_service.rb class ItemService attr_reader :item, :image def initialize(item, image) @item = item @image = image end def save return false unless valid? begin Image.transaction do if @image.new_record? @item.image.destroy if @item.cover @image.item = @item @image.save! end @item.save! true end rescue false end end def valid? @item.valid? && @image.valid? end def update_attributes(item_attributes, image_file) @item.attributes = item_attributes unless image_file.blank? @image = Image.new(:uploaded_data => image_file) end save end end development.log Processing ItemsController#create (for 127.0.0.1 at 2008-10-28 22:08:46) [POST] Session ID: BAh7BzoMY3NyZl9pZCIlMDc3Y2M3ZGVjN2U5OWFhMGY5ZDUzMTQ1ZTRlYTc1 ZGEiCmZsYXNoSUM6J0FjdGlvbkNvbnRyb2xsZXI6OkZsYXNoOjpGbGFzaEhh c2h7AAY6CkB1c2VkewA=--4332f39dc3fdbc9fc0d4d317ca2c57f1481d87df Parameters: {"image_file"=>#, "commit"=>"Create", "authenticity_token"=>"e798b2552991572d78d139f4268655e69369ee32", "action"=>"create", "controller"=>"items", "item"=>{"title"=>"adf", "price"=>"23", "description"=>"asdfasdf"}} [4;35;1mItem Columns (0.004000) [0m[0mSHOW FIELDS FROM `items` [0m [4;36;1mImage Columns (0.004000) [0m[0;1mSHOW FIELDS FROM `images` [0m [4;35;1mSQL (0.001000) [0m[0mBEGIN [0m [4;36;1mSQL (0.00) [0m[0;1mROLLBACK [0m Rendering template within layouts/items Rendering items/new Completed in 0.23000 (4 reqs/sec) | Rendering: 0.00400 (1%) | DB: 0.00900 (3%) | 200 OK [http://localhost/items] -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Rmagick wouldn't load on server for windows
Was RMagick2.so built under windows? On Oct 28, 9:23 am, Richard Yoo <[EMAIL PROTECTED]> wrote: > In windows, i'm trying to load rmagick for my app so i put > > require 'RMagick' > > in environment.rb but the server wouldn't start and it gives me this > error: > > C:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.6.0-x86-mswin32/ext/RMagick2.so > (LoadError) > from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in > `require' > from > C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in > `require' > from > C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:355:in > `new_constants_in' > from > C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in > `require' > from > C:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.6.0-x86-mswin32/lib/RMagick.rb:11 > from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in > `gem_original_require' > from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in > `require' > from > C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in > `require' > ... 18 levels... > from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `require' > from ./script/server:3 > from -e:4:in `load' > from -e:4 > > the file is there but it won't load...any advice? ^_^! > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: backgroundrb misbehaving again
Please disregard. For those who might be interested, the problem was that Backgroundrb had spawned a rogue linux process on the port that backgroundrb was supposed to listen on and will not go down when you shut Backgroundrb via normal commands. I had to find it and then do a kill -9. After that, it worked fine. Are there any simpler to debug and more reliable alternatives out there? I mainly need a cron style functionality to send out scheduled reminders and download feeds which are also scheduled. Thanks. Bharat -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Acts as tree and belongs to
I think you' better write a method rather than using belongs_to. In my opnion, if you use belongs_to :xxx, than you get xxx for all the object of Category class, not just the root category. If you write a seperate method, you can write your own logic in it, for example, for every category, you first find its root category, and then return the section object of that root category. And I think you can just use that as the same as by using belongs_to On Oct 29, 7:19 am, Panda Beer <[EMAIL PROTECTED]> wrote: > Hello all, > is that possible to define an association between Section and Category > just for the root of a category? > > Here is my Category model: > > class Category < ActiveRecord::Base > acts_as_tree :order => "name" > belongs_to :sections # just for the root of Category > end > > Thank you. > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: TeachMate.org goes opensource
On Tue, Oct 28, 2008 at 4:04 PM, snitko <[EMAIL PROTECTED]> wrote: > >> I won't guess what snitko wants to do (his list of reasons may or may >> not be comprehensive), but I will say that snitko should choose a >> license which is appropriate for his goals. For better or worse his >> stated goals aren't really legally enforceable. > > Before publishing I talked to some guys and they said publish it under > GPL. I looked through the license and it seemed good enough for it. > Personally, I give a damn about licenses and stuff, they really make > me bored. I don't think there's someone now willing to steal the code > to make a competitor web-service, but I certainly would not like that > to happen. So if you have any suggestions about the license to use, > I'd be grateful. I don't know if I could recommend a license... I'm not a lawyer and all that. I will say that I don't believe there exists an OSS license which would prevent someone from starting a competitive site using your code. The only all the open source licenses I'm aware of would control is under what circumstances would they have to release their code changes back to you & the world. I can say this from personal experience: Making code open source (regardless of the license) doesn't magically cause people to contribute to your project. That takes a community of individuals who want to solve a shared problem. IMHO, if you're looking for people to help you with the project, then your best bet is probably to seek out qualified developers (or people interested in learning) within your existing user base who already find it useful and would like to give back. There are only two reasons I can think of that someone would download your code and do anything with it: 1) They want to help you out 2) They want to start their own site using your code You could easily have people email you to get access to the code for #1 and filter out people interested in #2 all without releasing the code under the GPL, etc. I will say this though. Either GPL your code or have people assign their copyright to you. I was involved in a web project where the main developer kept the copyright and didn't assign a license which allowed it to be redistributed other then the server. Then when the developer decided she didn't want to work on the site anymore she wouldn't allow us to give it to other developers- which basically meant we had to start over from scratch. Good luck, Aaron -- Aaron Turner http://synfin.net/ http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. -- Benjamin Franklin --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: TeachMate.org goes opensource
I guess that's the fear with making any project opensource - competitors. But also bear in mind that that's one of the things that makes opensource so powerful, it's how we grow as a massive global community, living and learning from our mistakes and building off others' mistakes as well. Think of it as giving back to a community that has given you so much :) Have linked to this article and your project snitko, at http://www.kirkbushell.com/ :) On Oct 29, 10:04 am, snitko <[EMAIL PROTECTED]> wrote: > > I won't guess what snitko wants to do (his list of reasons may or may > > not be comprehensive), but I will say that snitko should choose a > > license which is appropriate for his goals. For better or worse his > > stated goals aren't really legally enforceable. > > Before publishing I talked to some guys and they said publish it under > GPL. I looked through the license and it seemed good enough for it. > Personally, I give a damn about licenses and stuff, they really make > me bored. I don't think there's someone now willing to steal the code > to make a competitor web-service, but I certainly would not like that > to happen. So if you have any suggestions about the license to use, > I'd be grateful. --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: TeachMate.org goes opensource
> I won't guess what snitko wants to do (his list of reasons may or may > not be comprehensive), but I will say that snitko should choose a > license which is appropriate for his goals. For better or worse his > stated goals aren't really legally enforceable. Before publishing I talked to some guys and they said publish it under GPL. I looked through the license and it seemed good enough for it. Personally, I give a damn about licenses and stuff, they really make me bored. I don't think there's someone now willing to steal the code to make a competitor web-service, but I certainly would not like that to happen. So if you have any suggestions about the license to use, I'd be grateful. --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to override one method of AssetTagHelper
After rethinking of it that's what I plan to do. Just wnat to make sure it is the right way and I wanted assements of experts. Thank you very much. -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Script/Runner
On 28 Paź, 23:05, Oliver Nightingale <[EMAIL PROTECTED] s.net> wrote: > I have a production site that has a couple of batch jobs, I have used > script/runner and cron to run these jobs. This works ok for jobs that > only run once overnight during off peak. > > I am expiring sessions older than 30 mins every 15 mins using > script/runner, but I'm concerned about the hit of script/runner loading > up the whole rails environment, specifically since I only have a 256MB > slice, at such regular intervals. > > What is a more efficient way of clearing down these sessions (using AR > store btw). > > Any help is appreciated Have you checked what is consuming the memory? The environment should take about 60mb (not 100% about that). >From my experience most memory consuming operations are related with creating objects from find(:all, ) queries. Can you change the ActiveRecord find into raw sql queries and compare results? I remember case with my code - memory usage jumped from 600mb do 180mb after changing find(:all, ...) into sql. The other thing is the script/runner - I don't know if it will make any difference but you could try with rake task's instead of script/ runner. cheers --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Acts as tree and belongs to
Hello all, is that possible to define an association between Section and Category just for the root of a category? Here is my Category model: class Category < ActiveRecord::Base acts_as_tree :order => "name" belongs_to :sections # just for the root of Category end Thank 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to override one method of AssetTagHelper
> In my view I want something like : > > <% image_tag('logo.gif', :locale => cookies[:locale])%> > > any better way? Will all the pictures on the site be localized? Probably not - maybe it would be better if you create a method called something like image_localized_tag in your application helper. It could take "locale" from cookie and change passed file name (locale isn't parameter now). After changing the name it could just call image_tag and return the result. This is just a suggestion - IMHO it's easier to implement and cleaner later on for other developers - some of them may expect different behaviour from image_tag cheers --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Script/Runner
I have a production site that has a couple of batch jobs, I have used script/runner and cron to run these jobs. This works ok for jobs that only run once overnight during off peak. I am expiring sessions older than 30 mins every 15 mins using script/runner, but I'm concerned about the hit of script/runner loading up the whole rails environment, specifically since I only have a 256MB slice, at such regular intervals. What is a more efficient way of clearing down these sessions (using AR store btw). Any help is appreciated 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Iterating through all model records without pre-instantiating them
Nice one, thanks! On Tue, Oct 28, 2008 at 7:22 PM, reHa <[EMAIL PROTECTED]> wrote: > >> I'm writing a migration script which has to, well, actually migrate >> all data from table A to table B, but I need to access the application >> logic in model A for each row migrated. I could do this: >> >> MyModel.all.each do |instance| >> # do stuff... >> end >> >> but as far as I know that would pre-instantiate all records in memory >> beforehand, which could be *really bad* with the amount of records I'm >> dealing with, and I only really need to work with a record at a time. > > Hi, > > Have you thought of using limit and a offset with a regular find? > (below is the code but I didn't check if it's valid) > > current_offset = 0 > limit = 100 > > begin > result = MyModel.find(:all, :limit=>limit, :offset=>current_offset) > #some operations > current_offset += limit > end while result.size == 0 > > > > > --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] backgroundrb misbehaving again
I have a really strange problem with Backgroundrb. On one of my staging servers, it is not recognizing the RAILS_ENV variable for some reason. I have tried everything I could, that is: a) stopping and starting from the command line by issuing the following command RAILS_ENV=staging script/backgroundrb stop|start b) script/backgroundrb stop|start -e staging c) from the Capistrano script, here are the relevant snippets: namespace :backgroundrb do desc "Start backgroundrb service" task :start, :roles => :app do run "RAILS_ENV=#{rails_env} nohup #{current_path}/script/backgroundrb start 2>&1 1>/dev/null" end desc "Stop backgroundrb service" task :stop, :roles => :app do # echo at end makes the return code always 0 run "test -f #{current_path}/log/backgroundrb.pid && #{current_path}/script/backgroundrb stop; echo" end desc "Restart backgroundrb service" task :restart, :roles => :app do stop start end end When I look at the log, it is clear to me that it is picking up the development environment since the backgroundrb workers are looking for the development database. See the following snippet from the log: Started reminders processing at: 2008-10-28 21:40:01 Unknown database 'isabont_dev' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:505:in `real_connect' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:505:in `connect' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:183:in `initialize' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:88:in `new' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:88:in `mysql_connection' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in `send' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:292:in `connection=' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:260:in `retrieve_connection' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/base.rb:2693:in `quoted_table_name' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/base.rb:1469:in `construct_finder_sql' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/base.rb:1341:in `find_every' /var/www/apps/isabont/releases/20081028150434/vendor/rails/activerecord/lib/active_record/base.rb:536:in `find' /var/www/apps/isabont/current/app/models/reminder.rb:84:in `find_delinquent' 12286,1 99% That 'isabont_dev' is my development database. Why is it failing to pick up the right environment all of sudden? If it had picked up staging then my database would be isabont_staging since that is how my database.yml is configured. What is bad is that this used to work fine on the same server. That is; I have deployed on this server using the Capistrano deploy.rb many times before. Exactly the same script works fine on yet another server in another staging environment (for UK). Seems like Backgroundrb is stuck on not recognizing the RAILS_ENV no matter how it is passed to it and defaults to development since it is trying to query the dev database. Anyone has experienced this kind of inconsistent behavior in Backgroundrb? Thanks in advance for your time and apologies for the long post. Bharat -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] rubygems-update 1.3.0 causing rake task problems?
I'm running into problems with some of my rake tasks and I think it's since my host updated rubygems to v 1.3.0. Has anybody else seen this message? Gem::SourceIndex#search support for String patterns is deprecated ./script/../config/boot.rb:26 is outdated that line of code is as follows: rails_gem = Gem.cache.search('rails', "~>#{version}.0").sort_by { | g| g.version.version }.last I doint think it's affecting my main app code... only the rake tasks. Any ideas on what happended? Or how to fix this? --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to override one method of AssetTagHelper
Thanks a lot for the quick response! BTW the reason why I want to override a method is because I need to support images for different locale. for instance : logo_fr.gif (for french) logo_en.gif (for of course english) In my view I want something like : <% image_tag('logo.gif', :locale => cookies[:locale])%> any better way? Thanks again -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Random SystemExit. ActiveRecord::StatementInvalid
On Oct 28, 9:22 pm, Carlos Garcia <[EMAIL PROTECTED]> wrote: > Frederick Cheung wrote: > > On 28 Oct 2008, at 20:22, Carlos Garcia > > <[EMAIL PROTECTED] > > > wrote: > > >>> I may be misremembering, but I have a vague idea that this can happen > >>> if the mongrel/whatever is sent a TERM signal. How is your app > >>> deployed? (in particular I seem to remember apache being a little > >>> enthusiastic about killing fastcgi instances) > > >>> Fred > > >> We deploy to virtual hosts using apache on ubuntu. > > > But what sits behind that? Mod_rails, mongrel, fastcgi, scgi? > > hehe, sorry, fastcgi So as I was saying, I remember apache killing off fastcgi instances. I think it logs (or can be told to log) when it does this. If you can correlate this with when you get the errors then you'll have found your cause. Fred > -- > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: perooidically_call_remote
On Oct 28, 9:27 pm, Shandy Nantz <[EMAIL PROTECTED]> wrote: > The idea being that if too much time has passed the user gets signed out > and get kicked back to the login page. Everything work right, except the > bit of code that check to see if an hour has passed since the users last > action and then it is supposed to redirect_to a login form. The problem > is that when it gets to that redirect_to it seems to skip right over it > and not do anything, even worse, it allows the user to continue to be > logged in. Has anyone used peroidically_call_remote before and has > similar issues and how did you fix them? Thanks, This has nothing to do with periodically_call_remote and everything to do with it being an ajax request. If you want to redirect from an ajax request you need to use rjs (ie remove the update option from periodically_call_remote) and use page.redirect_to from the rjs Fred > > -S > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: attributes on join model
yeah i'm aware of all that - the issue is that using HM:T give no simple method of getting back at the *particular* model/row used for the join. of course there can by more that one, but it's also the case that for any given pair of related objects there is exactly one row in the join model making that relationship and AR provides no handle on this record, which makes decorating it rather tricky. --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to override one method of AssetTagHelper
Hi, In our project we are using lib file as suggested file name would be: lib/action_view_ext.rb module ActionView module Helpers #:nodoc: module AssetTagHelper def image_path(source) compute_public_path(source, 'images') end end end end the best way to include the file !always! (doesn't matter if the application helper is loaded or not) is to add one line at the end of the config/environment.rb the line would be: require 'lib/action_view_ext.rb' Cheers --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Iterating through all model records without pre-instantiating them
> I'm writing a migration script which has to, well, actually migrate > all data from table A to table B, but I need to access the application > logic in model A for each row migrated. I could do this: > > MyModel.all.each do |instance| > # do stuff... > end > > but as far as I know that would pre-instantiate all records in memory > beforehand, which could be *really bad* with the amount of records I'm > dealing with, and I only really need to work with a record at a time. Hi, Have you thought of using limit and a offset with a regular find? (below is the code but I didn't check if it's valid) current_offset = 0 limit = 100 begin result = MyModel.find(:all, :limit=>limit, :offset=>current_offset) #some operations current_offset += limit end while result.size == 0 --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] File upload via non-browser REST call (using attachment_fu)
Hi everyone, this might be a really stupid question but I have hit a wall here. I already tried various different strategies but I really cannot find a solution. The only thing which have not tried is to fake a browser request, but I do not wanna go that far. So I hope I missed something ;) Ok, finally our problem: We have an application which allows file attachments for a model. We implemented this feature with attachment_fu. Now we have the case, that another application (a native windows app) needs to access this feature via the API. We can create the model with no problem. But when it comes to uploading files and adding them as an attachment, we have no luck with the calls. Any idea or link what we are missing here? We simply are not able to upload/access the file (always a 500 or something similar). Thank you very much, Max -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] perooidically_call_remote
I am using the following for to peroidically call back to the control to see if a certain amount of time has passed: in .rhtml <%= periodically_call_remote :url => { :action => 'session_expiry' }, :update => '' %> in controller if !session[:expire].blank? @time_left = (session[:expire][:expires] - Time.now).to_i else @time_left = 0 end if @time_left.to_i < 0 or @time_left == 0 flash[:notice] = "You have been logged out due to inactivity" session[:user] = nil redirect_to :action => 'login' end The idea being that if too much time has passed the user gets signed out and get kicked back to the login page. Everything work right, except the bit of code that check to see if an hour has passed since the users last action and then it is supposed to redirect_to a login form. The problem is that when it gets to that redirect_to it seems to skip right over it and not do anything, even worse, it allows the user to continue to be logged in. Has anyone used peroidically_call_remote before and has similar issues and how did you fix them? 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Random SystemExit. ActiveRecord::StatementInvalid
Frederick Cheung wrote: > On 28 Oct 2008, at 20:22, Carlos Garcia > <[EMAIL PROTECTED] > > wrote: > >>> I may be misremembering, but I have a vague idea that this can happen >>> if the mongrel/whatever is sent a TERM signal. How is your app >>> deployed? (in particular I seem to remember apache being a little >>> enthusiastic about killing fastcgi instances) >>> >>> Fred >> >> We deploy to virtual hosts using apache on ubuntu. > > But what sits behind that? Mod_rails, mongrel, fastcgi, scgi? hehe, sorry, fastcgi -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: attributes on join model
On 28 Paź, 20:53, "ara.t.howard" <[EMAIL PROTECTED]> wrote: > given a setup like > > class Parent > has_many :child_parents > has_many :children, :through => child_parents > end > > and assuming i'd like to store the style of relationship on the > child_parents table, for example > > create table child_parents( > parent_id > child_id > is_adopted > ) > > in otherwords, 'is_adopted' is an attribute of the link between child > and parent, not of the child or parent themselves, how can one access > this simply? > > child = parent.children.first > p child.adopted? > > is obviously desirable and used to be possible with HABTM > associations. but that's deprecated however there seems to be no > easy way to accomplish something similar with full blown join models. > > cheers. http://wiki.rubyonrails.org/rails/pages/has_and_belongs_to_many "... has_and_belongs_to_many is great for what it does, but it is only adequate for simple many-to-many relationships. If your intermediary table needs to track additional data, then you may instead want to use ThroughAssociations instead. ..." Cheers --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Random SystemExit. ActiveRecord::StatementInvalid
On 28 Oct 2008, at 20:22, Carlos Garcia <[EMAIL PROTECTED] > wrote: > > Frederick Cheung wrote: >> On Oct 28, 7:21�pm, Carlos Garcia <[EMAIL PROTECTED] >> et> >> wrote: >>> I have this recurrent problem that I just can't figure out. On >>> several >>> parts of the application when active record is executing some >>> query it >>> throws a ActiveRecord::StatementInvalid exit like this: >>> >> I may be misremembering, but I have a vague idea that this can happen >> if the mongrel/whatever is sent a TERM signal. How is your app >> deployed? (in particular I seem to remember apache being a little >> enthusiastic about killing fastcgi instances) >> >> Fred > > We deploy to virtual hosts using apache on ubuntu. But what sits behind that? Mod_rails, mongrel, fastcgi, scgi? > > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Validation order when mixing callbacks and validates_format
I just figured out what I was doing wrong. I was using "gsub" instead of "gsub!" now it is working fine -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Random SystemExit. ActiveRecord::StatementInvalid
Frederick Cheung wrote: > On Oct 28, 7:21�pm, Carlos Garcia <[EMAIL PROTECTED]> > wrote: >> I have this recurrent problem that I just can't figure out. On several >> parts of the application when active record is executing some query it >> throws a ActiveRecord::StatementInvalid exit like this: >> > I may be misremembering, but I have a vague idea that this can happen > if the mongrel/whatever is sent a TERM signal. How is your app > deployed? (in particular I seem to remember apache being a little > enthusiastic about killing fastcgi instances) > > Fred We deploy to virtual hosts using apache on ubuntu. -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: intranet applications
Frederick Cheung wrote: > pretty much just generic stuff. > > Fred 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: intranet applications
On 28 Oct 2008, at 20:06, Eric Sheris wrote: > > Frederick Cheung wrote: >> On Oct 28, 7:51�pm, Eric Sheris <[EMAIL PROTECTED]> >> >> Broadly speaking I'm on the side of multiple smaller rails apps than >> one huge one. Easier to write, easier to maintain. The answer also >> depends to an extent on what levels of interaction you need between >> the apps. >> >> Fred > > Would you just link them together with generic html links into there > respective controllers? or is there a way to link them together with > rails? > pretty much just generic stuff. Fred > my generic plan atm is to have a main page with our logo and a > navigation bar for each department, then under that a feed aggrigator > with industry news in it. > > logo > finance hr it sales etc > > industry feed industry feed local weather > > asci doesn't do many things justice > > each department listed above will have a dropdown menu with a few > items > in it that would be the applications. > > this part will also obviously be a rails app > -- > Posted via http://www.ruby-forum.com/. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: intranet applications
Frederick Cheung wrote: > On Oct 28, 7:51�pm, Eric Sheris <[EMAIL PROTECTED]> > > Broadly speaking I'm on the side of multiple smaller rails apps than > one huge one. Easier to write, easier to maintain. The answer also > depends to an extent on what levels of interaction you need between > the apps. > > Fred Would you just link them together with generic html links into there respective controllers? or is there a way to link them together with rails? my generic plan atm is to have a main page with our logo and a navigation bar for each department, then under that a feed aggrigator with industry news in it. logo finance hr it sales etc industry feed industry feed local weather asci doesn't do many things justice each department listed above will have a dropdown menu with a few items in it that would be the applications. this part will also obviously be a rails app -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Random SystemExit. ActiveRecord::StatementInvalid
On Oct 28, 7:21 pm, Carlos Garcia <[EMAIL PROTECTED]> wrote: > I have this recurrent problem that I just can't figure out. On several > parts of the application when active record is executing some query it > throws a ActiveRecord::StatementInvalid exit like this: > I may be misremembering, but I have a vague idea that this can happen if the mongrel/whatever is sent a TERM signal. How is your app deployed? (in particular I seem to remember apache being a little enthusiastic about killing fastcgi instances) Fred > A ActiveRecord::StatementInvalid occurred in > someapplication#some_action: > > SystemExit: exit: SELECT * FROM project WHERE (project.`id` = 9) > /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connectio > n_adapters/abstract_adapter.rb:128:in > `log' > > The thing is that the next time you try the same action, it works fine, > also if you run that query directly in a console or any query browser it > returns a valid result. The occurrence is very random. > > Any help or comments are greatly appreciated. > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to override one method of AssetTagHelper
On Oct 28, 6:18 pm, Rémi Gagnon <[EMAIL PROTECTED]> wrote: > Thank you, you are really right I should put it in my > application_helper. But Here we will have a lot of projets and I want > to share this kind of changes to all teams. So that's why I would like > to ultimatly put it in a gem. > > So I'm curious to see how you would include mymodule on > ActionView::Base. > ActionView::Base.send :include, MyModule With a plugin you'd typically put this in the plugin's init.rb Fred > Thanks in advance > > Frederick Cheung wrote: > > On 28 Oct 2008, at 17:46, Rémi Gagnon <[EMAIL PROTECTED] > > s.net> wrote: > > >> I created a file ./lib/action_view/helpers/asset_tag_helper.rb > > >> and put in it only the method I want to override. like this > > > Don't. Create lib/my_module.rb and then include MyModule into > > ActionView::Base. Or it might be more convenient to do this in > > application_helper > > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: intranet applications
On Oct 28, 7:51 pm, Eric Sheris <[EMAIL PROTECTED]> wrote: > Hello, > > I am getting ready to start building an intranet for a small company i > work for. I have a question about the general architecture of such a > thing. the intranet itself will contain multiple applications for > various departments. what i am trying to figure out is if i should start > by making each application as a seperate rails project or attempt to > design it from the top down, all in one project. I have a feeling i am > not being very clear here so please feel free to ask questions, also > alot of details are murky as i am just starting this. Broadly speaking I'm on the side of multiple smaller rails apps than one huge one. Easier to write, easier to maintain. The answer also depends to an extent on what levels of interaction you need between the apps. Fred > -- > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] attributes on join model
given a setup like class Parent has_many :child_parents has_many :children, :through => child_parents end and assuming i'd like to store the style of relationship on the child_parents table, for example create table child_parents( parent_id child_id is_adopted ) in otherwords, 'is_adopted' is an attribute of the link between child and parent, not of the child or parent themselves, how can one access this simply? child = parent.children.first p child.adopted? is obviously desirable and used to be possible with HABTM associations. but that's deprecated however there seems to be no easy way to accomplish something similar with full blown join models. cheers. --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] intranet applications
Hello, I am getting ready to start building an intranet for a small company i work for. I have a question about the general architecture of such a thing. the intranet itself will contain multiple applications for various departments. what i am trying to figure out is if i should start by making each application as a seperate rails project or attempt to design it from the top down, all in one project. I have a feeling i am not being very clear here so please feel free to ask questions, also alot of details are murky as i am just starting 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Validation order when mixing callbacks and validates_format
brewpoo wrote: > Can you post your before_validation code? > > What actually blows up? Can you also post the relevant lines from the > log? I am having this same problem. It seems the before_validation isn't working in mine: before_validation :normalize_phone_number validates_format_of :number, :with => /^[0-9]{10,15}$/ protected def normalize_phone_number self.number.gsub(/-/,"").gsub(/ /,"") end The object won't save since it fails the validates_format_of since it never runs the before_validation. I'm running Rails 2.1.0. Any ideas? -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Rmagick wouldn't load on server for windows
In windows, i'm trying to load rmagick for my app so i put require 'RMagick' in environment.rb but the server wouldn't start and it gives me this error: C:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.6.0-x86-mswin32/ext/RMagick2.so (LoadError) from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require' from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require' from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:355:in `new_constants_in' from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require' from C:/ruby/lib/ruby/gems/1.8/gems/rmagick-2.6.0-x86-mswin32/lib/RMagick.rb:11 from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `gem_original_require' from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:32:in `require' from C:/ruby/lib/ruby/gems/1.8/gems/activesupport-2.1.1/lib/active_support/dependencies.rb:510:in `require' ... 18 levels... from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' from ./script/server:3 from -e:4:in `load' from -e:4 the file is there but it won't load...any advice? ^_^! -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Random SystemExit. ActiveRecord::StatementInvalid
I have this recurrent problem that I just can't figure out. On several parts of the application when active record is executing some query it throws a ActiveRecord::StatementInvalid exit like this: A ActiveRecord::StatementInvalid occurred in someapplication#some_action: SystemExit: exit: SELECT * FROM project WHERE (project.`id` = 9) /usr/lib/ruby/gems/1.8/gems/activerecord-1.15.3/lib/active_record/connection_adapters/abstract_adapter.rb:128:in `log' The thing is that the next time you try the same action, it works fine, also if you run that query directly in a console or any query browser it returns a valid result. The occurrence is very random. Any help or comments are greatly 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] oracle_enhanced adapter 'uninitialized constant' error
Hi, Can any one help me? I'm using Ubuntu and trying to connect to an oracle database using oracle_enhanced adapter connection, but keeps getting following error: /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/dependencies. rb:275:in `load_missing_constant': uninitialized constant ActiveRecord::Connecti onAdapters::OracleEnhancedAdapter (NameError) from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/ dependencies.rb:467:in `const_missing' from /home/scheng/rails/ServerMonitoringSystem/config/initializers/oracl e_enhanced.rb:1 from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/ dependencies.rb:502:in `load' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/ dependencies.rb:502:in `load' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/ dependencies.rb:354:in `new_constants_in' from /usr/lib/ruby/gems/1.8/gems/activesupport-2.1.0/lib/active_support/ dependencies.rb:502:in `load' from /usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:475:in ` load_application_initializers' from /usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/initializer.rb:474:in ` each' ... 7 levels... from /usr/lib/ruby/gems/1.8/gems/rails-2.1.0/lib/commands/runner.rb:39 from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_ original_require' from /usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb:27:in `requ ire' I have gem oracle_enhanced-adapter, ruby_oci8, etc. installed: gem list *** LOCAL GEMS *** actionmailer (2.1.1, 2.1.0) actionpack (2.1.1, 2.1.0) activerecord (2.1.1, 2.1.0) activerecord-oracle-adapter (1.0.0.9250) activerecord-oracle_enhanced-adapter (1.1.8) activeresource (2.1.1, 2.1.0) activesupport (2.2.0, 2.1.1, 2.1.0) builder (2.1.2) cgi_multipart_eof_fix (2.5.0) daemons (1.0.10) fastthread (1.0.1) gem_plugin (0.2.3) hpricot (0.6.161) markaby (0.5) mongrel (1.1.5) passenger (2.0.3) picnic (0.6.5) rack (0.4.0) rails (2.1.1, 2.1.0) rake (0.8.3) restr (0.4.0) reststop (0.3.0) ruby-oci8 (1.0.3) rubygems-update (1.3.0) rufus-scheduler (1.0.11) taskr (0.3.0) Here's my ruby code: require 'rubygems' require 'active_record' ActiveRecord::Base.establish_connection( :adapter => "oracle_enhanced", :database => "xyz", :username => "user1", :password => "password1", :host => "abc.def.jkl:1521") class Connect < ActiveRecord::Base set_table_name "changelog" end current_db = Connect.find(:first, :order => 'applied_dttm DESC') Any ideas from any genius? 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Page does not seem to be reloaded on prod server
Hi Josh, could you post some source code (of "add" action for example) and some more info about your production env? Do you display flash messages in your layout or view files? If in view files, do you include it on the page where it is missing? Best, Hubert On 28 Paź, 19:07, Joshua Muheim <[EMAIL PROTECTED]> wrote: > Hi all > > I've coded a small shop that works well on my dev machine (OSX 10.5). > > But look at the following page: > > http://shop.incense.ch/compact_discs/1 > > When clicking "Reservieren", the page is forwarded to a new page, where > the product is added to the shopping cart, and a flash notice is > prepare. Then the page is redirected back to the shop page. > > On my dev machine this works well. But on the production server this > doesn't seem to work! But look what happens when you click on another > link, e.g. "Kontakt"! There the stuff seems to be! > What the heck? Never stumbled over this before... > > Anyone has an idea what's wrong here? > > Thanks > Josh > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Cookies and IE7. Circumvent 4KB limit?
On 28 Oct 2008, at 14:03, Chris Dekker wrote: > Since Google Maps API handles all the requests for the tile, there > is no > way to come inbetween there to fill some div with my JS data like you > suggested. If you have a practical example I'd be very glad to see it. Unless I'm totally wrong on what you're trying to do, here's some pseudocode on how I see it: 37.4419, -122.1419put any content for your marker here 38.4523, -121.1887put other content here Javascript pseudocode (won't work, but you get the picture): $('positional-data').select('li).each(function(el) { new GMarker(new google.maps.LatLng(el.down('em').innerHTML), el.down('.content')); }); Best regards Peter De Berdt --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: TeachMate.org goes opensource
On Tue, Oct 28, 2008 at 11:36 AM, Jean-Marc (M2i3.com) <[EMAIL PROTECTED]> wrote: > > Aaron, > > Your last comment would seem to weight in the need to have a new term > to describe what snitko wants to do. I won't guess what snitko wants to do (his list of reasons may or may not be comprehensive), but I will say that snitko should choose a license which is appropriate for his goals. For better or worse his stated goals aren't really legally enforceable. I see Teachmate.org is GPLv3 and know at one point in time RMS was complaining about websites using GPL'd code but since they weren't redistributing binaries they didn't have to share their improvements- I don't recall if/what changes were made in the GPLv3 to address this. -- Aaron Turner http://synfin.net/ http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. -- Benjamin Franklin --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] cloud computing and Ruby on Rails
How does cloud computing relate to Ruby on Rails? --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ruby console problem
Hi Lawrence, I am not an expert on Windows, and generally - ruby is painfully slow in this environment, so you should consider switching to Linux or Mac OS if you want to use ruby with comfort in long term, but I think I know what's your problem. Seems to me that InstantRails opens console windows for you, and sets some environmental variables, like PATH to make it possible to use ruby. If you type "irb" in normal console window, you'll get "no such command" or similiar, while started from menu - will spawn irb for you. You might need to navigate to your rails project in command line, like: > cd C:\myprojects\rails\blog and run console: > ruby script\console Please let me know if this helps, Hubert On 25 Paź, 22:35, "Sal e. Mander" <[EMAIL PROTECTED]> wrote: > Hi, > > I am using InstantRails in XP SP2. When I try to open a Ruby console > window from InstantRails menu system I only get a Dos window. This is, > probably, a problem in my registry configuration and happens even when I > try to execute a batch (.bat) file. > > My question is: how do I run a Ruby Console window without going through > the InstantRails menu system? > > If anyone knows how to fix my Window register problem that would work > also. > > Thanks, Lawrence > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ruby application talking to Java application (IPC suggestions please)
Hi, I went third route. I couldn't use web services as I was clearly told not to use any Java web container. I also couldn't use jruby, as I am dependent on some C++ libraries. Fortunately, there is nice library Ruby Java Bridge (http://rjb.rubyforge.org/) that helped me get around this issue and include my Java classes into project directly. Can't say much about resources consumption/memory leaks or stability yet, but all looks good for now. Thanks, H. On 28 Paź, 16:24, jemminger <[EMAIL PROTECTED]> wrote: > +1 for restful web service, or perhaps run your rails app in jruby & > then you can makejavacalls from ruby. > > On Oct 28, 3:33 am, Hubert Łępicki <[EMAIL PROTECTED]> wrote: > > > Hi all, > > > I'm wondering how can I make RoR application talk toJavaapplication > > running in background. Does anyone have any experience with this kind > > of stuff? Annysuggestionswelcome. > > > I am running Ruby on MRI, andJavaapplication will run on the same > > machine but in JVM. > > > Thanks, > > H. --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: TeachMate.org goes opensource
Aaron, Your last comment would seem to weight in the need to have a new term to describe what snitko wants to do. -- Jean-Marc http://m2i3.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: TeachMate.org goes opensource
On Tue, Oct 28, 2008 at 10:31 AM, Jean-Marc (M2i3.com) <[EMAIL PROTECTED]> wrote: > > Well the major distinction between a website and a local application > is precisely that... where it runs. > > Lets take OpenOffice... > > You download a copy and run it on your machine. > You can choose to alter your copy and be the sole user of those > changes > You can publish your changes and once approved/merged into the trunk > version, other people can benefit from it. > ** The benefit of the improvements made takes a longer time (if ever) > to reach the potential users. > > Lets take Joomla... > > You download a copy and run it on your webserver > You can choose to alter your copy > You can publish your changes but there again people will need to > update their own copy. > ** The benefit of the improvements made still takes a longer time (if > ever) to reach the potential users. > > Lets take teachmate.org and reddit.com... > > You don't download anything unless you want to change it (or branch > and start your own) > Whoever have their published changes approved updates the final > website directly. > ** The benefit of the improvements reaches all the users upon > approval. > > Lets imagine Google was doing it where you could download the source > code of their website and suggest improvements to any aspect of it > where the whole user base of Google would benefit from the changes. > > > The distinction is probably too thin to justify a new term... "Open > Source Website" already says enough. But new terms also carry with > them loads of meaning and in the case of Reddit and Teachmate the > meaning is: "the website, it's behavior and all aspects of it belongs > to the community an is actively maintained by the community". I think the key takeaway is that the term "open source" has nothing to do with where the code actually runs (see disclaimer below). It has to do with who has access to the code and what they can do with the code. By opening up the source code according to most OSS licenses, it's perfectly valid to take the code, rebrand the site and start a competitor site- just like there have been forks of traditional software (Emacs vs. XEmacs for example). * Disclaimer: Depending on the license used I may not even have to redistribute the changes I make to my competitor site (BSD, Artistic and GPLv2 for example). Of course some licenses have special clauses for "web delivered applications". So yes, where it runs is a factor in the "redistribution" clause, but most OSS licenses don't force you to share code changes for web applications. -- Aaron Turner http://synfin.net/ http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. -- Benjamin Franklin --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Scaffolding and dealing with generated actions in the controllers
Hey Everyone, I wanted to know if I could get some insight on something. I am using Rails 2.1.2 and for something that needs beyond basic functionality, I typically generate a scaffold so I don't have to manually create everything and save some time. Well as you all most likely know, along with generating a scaffold, comes predefined actions in the controller that is generated, usually like show, new, create, index, etc... The question I have regarding that is how and where are all those actions tied to? I know Rails 2.* uses the REST model by default, so everything is resourceful. And thats fine and all, but when I want to do something outside of those predefined actions, it throws a fit so to speak. Let me illustrate what I mean by that. So lets say I wanted to create a Rails app for a local brewery that has a UI frontend that would act as the brewery site lets say which also contains a catalogue of their various lagers and ales that they have for sell to take home. So I would create an app called brew lets say - "rails -d mysql brew". So the skeleton is created, but now I need a model, view, and controller of course. I decide this needs a bit extra functionality from the get go so I create a scaffold - "script/generate scaffold beer". I generate a new migration for the table needed to store all the various products that the brewery offers - "script/generate migration add_products". I write in the fields that I want in the db table, and run a rake db:migrate. Everything is great. Now I can add a couple products, and show the details of them. Great. But now, I want to do more than that. Now I want to be able to write in a mashup into the app also so maybe someone could find the place, so I'll integrate google and yahoo maps in with the GeoKit plugin, and I want to play some videos on youtube that related the brewery assuming there were any, so I'd use the YouTube API using something like the YouTube-G plugin or something. So now I install the plugins, and then write some methods into the controller to act as something like a search functionality. But now that say these methods are wrote, and I have a template called search.rhtml in my view that will generate directions to the place using the users remote public ip and geocoding that into coordinates, then pulling up any youtube videos on a sidebar that has to do with the place. So I make sure everything is saved, and I fire up mongrel and test it out. But instead of seeing the generated html form, instead I get an action controller exception saying "Cannot find with ID=search" or something to that affect, and I get lines that describe where it is derived from, but it would be in the controller on the line with the "def show" method, containing something like @beer = Beer.find(params[:id]), in which is is querying for the sql id field, which is the primary key in the table. But because I'm trying to find anything but ID, it fights me tooth and nail. So, I wanted to know if anyone really understand REST, and how everything ties together. I have tried to delete the map.resources :beers (or whatever it may be), but then it has a routing issue. I am but I try to do anything beyond the basic methods laid out in the generated controller and it throws a big fit. Can anyone clarify this for me so I could understand it better? --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to override one method of AssetTagHelper
Thank you, you are really right I should put it in my application_helper. But Here we will have a lot of projets and I want to share this kind of changes to all teams. So that's why I would like to ultimatly put it in a gem. So I'm curious to see how you would include mymodule on ActionView::Base. Thanks in advance Frederick Cheung wrote: > On 28 Oct 2008, at 17:46, Rémi Gagnon <[EMAIL PROTECTED] > s.net> wrote: > >> >> I created a file ./lib/action_view/helpers/asset_tag_helper.rb >> >> and put in it only the method I want to override. like this >> > Don't. Create lib/my_module.rb and then include MyModule into > ActionView::Base. Or it might be more convenient to do this in > application_helper -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] follow_redirect persistently breaks ActionController verify
I've narrowed the problem a bit. It now seems that follow_redirect in one test will break an ActionController's +verify+ directive in another, later test. I am ashamed to say my code fragment was not accurate. Here is the correct code: == class AdminControllerTest < Test::Unit::TestCase # #setup puts user credentials in @session def test_approve_not_post get :approve, { :id => 3 }, @session assert_response :redirect assert_redirected_to :action => :list assert_equal 'You cannot do this directly.', flash[:notice] ### OMITTED IN ORIGINAL - SORRY ### follow_redirect assert_response :success end def test_deny_not_post get :deny, { :id => 3 }, @session assert_response :redirect assert_redirected_to :action => :list assert_equal 'You cannot do this directly.', flash[:notice] ### OMITTED IN ORIGINAL - SORRY ### follow_redirect assert_response :success end end == Note that I have the tests follow the redirect_to arising from the failed +verify+. I have discovered that if I comment-out the follow_redirect and assert_response calls in test_approve_not_post, then +verify+ will redirect correctly in test_deny_not_post. Remember it was the assert_redirected_to, and the redirection hash, that broke. So now: follow_redirect breaks an ActionController's +verify+ handling. before_filter and after_filter don't have this problem. Is this a peculiarity of functional tests -- and can I therefore ignore it? I'd rather be able to test the redirection. Should I update beyond Rails 1.2.6? 2.x is not feasible for my deployment. Again, I'm sorry about mischaracterizing the 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Chat Client integrated into Rails
Take a look at this: https://jabbify.com On Tue, Oct 28, 2008 at 4:06 PM, Nathan Esquenazi <[EMAIL PROTECTED]> wrote: > > I second the use of Juggernaut and I believe it does work with Flash 10. > Juggernaut is a much much better solution than polling. You might also > want to look at shooting_star + meteor for a comet-based solution or > orbitd. > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Page does not seem to be reloaded on prod server
Hi all I've coded a small shop that works well on my dev machine (OSX 10.5). But look at the following page: http://shop.incense.ch/compact_discs/1 When clicking "Reservieren", the page is forwarded to a new page, where the product is added to the shopping cart, and a flash notice is prepare. Then the page is redirected back to the shop page. On my dev machine this works well. But on the production server this doesn't seem to work! But look what happens when you click on another link, e.g. "Kontakt"! There the stuff seems to be! What the heck? Never stumbled over this before... Anyone has an idea what's wrong here? Thanks Josh -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Chat Client integrated into Rails
I second the use of Juggernaut and I believe it does work with Flash 10. Juggernaut is a much much better solution than polling. You might also want to look at shooting_star + meteor for a comet-based solution or orbitd. -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to override one method of AssetTagHelper
On 28 Oct 2008, at 17:46, Rémi Gagnon <[EMAIL PROTECTED] s.net> wrote: > > I created a file ./lib/action_view/helpers/asset_tag_helper.rb > > and put in it only the method I want to override. like this > Don't. Create lib/my_module.rb and then include MyModule into ActionView::Base. Or it might be more convenient to do this in application_helper > module ActionView > module Helpers #:nodoc: >module AssetTagHelper > def image_path(source) >compute_public_path(source, 'images') > end >end > end > end > > But as soon I try this all the others methods from the overriden > module > are not available anymore. > > Any idea? > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Old Rails app: can't find file_column gem?
Could it be that I need to install RMagick? Might that be the case? -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Simple Routes Question
See this: http://jroller.com/obie/entry/seo_optimization_of_urls_in On Tue, Oct 28, 2008 at 3:51 PM, Nicktabs <[EMAIL PROTECTED]> wrote: > > I currently have list of different articles (in this case health > articles) at the moment their show URL format is: > > http://localhost:3000/conditions/1 > > but I would like a more descriptive URL than this, so I would like it > to read: > > http://localhost:3000/conditions/cancer > > This is the title of the article which is currnetly stored in a row in > the database. I'm new to all this so thought i'd ask for some > pointers :) > > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Old Rails app: strange problem with getaddrinfo
Ah I had the RAILS_ENV=production set in environment.rb, THAT was the problem... Another few hours wasted for nearly nothing lol. ;-) -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Iterating through all model records without pre-instantiating them
Hi, I'm writing a migration script which has to, well, actually migrate all data from table A to table B, but I need to access the application logic in model A for each row migrated. I could do this: MyModel.all.each do |instance| # do stuff... end but as far as I know that would pre-instantiate all records in memory beforehand, which could be *really bad* with the amount of records I'm dealing with, and I only really need to work with a record at a time. An alternative I'm currently using is: execute("SELECT * FROM table_a").each_hash do |row| instance = MyModel.new(row) end but I believe this is also sub-optimal (especially since some attributes are attr_protected, therefore I'm having to take care of those manually, and other reasons). Is there any obvious/elegant way of doing this I'm missing? Thanks, -Pedro --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Simple Routes Question
I currently have list of different articles (in this case health articles) at the moment their show URL format is: http://localhost:3000/conditions/1 but I would like a more descriptive URL than this, so I would like it to read: http://localhost:3000/conditions/cancer This is the title of the article which is currnetly stored in a row in the database. I'm new to all this so thought i'd ask for some pointers :) 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How to override one method of AssetTagHelper
I created a file ./lib/action_view/helpers/asset_tag_helper.rb and put in it only the method I want to override. like this module ActionView module Helpers #:nodoc: module AssetTagHelper def image_path(source) compute_public_path(source, 'images') end end end end But as soon I try this all the others methods from the overriden module are not available anymore. Any idea? -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: acts_as_authenticated now at github
Good point. But if you see/find a way of making the tasts and so on compaterable with e-mail as well as normal login. I can give you access. What is your github name so I can ad you? On Oct 28, 6:26 pm, jdonnell <[EMAIL PROTECTED]> wrote: > that's what I do, but I do it so often that it gets old. You have to > change the tests too if you care about running them, which I do. > > On Oct 28, 8:15 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > Dear jdonnell > > > I have used AAA with e-mail as their login. > > You just have to change the form, and the model validation. > > But a good point to add to the wiki. > > You can try to do what I explained, and if it works, I will give you > > write access to the wiki, so you can share it with everybody else. > > > regards > > svend --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: TeachMate.org goes opensource
Well the major distinction between a website and a local application is precisely that... where it runs. Lets take OpenOffice... You download a copy and run it on your machine. You can choose to alter your copy and be the sole user of those changes You can publish your changes and once approved/merged into the trunk version, other people can benefit from it. ** The benefit of the improvements made takes a longer time (if ever) to reach the potential users. Lets take Joomla... You download a copy and run it on your webserver You can choose to alter your copy You can publish your changes but there again people will need to update their own copy. ** The benefit of the improvements made still takes a longer time (if ever) to reach the potential users. Lets take teachmate.org and reddit.com... You don't download anything unless you want to change it (or branch and start your own) Whoever have their published changes approved updates the final website directly. ** The benefit of the improvements reaches all the users upon approval. Lets imagine Google was doing it where you could download the source code of their website and suggest improvements to any aspect of it where the whole user base of Google would benefit from the changes. The distinction is probably too thin to justify a new term... "Open Source Website" already says enough. But new terms also carry with them loads of meaning and in the case of Reddit and Teachmate the meaning is: "the website, it's behavior and all aspects of it belongs to the community an is actively maintained by the community". Jean-Marc http://m2i3.com On Oct 28, 11:57 am, "Aaron Turner" <[EMAIL PROTECTED]> wrote: > On Tue, Oct 28, 2008 at 8:49 AM, Jean-Marc (M2i3.com) > > <[EMAIL PROTECTED]> wrote: > > > I think you should find another term than OpenSource since the website > > itself is OpenSource... > > > Its like an OpenWebsite > > > Jean-Marc > >http://m2i3.com/blog/jean-marc > > As someone who is also working on an open source website, I'd love to > hear your reasoning for suggesting a different term. Why does it > matter if it's a website or code which runs locally? > > -- > Aaron Turnerhttp://synfin.net/http://tcpreplay.synfin.net/- Pcap editing and > replay tools for Unix & Windows > They that can give up essential liberty to obtain a little temporary > safety deserve neither liberty nor safety. -- Benjamin Franklin --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: acts_as_authenticated now at github
that's what I do, but I do it so often that it gets old. You have to change the tests too if you care about running them, which I do. On Oct 28, 8:15 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote: > Dear jdonnell > > I have used AAA with e-mail as their login. > You just have to change the form, and the model validation. > But a good point to add to the wiki. > You can try to do what I explained, and if it works, I will give you > write access to the wiki, so you can share it with everybody else. > > regards > svend --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Generating a random number
Thanks everyone for your help. A couple different ways actually worked that you all suggested. That was just driving me crazy not being able to figure out the small details of a random number in Rails. Every language does it slightly differently too. Thanks, Justin On Oct 17, 1:02 pm, Daniel Moore <[EMAIL PROTECTED]> wrote: > How about something like: > > "%09d" % rand(10) > > Or... this way seems even better: > > Array.new(9){rand 10}.join > > Where 9 can be replaced by however many digits you want. > > -Dimohttp://strd6.com/blog --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] send_file example code -- permissions?
Hi, I'm having trouble getting send_file to work. I'm building a relatively small csv file, and trying to let the user download it. My action to do the download looks like this: def send_the_file @temp_download_file_path = session[:temp_file_path] send_file @temp_download_file_path, :x_sendfile => true, :type => 'text/csv', :filename => "contacts.csv" end No errors are generated. Log says it is sending it. I wind up with an empty ( 1 byte) file on the other end. I get the same results with and without the "x_sendfile". Any advice on where the file should reside on my server and how to set the necessary permissions to allow send_file to get at it? What else could I be doing wrong? Thanks for any additional help you guys can provide. jp -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: pagination in ajax
Sijo Kg wrote: > Hi >Add the following code to view_helpers.rb .The file is in > vendor/plugins/will_paginate/lib/will_paginate(if you are using plugin) > >def page_link_or_span(page, span_class = 'current', text = nil) > text ||= page.to_s > if page and page != current_page > if update = @options[:update] > @template.link_to_remote text, :update => update, :url => > url_options(page) > else > @template.link_to text, url_options(page) > end > else > @template.content_tag :span, text, :class => span_class >end > >Then for ajax pagination in view do like > <%= will_paginate @thecollectionyouwanttopaginate, :update=>'div', > :params=>{:controller=>'controller_name',:action=>'action_name',:any_additional_parameters=>@any_additional_parameters}, > :container => false %> > > And for normal pagination do what you are currenly doing > > Sijo Hi,sijo. Thanks for ur suggestion,but i am not using will_paginate plugin. I use mislav will_paginate,can i use same code as above, since there is no plugin inside vendor/plugin.any suggestion required? 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Problem starting WEBrick
Craig Demyanovich wrote: > Rails checks the RubyGems version using Gem::RubyGemsVersion. I launched > IRB > and queried the version: > > $ irb >>> Gem::RubyGemsVersion > => "1.2.0" > > What does yours report? irb(main):001:0> Gem::RubyGemsVersion NameError: uninitialized constant Gem from (irb):1 irb(main):002:0> > Based on the error message that you received, I expect it to report an > empty > string. > > I'm on Mac OS X 10.5.5 using the built-in Ruby, 1.8.6 p114. > > $ ruby -v > ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] > > What versions of OS X and Ruby are you running? Did you install Ruby > from > source or via MacPorts or Fink? > I believe I'm running Ruby 1.8.7 from source. Again, being a complete nube, I really have no clue which file(s): Macintosh-3:~ johnclaus$ ruby --version ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.4.0] I'm also running Leopard 10.5.5. > Regards, > Craig -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Sudden failure of redirect in ActionController +verify+
= SUMMARY An ActionController +verify+ directive redirects to an :action if certain actions are not done by POST. In one case, the redirect is to an empty hash instead; in another, nearly identical, it is to the correct hash. This is seen in a functional test. Will someone please tell me what is going wrong, and how I can correct it? = ENVIRONMENT $ ruby --version ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] $ rails --version Rails 1.2.6 = DETAIL (Much of this may be easier to see in the "CODE" section, below.) AdminController is a subclass of ActionController, acting on instances of Permission, an ActiveRecord subclass. Permission#approve and Permission#deny set the :approval attribute to one string or another. admin/approve/:id and admin/deny/:id pass the respective methods to the id'ed Permission. AdminController has a +verify+ directive to require that #approve and #deny be done by POST. If they are not, the session is to :redirect_to admin/list. Class AdminControllerTest, a Test::Unit::TestCase, challenges the +verify+ by using GET requests instead. For many iterations of the test, AdminController passed. I then added some tests to AdminControllerTest; I did not change test_deny_not_post or test_accept_not_post. test_deny_not_post then started failing at assert_redirected_to. The fail message is: "response is not a redirection to all of the options supplied (redirection is <{}>), difference: <{"action"=>:list}>" test_approve_not_post, which is nearly identical, DOES NOT fail. Changing the +verify+'s :redirect_to to { :controller => :admin, :action => :list } gets the tests past the assert_redirected_to, but fails the follow_redirect (Can't follow redirects outside of current controller (from admin to admin)). This failure is in BOTH test_deny_not_post and test_approve_not_post. My controller is failing a functional test, and I don't understand why. Will someone please tell me what is going wrong, and how I can correct it? = CODE (abridged) class AdminController < ApplicationController verify :method => :post, :only => [ :destroy, :create, :update, :deny, :approve ], :redirect_to => { :action => :list }, :add_flash => { :notice => 'You cannot do this directly.' } def approve # before_filter sets @permission @permission.approve if @permission.save flash[:notice] = 'This request was approved.' else flash[:notice] = 'Could not approve the request (internal error).' end redirect_to :action => :list end def deny # before_filter sets @permission @permission.deny if @permission.save flash[:notice] = 'This request was denied.' else flash[:notice] = 'Could not deny the request (internal error).' end redirect_to :action => :list end class AdminControllerTest < Test::Unit::TestCase # #setup puts user credentials in @session def test_approve_not_post get :approve, { :id => 3 }, @session assert_response :redirect assert_redirected_to :action => :list assert_equal 'You cannot do this directly.', flash[:notice] end def test_deny_not_post get :deny, { :id => 3 }, @session assert_response :redirect assert_redirected_to :action => :list assert_equal 'You cannot do this directly.', flash[:notice] end end -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Rails 2.2.0 and Gettext incompatible?
See also rails 2.2's builtin localization stuff: http://www.artweb-design.de/2008/7/18/the-ruby-on-rails-i18n-core-api On 28 Oct 2008, at 15:59, Stanislav Bozhkov wrote: > > 10x for the explanations. > > It looks that we should continue developing with the current 2.1.2 > version. > > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] paginator
I want to use a paginator-1.1.0 for my list of books in radiant extension plugin. Can you help me, in which way I can create it. Write me soon regards Roberto --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Rails 2.2.0 and Gettext incompatible?
10x for the explanations. It looks that we should continue developing with the current 2.1.2 version. -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: TeachMate.org goes opensource
On Tue, Oct 28, 2008 at 8:49 AM, Jean-Marc (M2i3.com) <[EMAIL PROTECTED]> wrote: > > I think you should find another term than OpenSource since the website > itself is OpenSource... > > Its like an OpenWebsite > > Jean-Marc > http://m2i3.com/blog/jean-marc As someone who is also working on an open source website, I'd love to hear your reasoning for suggesting a different term. Why does it matter if it's a website or code which runs locally? -- Aaron Turner http://synfin.net/ http://tcpreplay.synfin.net/ - Pcap editing and replay tools for Unix & Windows They that can give up essential liberty to obtain a little temporary safety deserve neither liberty nor safety. -- Benjamin Franklin --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Writing Tests & Assertions?
Look at this -> http://www.lukeredpath.co.uk/2006/8/29/developing-a-rails-model-using-bdd-and-rspec-part-1 On Tue, Oct 28, 2008 at 12:42 PM, John Griffiths <[EMAIL PROTECTED]> wrote: > > Hi, anyone know of any really good & quick guides I can read to learn up > on writing Test's for my Rails apps? > > Something that i really really need to improve on. > > any ideas? > > appreciate it > -- > Posted via http://www.ruby-forum.com/. -- Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) João Pessoa, PB, +55 83 8867-7208 --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Rails 2.2.0 and Gettext incompatible?
Htis is only the top of the iceberg, render_file can be fixed by patching gettext, but the rest of gettext must largely be rewritten, since rails does not use class- instance variables(@@) anymore for thread safety reasons therefore my guess is that the next version of gettext could take some time... On Oct 26, 4:15 pm, Stanislav Bozhkov <[EMAIL PROTECTED] s.net> wrote: > Hi all, > > Today I tried to upgrade one my Rails app to use version 2.2.0 of the > framework. However mongrel could not start because of some > incompatibility problems. > > The version of gettext gem is 1.93.0 > > Here it is the error output: > > /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.0/lib/active_support/core_ext/module/aliasing.rb:33:in > `alias_method': undefined method `render_file' for class > `ActionView::Base' (NameError) > from > /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.0/lib/active_support/core_ext/module/aliasing.rb:33:in > `alias_method_chain' > from > /usr/lib64/ruby/gems/1.8/gems/gettext-1.93.0/lib/gettext/rails.rb:291 > from > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in > `gem_original_require' > from > /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' > from > /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.0/lib/active_support/dependencies.rb:148:in > `require' > from > /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.0/lib/active_support/dependencies.rb:507:in > `new_constants_in' > from > /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.0/lib/active_support/dependencies.rb:148:in > `require' > from > /home/gottin/workspace-netbeans/fanizen/app/controllers/application.rb:1 > ... 33 levels... > from > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/command.rb:212:in > `run' > from > /usr/lib64/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 > from /usr/bin/mongrel_rails:19:in `load' > from /usr/bin/mongrel_rails:19 > -- > > Does someone has any ideas how to fix or workaround this problem? I feel > that I should not be the only one with this. > -- > 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: TeachMate.org goes opensource
I think you should find another term than OpenSource since the website itself is OpenSource... Its like an OpenWebsite Jean-Marc http://m2i3.com/blog/jean-marc On Oct 27, 4:54 am, snitko <[EMAIL PROTECTED]> wrote: > http://teachmate.orghttp://github.com/snitko/teachmate/tree/master --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Writing Tests & Assertions?
Hi, anyone know of any really good & quick guides I can read to learn up on writing Test's for my Rails apps? Something that i really really need to improve on. any ideas? appreciate 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Old Rails app: can't find file_column gem?
Hi all I'm trying to get some old Rails app to work. But when trying to start it, I get the following error: josh$ script/server => Booting WEBrick... ./script/../config/../config/environment.rb:5: warning: already initialized constant RAILS_ENV /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `gem_original_require': no such file to load -- file_column (MissingSourceFile) from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:27:in `require' from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in `require' from script/../config/../vendor/plugins/file_column/init.rb:5:in `load_plugin' from ./script/../config/../vendor/rails/railties/lib/initializer.rb:348:in `load_plugin' from ./script/../config/../vendor/rails/activesupport/lib/active_support/core_ext/kernel/reporting.rb:11:in `silence_warnings' from ./script/../config/../vendor/rails/railties/lib/initializer.rb:348:in `load_plugin' from ./script/../config/../vendor/rails/railties/lib/initializer.rb:158:in `load_plugins' from ./script/../config/../vendor/rails/railties/lib/initializer.rb:158:in `each' ... 11 levels... from ./script/../config/../vendor/rails/activesupport/lib/active_support/dependencies.rb:147:in `require' from ./script/../config/../vendor/rails/railties/lib/commands/server.rb:30 from script/server:3:in `require' from script/server:3 But I do have the file_column plugin in the vendor/plugins directory! So why is it looking for a gem? Thanks Josh -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ruby application talking to Java application (IPC suggestions please)
+1 for restful web service, or perhaps run your rails app in jruby & then you can make java calls from ruby. On Oct 28, 3:33 am, Hubert Łępicki <[EMAIL PROTECTED]> wrote: > Hi all, > > I'm wondering how can I make RoR application talk to Java application > running in background. Does anyone have any experience with this kind > of stuff? Anny suggestions welcome. > > I am running Ruby on MRI, and Java application will run on the same > machine but in JVM. > > Thanks, > H. --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Passing a function with arguments to another function with arguments that is a loop
Hi, I am a noobie. I just want to know what is the standard or most effective way of doing this I have two functions def display_price(grocery,batch) grocery_price = grocery.send(batch).price if grocery_price number_to_currency(grocery_price) else "NA" end end def loop(func,matrix) matrix.each { |matrix| display_price(@grocery,matrix) } end the "func argument" in the loop function is suppose to be display_price but how do i put it in if the "batch" is the thing that I want to be looped through? --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] to_xml associations and :only
Hi, A call to to_xml(:only => [:field], :include => :association]) will filter the association result too(the resulting association will only have :field). Is there a way around this? I want to specify different filters for the main object and the association. -- M. --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: acts_as_authenticated now at github
Dear jdonnell I have used AAA with e-mail as their login. You just have to change the form, and the model validation. But a good point to add to the wiki. You can try to do what I explained, and if it works, I will give you write access to the wiki, so you can share it with everybody else. regards svend On Oct 27, 11:51 pm, jdonnell <[EMAIL PROTECTED]> wrote: > One feature I've always wanted in AAA is the ability to use email > addresses for logging in instead of the login field. If you're open to > it I can put some effort into it. > > On Oct 27, 6:13 am, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> > wrote: > > > good idea. > > Perhaps we shold branch the project, to have a pre 2.0 part and a post > > 2.0 part? > > > But we could also hold on to .rhtml, since it still works with 2.0 and > > pre 2.0. > > > We could perpaps also intergrade some of the stuff found in the wiki > > in to the default installation? > > > Could you upgrade the wiki with the installation methode? > > > regards > > svend > > > On Oct 27, 1:31 pm, Daniel Bush <[EMAIL PROTECTED]> wrote: > > > > Hi svend, > > > Thanks for this. I just cloned it and took a quick look. > > > Looks like the last serious work was done 2 years ago. > > > > [EMAIL PROTECTED] wrote: > > > > Dear All > > > > > since stikypad went south, AAA + wiki have been down. > > > > > But now AAA + wiki, can be found at > > > >http://github.com/gundestrup/acts_as_authenticated > > > > > Please help me with upgrading the wiki, and if you like, help improve > > > > AAA. > > > > I tried it out against rails 2.1.1. > > > I just did a: > > > % script/plugin git://github.com/gundestrup/acts_as_authenticated.git > > > And then > > > % script/generate authenticated > > > All the tests are working (rake test). > > > > One thing I'd like to do is change .rhtml to .html.erb (the rails 2.x > > > action.format.renderer format). Not sure what to do though with pre > > > rails 2 on this issue. > > > > -- > > > Daniel Bush --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] [JOBS] - Ruby on Rails in Annapolis Junction, Maryland - need to be CLEARABLE
Job Title: Software Engineer (523-08) At Praxis Engineering, we value customer and mission success. That value is driven by our passion for technology. This marriage is just one of the reasons we are a leader in software and systems engineering solutions serving both government and commercial clients. Praxis engineers are highly focused and specialized, in the fields of Software development, Systems engineering, Software testing, and Configuration Management. Job Description: Web based application experience required. Technology used will be Ruby on Rails. Required Skills: • HTML/CSS/JavaScript or Ajax (AJAX is based on JavaScript, XML, HTML, CSS) • PHP 5 • Zend Framework • Apache Web Server • MySQL • Text Editor/GUI Designer – Macromedia Dream Weaver Desired Skills: This position requires 2-5 years of related experience. Experience with Ruby on Rails. Education: A Bachelor’s degree is desirable. Location: This full-time position located in Annapolis Junction, Maryland Clearance: Applicants selected will be subject to a government security investigation and must meet eligibility requirements for access to classified information. Praxis Engineering is an Equal Opportunity Employer EOE, M/F/D/V. If you are interested, please email me at [EMAIL PROTECTED] --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Old Rails app: strange problem with getaddrinfo
Frederick Cheung wrote: > On 28 Oct 2008, at 14:43, Joshua Muheim wrote: > >> >> SocketError in Startseite#index >> > It can't connect to the database. > > Fred Yes, that seems to be the problem. But I double-checked my parameters (which work for another, though newer RoR app), and it still gives the same error. My db params are: development: adapter: mysql database: bergschmuck_development username: XXX password: socket: /tmp/mysql.sock -- 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Old Rails app: strange problem with getaddrinfo
On 28 Oct 2008, at 14:43, Joshua Muheim wrote: > > Hi all > > I'm trying to get an old Rails App (RAILS_GEM_VERSION = '1.1.6') to > work > again; > > Strangely I get the following error on most pages, and I don't have > any > idea where it could come from: > > SocketError in Startseite#index > It can't connect to the database. Fred > Showing app/views/partials/_menu.rhtml where line #6 raised: > > getaddrinfo: nodename nor servname provided, or not known > > Extracted source (around line #6): > > 3: unikat_subitems = [] > 4: > 5: shop_subitems = [] > 6: produkt_typen_for_produkt('MassenArtikel').each do |id| > 7: produkt_typ = ProduktTyp.find_by_id(id) > 8: shop_subitems << {:caption => produkt_typ.name, :action => > :produkt_typ, :id => produkt_typ} > 9: end > > Trace of template inclusion: /app/views/layouts/public.rhtml > > RAILS_ROOT: script/../config/.. > Application Trace | Framework Trace | Full Trace > > vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in > `initialize' > vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in > `new' > vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in > `real_connect' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > mysql_adapter.rb:389:in > `connect' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > mysql_adapter.rb:152:in > `initialize' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > mysql_adapter.rb:82:in > `new' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > mysql_adapter.rb:82:in > `mysql_connection' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > abstract/connection_specification.rb:262:in > `send' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > abstract/connection_specification.rb:262:in > `connection_without_query_cache=' > vendor/rails/activerecord/lib/active_record/query_cache.rb:54:in > `connection=' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > abstract/connection_specification.rb:230:in > `retrieve_connection' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > abstract/connection_specification.rb:78:in > `connection' > app/helpers/application_helper.rb:11:in `produkt_typen_for_produkt' > #{RAILS_ROOT}/app/views/partials/_menu.rhtml:6:in > `_run_rhtml_47app47views47partials47_menu46rhtml' > #{RAILS_ROOT}/app/views/layouts/public.rhtml:16:in > `_run_rhtml_47app47views47layouts47public46rhtml' > > vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in > `initialize' > vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in > `new' > vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in > `real_connect' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > mysql_adapter.rb:389:in > `connect' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > mysql_adapter.rb:152:in > `initialize' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > mysql_adapter.rb:82:in > `new' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > mysql_adapter.rb:82:in > `mysql_connection' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > abstract/connection_specification.rb:262:in > `send' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > abstract/connection_specification.rb:262:in > `connection_without_query_cache=' > vendor/rails/activerecord/lib/active_record/query_cache.rb:54:in > `connection=' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > abstract/connection_specification.rb:230:in > `retrieve_connection' > vendor/rails/activerecord/lib/active_record/connection_adapters/ > abstract/connection_specification.rb:78:in > `connection' > vendor/rails/actionpack/lib/action_view/base.rb:326:in `send' > vendor/rails/actionpack/lib/action_view/base.rb:326:in > `compile_and_render_template' > vendor/rails/actionpack/lib/action_view/base.rb:301:in > `render_template' > vendor/rails/actionpack/lib/action_view/base.rb:260:in `render_file' > vendor/rails/actionpack/lib/action_view/base.rb:275:in `render' > vendor/rails/actionpack/lib/action_view/partials.rb:59:in > `render_partial' > vendor/rails/actionpack/lib/action_controller/benchmarking.rb:26:in > `benchmark' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > 1.8/benchmark.rb:293:in > `measure' > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > 1.8/benchmark.rb:307:in > `realtime' > vendor/rails/actionpack/lib/action_controller/benchmarking.rb:26:in > `benchmark' > vendor/rails/actionpack/lib/action_view/partials.rb:58:in > `render_partial' > vendor/rails/actionpack/lib/action_view/base.rb:287:in `render' > vendor/rails/actionpack/lib/action_view/base.rb:326:in `send' > vendor/rails/actionpack/lib/action_view/base.rb:326:in > `compile_and_render_template' > vendor/rails/actionpack/lib/act
[Rails] Old Rails app: strange problem with getaddrinfo
Hi all I'm trying to get an old Rails App (RAILS_GEM_VERSION = '1.1.6') to work again; Strangely I get the following error on most pages, and I don't have any idea where it could come from: SocketError in Startseite#index Showing app/views/partials/_menu.rhtml where line #6 raised: getaddrinfo: nodename nor servname provided, or not known Extracted source (around line #6): 3: unikat_subitems = [] 4: 5: shop_subitems = [] 6: produkt_typen_for_produkt('MassenArtikel').each do |id| 7: produkt_typ = ProduktTyp.find_by_id(id) 8: shop_subitems << {:caption => produkt_typ.name, :action => :produkt_typ, :id => produkt_typ} 9: end Trace of template inclusion: /app/views/layouts/public.rhtml RAILS_ROOT: script/../config/.. Application Trace | Framework Trace | Full Trace vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in `initialize' vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in `new' vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in `real_connect' vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:389:in `connect' vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:152:in `initialize' vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:82:in `new' vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:82:in `mysql_connection' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in `send' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in `connection_without_query_cache=' vendor/rails/activerecord/lib/active_record/query_cache.rb:54:in `connection=' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:230:in `retrieve_connection' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection' app/helpers/application_helper.rb:11:in `produkt_typen_for_produkt' #{RAILS_ROOT}/app/views/partials/_menu.rhtml:6:in `_run_rhtml_47app47views47partials47_menu46rhtml' #{RAILS_ROOT}/app/views/layouts/public.rhtml:16:in `_run_rhtml_47app47views47layouts47public46rhtml' vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in `initialize' vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in `new' vendor/rails/activerecord/lib/active_record/vendor/mysql.rb:111:in `real_connect' vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:389:in `connect' vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:152:in `initialize' vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:82:in `new' vendor/rails/activerecord/lib/active_record/connection_adapters/mysql_adapter.rb:82:in `mysql_connection' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in `send' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:262:in `connection_without_query_cache=' vendor/rails/activerecord/lib/active_record/query_cache.rb:54:in `connection=' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:230:in `retrieve_connection' vendor/rails/activerecord/lib/active_record/connection_adapters/abstract/connection_specification.rb:78:in `connection' vendor/rails/actionpack/lib/action_view/base.rb:326:in `send' vendor/rails/actionpack/lib/action_view/base.rb:326:in `compile_and_render_template' vendor/rails/actionpack/lib/action_view/base.rb:301:in `render_template' vendor/rails/actionpack/lib/action_view/base.rb:260:in `render_file' vendor/rails/actionpack/lib/action_view/base.rb:275:in `render' vendor/rails/actionpack/lib/action_view/partials.rb:59:in `render_partial' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:26:in `benchmark' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:307:in `realtime' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:26:in `benchmark' vendor/rails/actionpack/lib/action_view/partials.rb:58:in `render_partial' vendor/rails/actionpack/lib/action_view/base.rb:287:in `render' vendor/rails/actionpack/lib/action_view/base.rb:326:in `send' vendor/rails/actionpack/lib/action_view/base.rb:326:in `compile_and_render_template' vendor/rails/actionpack/lib/action_view/base.rb:301:in `render_template' vendor/rails/actionpack/lib/action_view/base.rb:260:in `render_file' vendor/rails/actionpack/lib/action_controller/layout.rb:254:in `render_without_benchmark' vendor/rails/actionpack/lib/action_controller/benchmarking.rb:50:in `render' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/benchmark.rb:293:in `measure' v
[Rails] Re: Ruby application talking to Java application (IPC suggestions please)
Hi Hubert, Hubert Lepicki wrote: > I'm wondering how can I make RoR application talk > to Java application running in background. Web Services; RESTFUL or otherwise. Though you can do SOAP on Rails, I recommend picking up "RESTful Web Services" by Leonard Richardson and Sam Ruby. HTH, Bill --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Can not install sqlite3-ruby
Khaled mahmud Khaled wrote: > Hi Friends, > > I could not setup sqlite3. When I type "gem install sqlite3-ruby > --version 1.2.4" in the command prompt. The following problem is > arising. > On Windows, I think you need 1.2.3 - so you should do: gem install sqlite3-ruby --version 1.2.3 That should get it working. Cheers, Mohit. 10/28/2008 | 10:29 PM. --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: RESTful resource with multiple view representations
Thanks, I think I looked at something similar to a mode/context param previously but seemed to drift away. I might have another look. In this scenario are you suggesting sticking the conditional logic against the mode param in the action RJS view? @display_context = params[:context] respond_to do |format| format.js end Is there a way to specify the specific RJS file in the action? Concept (format.js lines not necessarily valid, just to show intention): display_context = params[:context] respond_to do |format| if display_context == "sales" format.js { :render => 'sales_products' } if display_context == "purchase" format.js { :render => 'purchase_products' } else format.js { :render => 'products' } end end On 28 Oct, 14:00, Jeff <[EMAIL PROTECTED]> wrote: > On Oct 28, 8:43 am, Andrew Edwards <[EMAIL PROTECTED]> > wrote: > > > > > Hi, > > > Could somewhat offer guidance on this situation. > > > Say I have a Product model and an associated resource reference > > defined: > > > map.resources :products, :collection => { :search => :get } > > > I need to access the search action but have a different view > > (generally RJS) rendered depending on the context of the call. > > > For example, if called from an order assembly page I might need the > > resulting product collection displayed with add to basket links. > > Whereas on another page I might need them rendered with add to > > purchase order links. > > > I see to obvious solutions: > > > 1. Define multiple actions within a single resource. They would > > essentially have the same code but would call different RJS view code > > to render the result. > > > map.resources :products, :collection => { :sales_order_search > > => :get, :purchase_order_search => :get } > > > 2. Have multiple resources such as as: > > > map.resources :sales_order_products, :collection => { :search > > => :get } > > map.resources :purchase_order_products, :collection => > > { :search => :get } > > > If going down route 2 I'd probably just repurpose the index action to > > check for a search_string param to narrow the results returned. > > > Both seem less than perfect, although I'm tended towards solution 1. > > Although I've only highlighted two view contexts there could be more, > > I would suggest 3 or 4 could be common. How would you handle this > > situation? > > > Thanks, Andrew > > First off, what about using the same search action for each, and using > query parameters to specify the desired behavior? That way you won't > need a new custom action every time you need a new "flavor" of search > call. It's perfectly RESTful to append any query parameters you need > to your actions (/products/search?mode=purchase, or whatever). > > However, maybe you really need a separate controller entirely, like a > ProductSearchesController, whose index action can take whatever > parameters you think are appropriate. That might help encapsulate all > of your searching functionality and keep the ProductsController > restful and clean. > > Just some ideas > > Jeff > > purpleworkshops.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: RESTful resource with multiple view representations
On Oct 28, 8:43 am, Andrew Edwards <[EMAIL PROTECTED]> wrote: > Hi, > > Could somewhat offer guidance on this situation. > > Say I have a Product model and an associated resource reference > defined: > > map.resources :products, :collection => { :search => :get } > > I need to access the search action but have a different view > (generally RJS) rendered depending on the context of the call. > > For example, if called from an order assembly page I might need the > resulting product collection displayed with add to basket links. > Whereas on another page I might need them rendered with add to > purchase order links. > > I see to obvious solutions: > > 1. Define multiple actions within a single resource. They would > essentially have the same code but would call different RJS view code > to render the result. > > map.resources :products, :collection => { :sales_order_search > => :get, :purchase_order_search => :get } > > 2. Have multiple resources such as as: > > map.resources :sales_order_products, :collection => { :search > => :get } > map.resources :purchase_order_products, :collection => > { :search => :get } > > If going down route 2 I'd probably just repurpose the index action to > check for a search_string param to narrow the results returned. > > Both seem less than perfect, although I'm tended towards solution 1. > Although I've only highlighted two view contexts there could be more, > I would suggest 3 or 4 could be common. How would you handle this > situation? > > Thanks, Andrew First off, what about using the same search action for each, and using query parameters to specify the desired behavior? That way you won't need a new custom action every time you need a new "flavor" of search call. It's perfectly RESTful to append any query parameters you need to your actions (/products/search?mode=purchase, or whatever). However, maybe you really need a separate controller entirely, like a ProductSearchesController, whose index action can take whatever parameters you think are appropriate. That might help encapsulate all of your searching functionality and keep the ProductsController restful and clean. Just some ideas Jeff purpleworkshops.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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: has_many :through, with condition
On 28 Oct 2008, at 13:44, Andrew Porter wrote: > > Frederick Cheung wrote: >> >> I don't think 2.2 will be any different. I did have plans to look at >> it but got side tracked and didn't get it finished. > > Does anyone know if there are any plans to allow conditions to be > specified that are applied to the ON clause of a join ? you can do that anyway - :joins accepts arbitrary sql fragments. Fred > > > > > --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: has_many :through, with condition
Frederick Cheung wrote: > > I don't think 2.2 will be any different. I did have plans to look at > it but got side tracked and didn't get it finished. Does anyone know if there are any plans to allow conditions to be specified that are applied to the ON clause of a join ? --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] RESTful resource with multiple view representations
Hi, Could somewhat offer guidance on this situation. Say I have a Product model and an associated resource reference defined: map.resources :products, :collection => { :search => :get } I need to access the search action but have a different view (generally RJS) rendered depending on the context of the call. For example, if called from an order assembly page I might need the resulting product collection displayed with add to basket links. Whereas on another page I might need them rendered with add to purchase order links. I see to obvious solutions: 1. Define multiple actions within a single resource. They would essentially have the same code but would call different RJS view code to render the result. map.resources :products, :collection => { :sales_order_search => :get, :purchase_order_search => :get } 2. Have multiple resources such as as: map.resources :sales_order_products, :collection => { :search => :get } map.resources :purchase_order_products, :collection => { :search => :get } If going down route 2 I'd probably just repurpose the index action to check for a search_string param to narrow the results returned. Both seem less than perfect, although I'm tended towards solution 1. Although I've only highlighted two view contexts there could be more, I would suggest 3 or 4 could be common. How would you handle this situation? Thanks, Andrew --~--~-~--~~~---~--~~ You received 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 [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---