[Rails] Re: search function implimentaion with the tag name as the search box entry
Ya you can do.. But one thing, its not efficient to give the select options in code.. You have to get from DB.. So that you can use collection_select.. Use 2 collection_select for both the drop down boxes.. Then use normal search query for search.. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Odd problem with rake test
On 12 Dec 2008, at 07:27, John Small wrote: > > >> >> My guess is that you are using fixtures and each test that fails >> isn't >> specifying the ones on which it relies. >> >> -Rob > Rob > > Err, no. The test unit specifies the fixtures it uses so that should > be > OK. But the error comes from a missing variable in a partial. It fails > when I run ruby test/functional/etc but not when I rake > test:functionals. > > It's worrying because I have to wonder what other tests should be > failing but aren't failing when I run the entire test suite rather > than > the individual units. > IIRC there is an issue where partials sort of remember :locals that were passed in previous invocations (in that they will exist with value nil on subsequent calls if you don't specify them) Fred > John > > -- > Posted via http://www.ruby-forum.com/. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: CookieOverflow errors while using DB cookie store
On 12 Dec 2008, at 07:49, brady8 wrote: > > Hello all, > > Using Edge Rails, SQLite development database on OSX. Are you trying to store lots of stuff in the session ? Fred > I'm receiving CookieOverflow errors in my application while using the > AR cookie store. > Tested in both Safari and Firefox, same error, although sporadically > (I can't reliably reproduce the error in the same part of my > application, seems to occur all over). > The thing is, this is after clearing the browser cache in both Safari > and FF, and Web Development addon for FF confirms that there isn't > even a session cookie being stored, just a 500 Failsafe error from > Rails. > Also, the obvious: tried stopping/starting the server multiple times, > even wiped out the database and ran migrations from scratch. > > The trace is below, but not very helpful. Has anyone else ran into a > problem like this using the DB cookie store, and/or know how to fix > it? > > Thanks for your time, > Brady > br...@lunardawn.ca > > Rails Trace: - > Processing VoteController#index (for 127.0.0.1 at 2008-12-12 00:41:24) > [GET] > Parameters: {"action"=>"index", "controller"=>"vote", "key"=>"2342"} > > CGI::Session::CookieStore::CookieOverflow > (CGI::Session::CookieStore::CookieOverflow): > /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ > 1.8/cgi/session.rb:324:in `close' > > Rendered rescues/_trace (93.7ms) > Rendered rescues/_request_and_response (6.3ms) > Rendering rescues/layout.erb (internal_server_error) > /!\ FAILSAFE /!\ December 12, 2008 12:41 AM > Status: 500 Internal Server Error > CGI::Session::CookieStore::CookieOverflow >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > session/cookie_store.rb:111:in `close' >/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ > ruby/1.8/cgi/session.rb:324:in `close' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > base.rb:1300:in `close_session' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > base.rb:1328:in `process_cleanup_without_session_management_support' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > session_management.rb:137:in `process_cleanup' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > base.rb:523:in `process_without_filters' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > filters.rb:606:in `process_without_session_management_support' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > session_management.rb:127:in `process' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > rescue.rb:63:in `process_with_exception' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:131:in `failsafe_rescue' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:65:in `dispatch_unlocked' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:76:in `dispatch' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:75:in `synchronize' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:75:in `dispatch' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:93:in `_call' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:57:in `initialize' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > failsafe.rb:11:in `call' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > failsafe.rb:11:in `call' >/Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ > dispatcher.rb:87:in `call' >/Users/Crash/website/vendor/rails/railties/lib/rails/rack/ > static.rb:27:in `call' >/Users/Crash/website/vendor/rails/railties/lib/rails/rack/ > logger.rb:14:in `call' >/Library/Ruby/Gems/1.8/gems/rack-0.4.0/lib/rack/handler/mongrel.rb: > 59:in `process' >/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in > `process_client' >/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in > `each' >/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in > `process_client' >/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in > `run' >/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in > `initialize' >/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in > `new' >/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in > `run' >/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in > `initialize' >/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in > `new' >/Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in > `run' >/Library/Ruby/Gems/1.8/gems/rack-0.4.0/lib/rack/handler/mongrel.rb: > 32:in `run' >/Users/Crash/website/vendor/ra
[Rails] Re: javascript_include within single views
so would the following be redundant then? <% content_for :javascript do %> <%= javascript_tag "new javascript function" %> <% end %> assuming i have <%= yield :javascript %> in my main layout file. On Dec 11, 6:54 pm, "Conrad Taylor" wrote: > On Thu, Dec 11, 2008 at 6:40 PM, David wrote: > > > Are you allowed to use the javascript_include_tag to include > > javascript files for specific views? I have included the default > > javascript files in the element of my site layout file, but > > when I try and include a javascript file for a specific view within a > > new element in that view it does not work. I guess my question > > is: is it okay to create separate elements for specific views? > > Will all the code get rendered that is within these new > > elements and the elements in my layout file? or will there be > > a conflict? > > Yes, you are allowed to use the javascript_include_tag to include javascript > files for specific view templates. Can you post your code so that people > can better assist you because I don't follow your question. > > -Conrad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: "mysql" 2.7.3 gem install for Windows appears incomplete
It might be documentation issue (I'm running into it too) Someone suggested. gem install mysql --no-rdoc --no-ri On Dec 9, 11:37 pm, Eric wrote: > On Dec 7, 10:13 pm, Wes Gamble > wrote: > > > No, still haven't resolved it. Hoping that the next release of the > > mysql gem for Windows will work better. > > Yeah, still broken here. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: is there a way in ./script/console to get the SQL debugging showing??? (i.e. like you see when you run ./script/server in development mode)
You could always have two terminal windows open, one with script/ console open and another with script/server. Any db calls you make will appear in the script/server window. Eifion On 12 Dec 2008, at 07:10, Greg Hauptmann wrote: > is there a way in ./script/console to get the SQL debugging > showing??? (i.e. like you see when you run ./script/server in > development mode) > > thanks > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: "mysql" 2.7.3 gem install for Windows appears incomplete
Might be one more step too... Update: Found this solution on ruby forum: http://www.ruby-forum.com/topic/171640 Copy the file libmysql.dll from mysql/bin to ruby/bin. It worked for me. Environment starts and app executes properly in 2.2.2 now. Still get the rdoc error when installing mysql, but it doesn't seem to affect the environment. On Dec 9, 11:37 pm, Eric wrote: > On Dec 7, 10:13 pm, Wes Gamble > wrote: > > > No, still haven't resolved it. Hoping that the next release of the > > mysql gem for Windows will work better. > > Yeah, still broken here. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Optionally Nested Resources
Hello, I have this model. city has_many stores store belongs_to city I created resources for them and mapped them as such, using nested resources: map.resources :cities, :has_many => :stores But I wanted to make the stores available independant from the city, so I added: map.resources :stores And, at this point I wonder: - There is an algorithmic way to convert a normal resource to a nested one: 1) edit config/routes.rb and add the :has_many or the block, to route it as nested. 2) change all named routes to, in this case, city_stores_ {path,url}. 3) edit controller, normally add a before_filter to get or find the parent resource. 4) edit all find and new methods from the controller to use the parent.childs collection, to build or find the proper children resources. So, is there a simple way to achieve this double purpose controller without having to create a new CityStoreController? Any, howto, tutorial, screencast, mail, forum, blog-post, would be very appreciated! Thanks for reading till here, and thanks A LOT for the help you can give. -- Daniel --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ruby Arrays - Passing arrays from a function possible?
def add_item(×product_attributes) product, quantity, description, color, size = ×product_attributes end then add_time(product, quantity, description, color, size) On Dec 11, 1:28 pm, Bob Sanders wrote: > I see that I'm repeating a lot of code throughout my app, and I wanted > to do something like this in my model: > > def product_attributes > [product, quantity, description, color, size] > end > > def add_item(product_attributes) > ... > end > > ...but that of course isn't working. (I'm getting a "wrong number of > arguments (5 for 1)" error) > > Is there a way to pass those product attributes into the add_item > function properly? Or, maybe you know of a different way I should I > approach 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ruby Arrays - Passing arrays from a function possible?
On Thu, Dec 11, 2008 at 4:14 PM, Bob Sanders wrote: > > Ryan Bigg wrote: >> Or I think you can do *args for the receivIng method and then call it >> like method(product_attributes) and that will pass the array to the >> method > > Thanks Ryan. Can you explain more about how *args would work? I'm > googling for more info, but can't seem to find a good tutorial on it. google for: ruby splat operator you feel lucky: http://theplana.wordpress.com/2007/03/03/ruby-idioms-the-splat-operator/ -Michael -- Michael C. Libby www.mikelibby.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Active Record - find - select option
On 12 Dec 2008, at 03:54, Bharat Ruparel wrote: > > I should mention something else. I am on Rails 2.1.0 and even > find_by_sql does not return columns from multiple tables as the Rails > API documentation says: > > This example is from Rails API docs: > > # A simple SQL query spanning multiple tables > Post.find_by_sql "SELECT p.title, c.author FROM posts p, comments c > WHERE p.id = c.post_id" >> [#"Ruby Meetup", > "first_name"=>"Quentin"}>, ...] > > I followed this for my queries and I can only get columns from > either of > the tables but not both. > > Is this a bug? The attributes are there, but the default inspect method on ActiveRecord objects (which is used to display objects in the console doesn't display them Fred > > -- > Posted via http://www.ruby-forum.com/. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] CookieOverflow errors while using DB cookie store
Hello all, Using Edge Rails, SQLite development database on OSX. I'm receiving CookieOverflow errors in my application while using the AR cookie store. Tested in both Safari and Firefox, same error, although sporadically (I can't reliably reproduce the error in the same part of my application, seems to occur all over). The thing is, this is after clearing the browser cache in both Safari and FF, and Web Development addon for FF confirms that there isn't even a session cookie being stored, just a 500 Failsafe error from Rails. Also, the obvious: tried stopping/starting the server multiple times, even wiped out the database and ran migrations from scratch. The trace is below, but not very helpful. Has anyone else ran into a problem like this using the DB cookie store, and/or know how to fix it? Thanks for your time, Brady br...@lunardawn.ca Rails Trace: - Processing VoteController#index (for 127.0.0.1 at 2008-12-12 00:41:24) [GET] Parameters: {"action"=>"index", "controller"=>"vote", "key"=>"2342"} CGI::Session::CookieStore::CookieOverflow (CGI::Session::CookieStore::CookieOverflow): /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ 1.8/cgi/session.rb:324:in `close' Rendered rescues/_trace (93.7ms) Rendered rescues/_request_and_response (6.3ms) Rendering rescues/layout.erb (internal_server_error) /!\ FAILSAFE /!\ December 12, 2008 12:41 AM Status: 500 Internal Server Error CGI::Session::CookieStore::CookieOverflow /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ session/cookie_store.rb:111:in `close' /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ ruby/1.8/cgi/session.rb:324:in `close' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ base.rb:1300:in `close_session' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ base.rb:1328:in `process_cleanup_without_session_management_support' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ session_management.rb:137:in `process_cleanup' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ base.rb:523:in `process_without_filters' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ filters.rb:606:in `process_without_session_management_support' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ session_management.rb:127:in `process' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ rescue.rb:63:in `process_with_exception' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:131:in `failsafe_rescue' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:65:in `dispatch_unlocked' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:76:in `dispatch' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:75:in `synchronize' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:75:in `dispatch' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:93:in `_call' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:57:in `initialize' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ failsafe.rb:11:in `call' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ failsafe.rb:11:in `call' /Users/Crash/website/vendor/rails/actionpack/lib/action_controller/ dispatcher.rb:87:in `call' /Users/Crash/website/vendor/rails/railties/lib/rails/rack/ static.rb:27:in `call' /Users/Crash/website/vendor/rails/railties/lib/rails/rack/ logger.rb:14:in `call' /Library/Ruby/Gems/1.8/gems/rack-0.4.0/lib/rack/handler/mongrel.rb: 59:in `process' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' /Library/Ruby/Gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' /Library/Ruby/Gems/1.8/gems/rack-0.4.0/lib/rack/handler/mongrel.rb: 32:in `run' /Users/Crash/website/vendor/rails/railties/lib/commands/server.rb: 100 /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require' /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require' script/server:3 --~--~-~--~~~---~--~~ You
[Rails] Re: Active Record - find - select option
On 12 Dec 2008, at 02:08, Bharat Ruparel wrote: > y: > > Coach.find :all, :select => 'c.id, a.id, a.name', > :joins => 'as c inner join accounts as a on a.id = > c.account_id', > :order => 'a.name' > > It is only returning the following in irb: > > [#] > > That is, it fails to return the account.id (or a.id) and account.name > (or a.name) > > How do I resolve this? alias the account id to be something other than id. Fred > > > Thanks in advance for your help and time. > > 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Implementing auto_complete and acts_as_taggable
Hi, In my book store application I have installed acts_as_taggable for adding tags.Now I want to add auto_complete feature in the tag field. I have googled a lot but not get the clear idea. will anybody guide me for a solution or any tutorial for that. Thx in advance. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Odd problem with rake test
> > My guess is that you are using fixtures and each test that fails isn't > specifying the ones on which it relies. > > -Rob Rob Err, no. The test unit specifies the fixtures it uses so that should be OK. But the error comes from a missing variable in a partial. It fails when I run ruby test/functional/etc but not when I rake test:functionals. It's worrying because I have to wonder what other tests should be failing but aren't failing when I run the entire test suite rather than the individual units. John -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] is there a way in ./script/console to get the SQL debugging showing??? (i.e. like you see when you run ./script/server in development mode)
is there a way in ./script/console to get the SQL debugging showing??? (i.e. like you see when you run ./script/server in development mode) thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] why is wrong with this code - the model "save!" method does not seem to give a correct response back?
Hi, I have a model for which when I go to save an item it doesn't seem to get saved. In the console I don't get a "record not saved" error??? But rather the response seems to give me back a Transaction object (i.e. for which the saved Allocation object has a relationship with)? Any ideas why? CONSOLE OUTPUT ?> a = Allocation.new => # >> a.valid? => false >> a.transaction_id = 1784 => 1784 >> a.person_id = 1 => 1 >> a.amount = 100 => 100 >> a.valid? => true >> a.save! => #, balance: #, description: "food", notes: nil, created_at: "2008-12-08 21:21:17", updated_at: "2008-12-08 21:21:17", projection: true> >> a => #, amount_percent: nil, created_at: nil, updated_at: nil> >> MODEL --- Macintosh-2:myequity greg$ cat app/models/allocation.rb # == Schema Information # Schema version: 20081128104846 # # Table name: allocations # # id :integer(4) not null, primary key # transaction_id :integer(4) not null # person_id :integer(4) not null # recurring_id :integer(4) # amount :decimal(9, 2) # amount_percent :decimal(9, 2) # created_at :datetime # updated_at :datetime # class Allocation < ActiveRecord::Base belongs_to :person belongs_to :transaction validates_numericality_of :amount, :if => :amount validates_numericality_of :amount_percent, :if => :amount_percent private def validate errors.add_to_base('amount and amount_percent can not both be specified') if amount && amount_percent errors.add_to_base('either amount OR amount_percent must be specified') if !amount && !amount_percent end end --- --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: search function implimentaion with the tag name as the search box entry
hi priya, thnaks again i am able to get the dropdown box for search text box.And able to get the searched streams list. i have tried like this. ---in index.html.erb--- search :<%= select_tag 'category',options_for_select([['mpeg2 25fps'], ['mpeg2 30fps'], ['mpeg2'], ['1920x1080'], ['h264'], ['aac']], to_s), :onchange => "content.category(this,notnull ) ;" %> <%= observe_field 'category', :frequency => 0.5, :update => 'results', :url => { :controller => 'streams', :action=> 'get_results' }, :with => "'search_text=' + escape(value)", :loading => "document.getElementById('spinner').style.display='inline'", :loaded => "document.getElementById('spinner').style.display='none'" %> But this procedure is very bad beacuase we have to give the number combinations for dropdown box if i have number of searchable options. So now what i want to do is like this: e.g i have two dropdown boxes one for codecformat one for resolution using drop down box i can select codecforformat as mpeg2 and resolution as 1920x1080 now by using the search button i want to search the streams for the corresponding selection. i hope you understand my problem. Can we do it? Can you give me any suggestion or idea to do this? thanks for spending time for reading my querys and replying regards Srikanth On Fri, Dec 12, 2008 at 11:32 AM, Priya Buvan wrote: > > Hi, > In the place of textbox in template, you can display the text using > collection_select. > -- > Posted via http://www.ruby-forum.com/. > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] default value using Autocompleter.local
I'm using recipe 7 from Rails Recipes to get really fast auto- completion through Javascript. I was previously using text_field_auto_complete which lets me define a :value that appears in the field when the page is loaded - serving as a default value. I'd like to preserve this using the "<%= javascript_tag("new Autocompleter.Local(..." but I don't know how to define a default value. -a --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Loading ActiveRecord and ActionMailer only in a worker process to save memory
For a Rails app, I have a SimpleDaemon process that does some URL fetching and sends off emails. The daemon script requires the config/ environment.rb of the Rails app. But this script really only needs to require ActiveRecord and ActionMailer. I'm thinking of refactoring my code so as not to include the entire Rails environment, but I have a two questions for anyone who has experience doing something similar: 1. Can it save a lot of memory to do this? 2. If I'm using Ruby Enterprise Edition and Phusion for the Rails app, do the memory and speed benefits extend to the daemon script? Thanks to anyone who can help --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] cache_sweeper undefined for controllers
Any clues on why I'm getting cache_sweeper undefined to any controller on Rails 2.1? NoMethodError (undefined method `cache_sweeper' for CommentsController:Class): /app/controllers/comments_controller.rb:5 /vendor/rails/activesupport/lib/active_support/dependencies.rb:216:in `load_without_new_constant_marking' /vendor/rails/activesupport/lib/active_support/dependencies.rb:216:in `load_file' /vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in' /vendor/rails/activesupport/lib/active_support/dependencies.rb:215:in `load_file' /vendor/rails/activesupport/lib/active_support/dependencies.rb:96:in `require_or_load' /vendor/rails/activesupport/lib/active_support/dependencies.rb:261:in `load_missing_constant' /vendor/rails/activesupport/lib/active_support/dependencies.rb:468:in `const_missing_not_from_s3_library' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/aws-s3-0.5.1/lib/aws/s3/extensions.rb:174:in `const_missing' /vendor/rails/activesupport/lib/active_support/dependencies.rb:480:in `const_missing' /vendor/rails/activesupport/lib/active_support/inflector.rb:285:in `constantize' /vendor/rails/activesupport/lib/active_support/inflector.rb:284:in `each' /vendor/rails/activesupport/lib/active_support/inflector.rb:284:in `constantize' /vendor/rails/activesupport/lib/active_support/core_ext/string/inflections.rb:143:in `constantize' /vendor/rails/actionpack/lib/action_controller/routing/route_set.rb:387:in `recognize' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:148:in `handle_request' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:107:in `dispatch' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `synchronize' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:104:in `dispatch' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:120:in `dispatch_cgi' /vendor/rails/actionpack/lib/action_controller/dispatcher.rb:35:in `dispatch' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in `process' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `synchronize' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in `process' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in `process_client' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `each' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in `process_client' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `initialize' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `new' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in `run' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `initialize' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `new' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in `run' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in `run' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `each' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in `run' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in `run' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in `run' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:281 /vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `load' /vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `load' /vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants_in' /vendor/rails/activesupport/lib/active_support/dependencies.rb:503:in `load' /vendor/rails/railties/lib/commands/servers/mongrel.rb:64 /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require' /opt/ruby-enterprise-1.8.6-20080810/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require' /vendor/rails/activesupport/lib/active_support/dependencies.rb:510:in `require' /vendor/rails/activesupport/lib/active_support/dependencies.rb:355:in `new_constants
[Rails] Re: search function implimentaion with the tag name as the search box entry
Hi, In the place of textbox in template, you can display the text using collection_select. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: search function implimentaion with the tag name as the search box entry
Hi Priya , thanks for your suggestions. Finally i am able to do the search with tagname. presently i can search the database by typing the string in the search box. But now i want to provide a dropdown box of search parameters instead of typing. here my search application is usin ajax . can you give any suggestions to create dropdown box and once i select the option from dropdown box how to link with it for search function? take a look at my search code: - in index.html.erb - Search: <%= observe_field 'search_form', :frequency => 0.5, :update => 'results', :url => { :controller => 'streams', :action=> 'get_results' }, :with => "'search_text=' + escape(value)", :loading => "document.getElementById('spinner').style.display='inline'", :loaded => "document.getElementById('spinner').style.display='none'" %> --- the search mthod defined in controller is def get_results if request.xhr? if params['search_text'].strip.length > 0 terms = params['search_text'].split.collect do |word| "%#{word.downcase}%" end if blank? flash[:notice] = 'Stream was successfully updated.' else @streams = Stream.find_tagged_with(params[:search_text]) end end render :partial => "search" else redirect_to :action => "index" end end thnaks for any suggetions and help regards Srikanth. On Thu, Dec 11, 2008 at 11:20 AM, sreekanth. G wrote: > Hi Priya, > > below are the details of tables and corresponding taggings between > streams and tags tables in taggings table. > mysql> select * from streams; > +++---++-+---+---+++ > | id | name | location | resolution | > bitrate | framerate | codecname | created_on | updated_on | > +++---++-+---+---+++ > | 1 | dust.mpeg2 | E:\streams\RED_S_J_JE_In_NT.divx | 1920x1080 | > 6mbps | 30fps | mpeg2 | 2008-12-08 | 2008-12-08 | > | 2 | mummy.264 | E:\streams\RED_S_J_JE_In_NT.divx | 720x480| > 4mbps | 30fps | h264 | 2008-12-08 | 2008-12-08 | > | 3 | hiphop.aac | na| na | > na | na| aac | 2008-12-10 | 2008-12-10 | > | 5 | jazz.aac | na| na | > na | na| aac | 2008-12-10 | 2008-12-10 | > +++---++-+---+---+++ > 4 rows in set (0.03 sec) > > mysql> select * from tags; > ++--+ > | id | name | > ++--+ > | 1 | mpeg2| > | 2 | h264 720x480 | > | 3 | aac | > ++--+ > 3 rows in set (0.00 sec) > > mysql> select * from taggings; > +++-+---+ > | id | tag_id | taggable_id | taggable_type | > +++-+---+ > | 1 | 1 | 1 | Stream| > | 2 | 2 | 2 | Stream| > | 3 | 3 | 3 | Stream| > | 4 | 3 | 5 | Stream| > +++-+---+ > 4 rows in set (0.00 sec) > > can i use the query to search with tag field like: > > @streams = Stream.find(:all, :joins => "streams inner join tags as t on > stream.id=t.id", :conditions => ['name LIKE ?', > '%'+params[:search_text]+'%'],:select => "name") > > from the above query what i understand is: > it joing streams and tags table but using the "name" column of tags > table it is finding and storing the result of stream names from > streams table in @streams array. > > if i a m wrong let me know ? > do i need to mention anywhere association between tables in the > corresponding models? > > is there any procedure to make it work ? > > > thanks > srikanth > > > > > > > On Thu, Dec 11, 2008 at 10:46 AM, Priya Buvan > wrote: >> >> If you want to search with streams field, then you have to pass all >> those parameters else its enough to pass tag field name alone. >> >> Also we can join the 2 tables so no need to give like >> @streams=Stream.fine(:all) for tag. >> >> Do you have column heading as "name" in tag table? Check it and give the >> correct attribute name in the place of "name" >> -- >> 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 u
[Rails] Tired of Rails Fixtures? Try Dataset.
Dataset gives you an easy, declarative method for constructing sets of data to be used in testing. It is a data loading framework. This is in contrast to Machinist and Factory Girl which focus only on making it easy to create new models for testing, but have no solution for loading sets of data. Read more: http://wiseheartdesign.com/2008/12/12/h1-meet-dataset-the-fixture-killing-data-loading-framework -- John Long http://wiseheartdesign.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: auto_complete with no of occurance
just follow this for auto complete http://genlinux.blogspot.com/2008/07/prototype-ui-autocomplete-ajax-using.html -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Validating a Tag
Anyone can point me in a direction? On Dec 11, 9:33 am, elioncho wrote: > Hello, > > I am using the acts_as_taggable_on plugin (which derivates from > acts_as_taggable_on_steroids). My question is: How can I validate that > my tags doesn't have any special characters such as . / \ etc. It > seems this validations are not included in the plugin. Can you give me > any guide in which is the best way to make this validations? > > Thanks again, > > Elías --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Active Record - find - select option
@account = Account.paginate(:all, :page => params[:page],:order=>'name', :per_page => 10, :joins=>"as a inner join coaches as c on a.id=c.account_id", :select => "a.id, a.name, c.id") Try this query. Its using will_paginate only. In select option you can put whatever fields you want in those 2 tables. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to draw a large chart?
> I am meeting a big problem with charts. > > I have to display a horizontal bar chart with ~3000 bars in ~5s. > Assume > the input data are ready in the needed format. > > I have tested open flash chart, gruff, scruffy... They all failed. > With > 1000 bars, open flash chart took 15-20s. Gruff and scruffy were worse. > > Do you have any ideas? Sub the work out to gnuplot and have it generate the image maybe... -philip --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Does animated gif will work properly using RMagick?
Dear Rob, Thanks a lot, it works fine now with your below code > File.open(RAILS_ROOT + "/public/images/banner/" + image1 , "wb") do |f| >f.write image.read > end > > ...and avoid all the ImageMagick overhead. > > -Rob Regards, jose Martin -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Active Record - find - select option
I should mention something else. I am on Rails 2.1.0 and even find_by_sql does not return columns from multiple tables as the Rails API documentation says: This example is from Rails API docs: # A simple SQL query spanning multiple tables Post.find_by_sql "SELECT p.title, c.author FROM posts p, comments c WHERE p.id = c.post_id" > [#"Ruby Meetup", "first_name"=>"Quentin"}>, ...] I followed this for my queries and I can only get columns from either of the tables but not both. Is this a bug? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Active Record - find - select option
Mark, Thanks for your response. I tried that and the ids are indeed being returned by not the accounts.name. I am not sure why. 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How to draw a large chart?
I am meeting a big problem with charts. I have to display a horizontal bar chart with ~3000 bars in ~5s. Assume the input data are ready in the needed format. I have tested open flash chart, gruff, scruffy... They all failed. With 1000 bars, open flash chart took 15-20s. Gruff and scruffy were worse. Do you have 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ruby Arrays - Passing arrays from a function possible?
You can check this for a quick reference: http://www.ruby-doc.org/docs/ProgrammingRuby/html/tut_methods.html Pepe On Dec 11, 5:14 pm, Bob Sanders wrote: > Ryan Bigg wrote: > > Or I think you can do *args for the receivIng method and then call it > > like method(product_attributes) and that will pass the array to the > > method > > Thanks Ryan. Can you explain more about how *args would work? I'm > googling for more info, but can't seem to find a good tutorial on it. > -- > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Where do I start?
1. Ruby 2. Rails If you try to learn Rails at the same time that you learn Ruby you'll inevitably get to a point where you have no idea about what's going on. The person that wrote Rails is a Ruby expert and it shows, which means that sometimes you will have no idea about the techniques being used and how things work. This is true even if you have a decent understanding about Ruby (I raise my hand there). However, if you learn Ruby (and practice it before starting writing code for/with Rails) you'll be in a much better position when you start using Rails. Pepe On Dec 11, 6:51 pm, Ryan Bigg wrote: > If I had to learn rails again I would learn ruby first then drift over > into rails because I think that would give you a better understanding > of how ruby works > > On 12/12/2008, at 5:55, olivierntk wrote: > > > > > I started rails by reading Beginning Rails from Apress. > > > It will take you through most of what you need to know to start Rails. > > Being a .NET developer, it was quite easy to pick it up but I believe > > it is accessible to non web developer. > > > With Rails, you don't need to learn SQL (unless you have very specific > > tasks to achieve). > > JavaScript is nice to have (I would recommend you to use jQuery, a > > JavaScript framework) but you can have a full web app running without > > JavaScript. > > Apache? No need, Rails comes with Mongrel. > > > Ruby ... of course but you'll just need the basics and learn as you > > go. > > > My 2 cents --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: serialize array finder
Phlip wrote: > Grayson Piercee wrote: > >> User.find(:all, :conditions => ["interests in >> (?)",current_user.interests) > > Here's a wild guess. I hope someone else corrects it if I have lead you > astray! such as... User.find(:all, :include => :interests, :conditions => [ "interests.id IN (?)", current_user.interests.map(&:id) ] :order => 'COUNT(interests.id) DESC') and use inspect_sql to see the query it generates! --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Active Record - find - select option
Bharat Ruparel wrote: > Coach.find :all, :select => 'c.id, a.id, a.name', >:joins => 'as c inner join accounts as a on a.id = > c.account_id', >:order => 'a.name' > > It is only returning the following in irb: > > [#] > > That is, it fails to return the account.id (or a.id) and account.name > (or a.name) Given that you're not using :include => :account for efficiency reasons, you have to ensure that the account id does not override the coach id: Coach.find :all, :joins => :account, :order => 'accounts.name', :select => 'coaches.id, accounts.id as account_id, accounts.name' -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: javascript_include within single views
On Thu, Dec 11, 2008 at 6:40 PM, David wrote: > > Are you allowed to use the javascript_include_tag to include > javascript files for specific views? I have included the default > javascript files in the element of my site layout file, but > when I try and include a javascript file for a specific view within a > new element in that view it does not work. I guess my question > is: is it okay to create separate elements for specific views? > Will all the code get rendered that is within these new > elements and the elements in my layout file? or will there be > a conflict? Yes, you are allowed to use the javascript_include_tag to include javascript files for specific view templates. Can you post your code so that people can better assist you because I don't follow your question. -Conrad --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] javascript_include within single views
Are you allowed to use the javascript_include_tag to include javascript files for specific views? I have included the default javascript files in the element of my site layout file, but when I try and include a javascript file for a specific view within a new element in that view it does not work. I guess my question is: is it okay to create separate elements for specific views? Will all the code get rendered that is within these new elements and the elements in my layout file? or will there be a conflict? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: calling a partial from within a model / model's method?
Weeks later I finally got around to figuring out how to best tackle this and your suggestion was right on the money. I didn't want to let this lie without mentioning that the best bet started with that nugget from the pastie link. Thanks Nick :) - Joel On Mon, Nov 24, 2008 at 11:41 AM, Nick Hoffman wrote: > > On 2008-11-24, at 08:37, Joel Oliveira wrote: > > Hey Nick! > > > > First - thanks for the reply. > > > > Second - the reason why I'm trying to do this is to allow whatever > > type of widget model I'm creating to render its own particular > > partial, in the context of the "area" a user will place it - header, > > footer, sidebar, etc. I thought that calling a helper to weed out > > the objects for a particular "area" and then letting the model call > > its partial on its own, would be the easier way to do it, despite > > the normal MVC rules. I know it's against the rules - so I'm > > wondering if there's an easier way? > > > > Any input would be appreciated! :) > > > > Thanks! > > > > - Joel > > Hi Joel. Why not create a helper method that determines which partial > should be rendered? For example: > http://pastie.org/pastes/322615 > > -Nick > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Active Record - find - select option
I have an accounts table and a coaches table. The tables are as follows (with unimportant fields deleted): Accounts (id, name,...) Coaches (id, account_id, business_id, account_limit) Each account can either have one (or none) coach at any point in time. I have modeled these relationships in corresponding ActiveRecord classes as follows: class Account < ActiveRecord::Base has_one :coach end class Coach < ActiveRecord::Base belongs_to :account end I am trying to use will_paginate for paging through the list of coaches and look-up their names from the accounts table (and some more fields). To get to that, I am first trying to create a corresponding find query in ActiveRecord. Here is my query: Coach.find :all, :select => 'c.id, a.id, a.name', :joins => 'as c inner join accounts as a on a.id = c.account_id', :order => 'a.name' It is only returning the following in irb: [#] That is, it fails to return the account.id (or a.id) and account.name (or a.name) How do I resolve this? Thanks in advance for your help and time. 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: help needed regaring Acts As Taggable On Steroids
Mac Eros wrote: > Hello, > Edited part of BookController is: > > def create > @book = Book.new(params[:book]) > @book.tag_list # [] > @book.tag_list = "Funny, Silly" >respond_to do |format| > if @book.save > flash[:notice] = 'Book was successfully created.' > format.html { redirect_to(@book) } > format.xml { render :xml => @book, :status => :created, > :location => @book } > else > format.html { render :action => "new" } > format.xml { render :xml => @book.errors, :status => > :unprocessable_entity } > end > end > end > > def tag_cloud > @tags = Books.tag_counts > end > > In the new.html.erb I have added these lines : > <% tag_cloud @tags, %w(css1 css2 css3 css4) do |tag, css_class| %> > <%= link_to tag.name, { :action => :tag, :id => tag.name }, :class > => css_class %> > <% end %> > I have done almost the same but in create methos I have place the code @book = Book.new(params[:book]) @book.tag_with(params[:tag_list]) respond_to do |format| .. and in new.html.erb <%= text_field_tag 'tag_list', @book.tags.collect{|t| t.name}.join(" ") %> But when I run the application and try to create a new Entry if shows the error that "undefined method `tag_with' for # " Please help me. Thanks in advance. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: ActionMailer, unit testing and multipart mails
if you commented out this line (and any other line that squawks)... > @expected.parts << body_part # <=== ERROR HERE and printed out the mail's parts before asserting them... > mail = Notifier.create_notification() p mail.parts ...what would you see? We TDD e-mails all the time, but we don't write huge bulk assertions. Sometimes to test_first_, we cheat a little, write the correct code, print out what it does, and then write assertions which trap the important details. To test-first, when you need to change a mail, you clone that test, change the input, change the assertions to expect different output, fail the test, then pass it in the code. This shows how cheating, especially in high-bandwidth situations like GUIs, can lead to better TDD... -- Phlip --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Parameter validation and other security measures
We have a site that receives about 3 uniques per month. Lately, we have been hit with URLs that are hundreds of characters long with all sort of junk in the URL/parameters. I suspect this is an attempt at session hijacking or something similar. At a minimum, it fills up our log files and generates undesirable email alerts. I began reading up on Rails security here: http://guides.rails.info/security.html and also looking into stuff like http://www.hoptoadapp.com/welcome. My question here is: what is a good way to validate "params" in rails apps to handle SQL injections, etc.? I'm considering writing some common routines to validate the param type, min/max length, detect SQL keywords, etc. but didn't want to reinvent the wheel if there is already stuff out there (e.g. plugins). Thanks in advance. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: ActionMailer, unit testing and multipart mails
So... nobody is doing mails with attachments? Or anyone who is, isn't unit testing their code? TX --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: free ruby on rails hosting?
It actually does allow the same setup now thanks to Passenger. Dreamhost is proof of that. --Jeremy On Thu, Dec 11, 2008 at 4:01 PM, Bobnation wrote: > > The issue with Ruby on Rails is that it is not simple a language, it > really is a domain-specific language with its own requirements. Rails > is a framework and so it does not follow the same sorts of setups as > simply running PHP would. > > I still recommend looking for a cheap VPS and rolling your own from > there. I think you would be happier in the end. > > On Dec 11, 3:59 pm, Heinz Strunk > wrote: >> Greg Donald wrote: >> > On Thu, Dec 11, 2008 at 2:47 PM, Heinz Strunk >> > wrote: >> >> does anyone know any free ror webspace? I don't wanna have my computer >> >> running 24/7 for some small websites. >> >> >http://letmegooglethatforyou.com/?q=free+ror+webspace >> >> > -- >> > Greg Donald >> >http://destiney.com/ >> >> I of course tried google first but nothing found... >> >> Maybe that's the only option if there's no free ror webspace. >> -- >> Posted viahttp://www.ruby-forum.com/. > > > -- http://jeremymcanally.com/ http://entp.com/ http://omgbloglol.com My books: http://manning.com/mcanally/ http://humblelittlerubybook.com/ (FREE!) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Where do I start?
If I had to learn rails again I would learn ruby first then drift over into rails because I think that would give you a better understanding of how ruby works On 12/12/2008, at 5:55, olivierntk wrote: > > I started rails by reading Beginning Rails from Apress. > > It will take you through most of what you need to know to start Rails. > Being a .NET developer, it was quite easy to pick it up but I believe > it is accessible to non web developer. > > With Rails, you don't need to learn SQL (unless you have very specific > tasks to achieve). > JavaScript is nice to have (I would recommend you to use jQuery, a > JavaScript framework) but you can have a full web app running without > JavaScript. > Apache? No need, Rails comes with Mongrel. > > Ruby ... of course but you'll just need the basics and learn as you > go. > > My 2 cents > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: mysql.rb driver has been removed from Rails 2.2 ?
Thanks for the help - after a bit of onsite help I was able to complete the install. Still some quirks to be worked out but that's the point...to tinker. Thanks again Brian Hogan wrote: > You get around this by actually installing the MySQL gem with C > bindings. The one you guys are talking about is the pure Ruby one. > > The pure-MySQL library is terrible for performance and can cause some > seriously flaky stuff. There are a number of posts on tis list that > discuss the installation of that library. > > If you're getting the error relating to > > /usr/local/lib/ruby/gems/1.8/gems/mysql-2.7/lib/mysql.bundle > > then you have a half-installed mysql driver and I bet you're on a Mac. > > The solution that worked for me was to do this: > > http://www.napcsweb.com/blog/2007/06/01/mysql-gem-on-osx/ > > I hope that helps! > > On Wed, Dec 10, 2008 at 7:27 PM, Shawn Cheatham -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Virtual hosts not using their own databases
Redd Vinylene wrote: > Hi there! > > I just set up 3 instances of the same Rails app (nginx+mongrel_cluster) > -- http://pastie.org/336677 -- but for some reason site1 and site2 > (despite their own database.yml) end up using site3's database. > > What on earth is going on here? > > Thanks y'all, > RV > When you say "their own database.yml" do you mean that you have differently named databases in each database.yml? Stupid question but stuff happens. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Get an attrifutes from joins in a find method
Luca Roma wrote: > I have wrote an example: > > example=Example.find(:all,:joins=>"(select id,"hello" as hello_name from > examples2) as examples3 where examples3.id=examples.id") > > I want get the attribute hello_name that not exits in db. > example[0].hello_word not works > example[0].example3.hello_name not works Try example[0][:hello_word] -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: how do I get the host or Ip address where my rails app is running
Erwin wrote: > I would like to get in a variable the ip address of the host where my > app is running, to change some parameters if it's running locally or > remotely .. is it possible ? You can try require 'socket' REAL_PRODUCTION = Socket.gethostname == 'mysite.com' or hostinfo = Socket.gethostbyname(Socket.gethostname) hostnames = hostinfo[1] << hostinfo[0] REAL_PRODUCTION = hostnames.include?('mysite.com') -- Rails Wheels - Find Plugins, List & Sell Plugins - http://railswheels.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Virtual hosts not using their own databases
Norm wrote: > Does each virtual host have its own instance of the database server > running? No actually I'm only running one MySQL 5.1 server instance. The OS is FreeBSD. 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Pagination on arrays
> I think there's an example in the dogs > > Sent from my iPhone > LOVE that iPhone spell checker -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Ruby Arrays - Passing arrays from a function possible?
Ryan Bigg wrote: > Or I think you can do *args for the receivIng method and then call it > like method(product_attributes) and that will pass the array to the > method Thanks Ryan. Can you explain more about how *args would work? I'm googling for more info, but can't seem to find a good tutorial on it. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: free ruby on rails hosting?
The issue with Ruby on Rails is that it is not simple a language, it really is a domain-specific language with its own requirements. Rails is a framework and so it does not follow the same sorts of setups as simply running PHP would. I still recommend looking for a cheap VPS and rolling your own from there. I think you would be happier in the end. On Dec 11, 3:59 pm, Heinz Strunk wrote: > Greg Donald wrote: > > On Thu, Dec 11, 2008 at 2:47 PM, Heinz Strunk > > wrote: > >> does anyone know any free ror webspace? I don't wanna have my computer > >> running 24/7 for some small websites. > > >http://letmegooglethatforyou.com/?q=free+ror+webspace > > > -- > > Greg Donald > >http://destiney.com/ > > I of course tried google first but nothing found... > > Maybe that's the only option if there's no free ror webspace. > -- > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: free ruby on rails hosting?
Greg Donald wrote: > On Thu, Dec 11, 2008 at 2:47 PM, Heinz Strunk > wrote: >> does anyone know any free ror webspace? I don't wanna have my computer >> running 24/7 for some small websites. > > http://letmegooglethatforyou.com/?q=free+ror+webspace > > > > -- > Greg Donald > http://destiney.com/ I of course tried google first but nothing found... Maybe that's the only option if there's no free ror webspace. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] When it's appropriate to use fixtures
I know it's, like, SO uncool to use fixtures. However, I find that there are cases where the correctness of your code relies on correct functioning of your finders. Since finders translate to SQL, and you can’t test SQL without a database backend, I find that a totally fixture-less approach leads to some ugly hacking and empty tests, especially when shooting for full coverage. As an example, I have the following code in a work application: def self.for(link) Score.find(:all,:conditions => {:user_id => link.user.id}, :order => 'ABS(score) desc') end Without fixtures the only thing I can do there is stub out “find” on Score to return an array of mock Score objects, then check that the value I get back is the value I told it to return. Sure, the line is marked as covered, but it didn’t actually test a damn thing. Aside from manually testing the calling code through the web interface, I just have to take it on faith that the finder is correctly written. With a small set of fixtures for the Score model, on the other hand, I can easily create a mock for “link”, pass it in, and check that the fixtures I get back really are the ones I expect, in the order I expect. In this way, I can write a meaningful test that ensures that the parameters I send to “find” actually work. There is literally no way to do this without a database backend for your tests. Actually, I take that back. There is one way, and that’s to rewrite the code like this: Score.find(:all).select{|sc| sc.user_id == link.user.id}.sort{|a,b| b.score.abs <=> a.score.abs} Now, I can test the code without fixtures. And in so doing, I’ve also bloated my result set and offloaded trivial database work into Ruby code, thereby pissing off my DBA, increasing the overall load on the database, and slowing down my Ruby code. Is that type of deoptimization really worth it, just so I don't have to write a fixture? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Where do I start?
Ryan gave a really good resource, and it will only get better. After that, start building and keep reading. Read blog posts, read source from other projects, read tons of books, and then when you think you can't read anymore ... read a novel and then read another book. Right now I recommend a few books: Agile Web Development 3 (Beta PDF right now) from PragProg.com Simply Rails 2 (great introduction, if a little shallow at times) Learning Rails (a little deeper and covers different skills at different times) The Art of Rails (a philosophical book more than how-to) Then, keep on reading other books, get yourself some Ruby books and learn Ruby, learn ... read, rinse, and read again. All the time, keep building different things. Test all of the time. Your original sites are going to suck, and you'll look back and get discouraged, but keeping building and keep going. On Dec 10, 2:27 pm, Painting With Purpose wrote: > I want to become a Rails web developer. I am not a programmer by any > means. I have built one static website and am familiar with HTML and > CSS. I know I'll need to learn Rails, and perhaps a list of other > things like SQL, JavaScript, Apache, Ruby etc. but I have no idea > where to start. > > Could you please offer any advice on what I need to learn and most > importantly what order I should learn them. > > Thank you, > > Chris --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: free ruby on rails hosting?
Do yourself a huge favor and just pay for hosting. You'll be FAR happier in the end. I still recommend maybe picking up a cheap slice from Slicehost and having some fun setting up stuff. On Dec 11, 2:47 pm, Heinz Strunk wrote: > Hey, > > does anyone know any free ror webspace? I don't wanna have my computer > running 24/7 for some small websites. > -- > Posted viahttp://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: database.yml and .gitignore
Jeff Cohen wrote: > > If it got added to your git repo before you specified it in the ignore > file, I think you have to remove it: > > git rm config/database.yml > git commit -a -m "Removed database.yml" > > (maybe save a backup of your database.yml first :-) > > Jeff Safer I think to: # git status # git rm config/database.yml --cache --cache should leave the actual file alone and just remove it from tracking> Backups are always a good thing though. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: condition metadata / dyanmic conditions
You could try ambition -> http://ambition.rubyforge.org/ - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) On Thu, Dec 11, 2008 at 6:00 PM, Grayson Piercee wrote: > > Hello, > > Is there a plugin / gem out there that would help me construct a dynamic > set of conditions for a finder? > > In other words, I have a user with multiple attributes (some 50+). I > have other users that want to express preferences for befriending users > based on criteria (which I'd like to store) such as specific interests, > personality types, etc. (both values, ranges) > > The scenario I'm confused about is how do you construct the finder for > something like this > > User.find(:all, :conditions => ["not sure what goes here because it'll > be different for each user", > current_user.preferences.attributes.collect(&:id)]) > > you get the idea ... > > 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] condition metadata / dyanmic conditions
Hello, Is there a plugin / gem out there that would help me construct a dynamic set of conditions for a finder? In other words, I have a user with multiple attributes (some 50+). I have other users that want to express preferences for befriending users based on criteria (which I'd like to store) such as specific interests, personality types, etc. (both values, ranges) The scenario I'm confused about is how do you construct the finder for something like this User.find(:all, :conditions => ["not sure what goes here because it'll be different for each user", current_user.preferences.attributes.collect(&:id)]) you get the idea ... 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: free ruby on rails hosting?
On Thu, Dec 11, 2008 at 2:47 PM, Heinz Strunk wrote: > does anyone know any free ror webspace? I don't wanna have my computer > running 24/7 for some small websites. http://letmegooglethatforyou.com/?q=free+ror+webspace -- Greg Donald http://destiney.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] free ruby on rails hosting?
Hey, does anyone know any free ror webspace? I don't wanna have my computer running 24/7 for some small websites. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: database.yml and .gitignore
Oh! In fact I don't actually do any of that manually, but instead I use a simple Ruby script that I wrote (before discovering there are probably better ways to this, and now Rails Edge has a really cool new template system for doing this sort of thing). If interested you can find the script here... http://github.com/robertwalker/git-a-rails-project/tree See the README for usage and options. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: ssl_required and form_tag [SOLVED but not understood]
On Thu, Dec 11, 2008 at 5:12 PM, Fritz Anderson wrote: > My problem is no longer acute, but I don't quite understand why the > solution works. Is it that the form isn't presented as https, so the > form action isn't https? And the form data gets lost in the ssl_required > redirection? You answered it for youself, if the form isn't shown in a SSL context, it will not post to a SSL page unless you make the form action point to a SSL page. And post data is lost when you are redirected. - Maurício Linhares http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en) --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: ssl_required and form_tag [SOLVED but not understood]
Fritz Anderson wrote: ... > The form includes a select_tag to collect a parameter tagged as > :building_id. > > If :assign_building is listed in ssl_required, params does not include > the :building_id key. If it's not in ssl_required, :building_id is in > params. > > I should mention that I have defined default_url_options to set > :protocol => "https://";. > > How do I ensure that my form will be submitted via SSL, and keep all its > parameters? I'm pretty sure I'm missing a concept here, but of course > I'm too ignorant to know what that concept might be. I added the action that presents the form to ssl_required. Form inputs then once again appeared in the params hash. My problem is no longer acute, but I don't quite understand why the solution works. Is it that the form isn't presented as https, so the form action isn't https? And the form data gets lost in the ssl_required redirection? I'd really appreciate it if someone could relieve my conceptual block here. -- F -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: database.yml and .gitignore
> If it got added to your git repo before you specified it in the ignore > file, I think you have to remove it: > > git rm config/database.yml > git commit -a -m "Removed database.yml" > > (maybe save a backup of your database.yml first :-) > > Jeff What I do is rename database.yml to example_database.yml before the initial commit to git (and have config/database.yml in .gitignore. Then after the initial commit I copy example_database.yml back to database.yml, which will not be ignored. Git will only ignore untracked files that are in .gitignore. If you are tracking changes to a file the .gitignore has no effect. The reason I keep example_database.yml in Git is so that when the repository is cloned all I have to do is copy example_database.yml to database.yml and I'm ready to go in the clone. Note: this way each developer can keep their database password in their own untracked copy of database.yml if a password is required. But, they won't have to recreate database.yml from scratch. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Restful_rails with subdomains
I'm running multiple subdomains from one Rails application. I would like to extend restful_rails so that permissions are assigned by site; e.g. a user with administrative permission in one subdomain might have a different permission or no permission on another subdomain. It seems like I should alter "has_many :users, :through => :permissions" to also cross-check against the current site. I have tried using :finder_sql to do this, but it does not appear to be affecting the actual query. Alternatively, I could rewrite "user.has_role?" and/or "user.find_by_rolename" to include the check. But I am not having luck with either approach. I welcome any suggestions. Thanks. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Where do I start?
I started rails by reading Beginning Rails from Apress. It will take you through most of what you need to know to start Rails. Being a .NET developer, it was quite easy to pick it up but I believe it is accessible to non web developer. With Rails, you don't need to learn SQL (unless you have very specific tasks to achieve). JavaScript is nice to have (I would recommend you to use jQuery, a JavaScript framework) but you can have a full web app running without JavaScript. Apache? No need, Rails comes with Mongrel. Ruby ... of course but you'll just need the basics and learn as you go. My 2 cents --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Virtual hosts not using their own databases
Redd Vinylene wrote: > Hi there! > > I just set up 3 instances of the same Rails app (nginx+mongrel_cluster) > -- http://pastie.org/336677 -- but for some reason site1 and site2 > (despite their own database.yml) end up using site3's database. > > What on earth is going on here? > > Thanks y'all, > RV > Does each virtual host have its own instance of the database server running? --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: How to stop SOAP4R/OpenSSL requiring cert?
On Dec 11, 2008, at 11:40 AM, Michael Mcgrath wrote: > Rob, > thanks for your response. > >> SOAP::WSDLDriverFactory.new("https://server.com/xxx.wsdl";, >> { 'ssl_config' => { 'verify_mode' => OpenSSL::SSL::VERIFY_NONE }}) > This gives "wrong number of arguments (2 for 1)" > > Michael This might have to go closer to the place where the connection is made. I'd just be diving into the soap4r code anyway, so splash on in yourself. There is also a place (somewhere) that lets you put a similar line into a config file for your SSL connections. I think rdoc for the SOAP4R library has an example. -Rob Rob Biedenharn http://agileconsultingllc.com r...@agileconsultingllc.com --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Routes in a migration?
So this is a strange request, but I'm writing a large migration inserting a lot of content into my db. Some of the entries have a link to another section of the site in the text column. I'd like to use the routes that I have set up, but they aren't available. Any ideas how to make the routes available in the migration? -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: database.yml and .gitignore
On Dec 11, 11:29 am, jgoggles wrote: > Hi, > > For some reason git is not ignoring my database.yml file even though I > have config/database.yml in my .gitignore file. Any suggestions as to > what the problem might be and/or how I can fix it? It's causing major > annoyances. Is there a way to remove the database.yml from the repo > entirely? > > Thanks! If it got added to your git repo before you specified it in the ignore file, I think you have to remove it: git rm config/database.yml git commit -a -m "Removed database.yml" (maybe save a backup of your database.yml first :-) Jeff --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] ssl_required and form_tag
I don't quite understand how ssl_required interacts with forms in Ruby on Rails. I've installed the ssl_requirement plugin, and listed one of my form-submission actions (:assign_building) in an ssl_required declaration. The form is shown at the end of this message. The form includes a select_tag to collect a parameter tagged as :building_id. If :assign_building is listed in ssl_required, params does not include the :building_id key. If it's not in ssl_required, :building_id is in params. I should mention that I have defined default_url_options to set :protocol => "https://";. How do I ensure that my form will be submitted via SSL, and keep all its parameters? I'm pretty sure I'm missing a concept here, but of course I'm too ignorant to know what that concept might be. ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0] Rails 1.2.6 -- F === <% form_tag :controller => :people, :action => :assign_building, :id => @person do %> <% buildings = Building.find(:all, :order => 'facility_location, building').collect { |b| [ b.building, b.id ] } -%> <% bldg_opts = options_for_select(buildings, @person.building_id) -%> <%= select_tag :building_id, bldg_opts %> <%= submit_tag "Set" %> <% end -%> === Partial log when ssl_required is in effect: Processing PeopleController#assign_building (for at 2008-12-11 13:11:50) [GET] Session ID: 31c980c882ed498eaed93fcb08916d63 Parameters: {"action"=>"assign_building", "id"=>"5", "controller"=>"people"} -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: different views for a single model?
On Dec 11, 10:31 am, Bill Vatikiotis wrote: > How could you do it, in a *RESTful* way? > > I have a very simple model with 2 attrs and each view is a > Model.find_all_by_attr1 and _attr2. How is this modeled in REST? Usually I do this by specifying the view/filtering criteria as query parameters: myapp.com/models?attr1=val1&attr2=val2 This calls the index action, and with params[:attr1] = val1 and params [:attr2] = val2 > I've been in rails for 6 months now and REST is continuing giving me > headaches and tbh, it seems to me that it's unsuitable for user > centric applications, where the same information could be presented in > many different ways. index and show simply wouldn't cut it as it seems > to me that they are tightly coupled to a more DB-centric approach. > > (Where is index fit into REST, if REST is based on CRUD? Can't I have > an "index2 or index_by_whatever_criteria_I_want, and still be > RESTful? ) Index and Show are both from the R of CRUD. > Of course, decision logic could be moved to the view layer but that > seems like a regression to MVC. > > Im tempted to stop thinking in REST terms and simply move on; Maybe I > just need a good reason to convince myself. > > thank you Does this help at all? The Rails conventions don't work 100% of the time, but for me it works 95% of the time - I just have to think a bit sometimes about what my action is accomplishing, and challenge myself on why one on the 7 actions *wouldn't* suffice. 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Second Ruby and Rails devroom at Fosdem (Brussels, 7 Feb 2009)
Hi folks, After last year's success, the Belgian Ruby User Group is happy to announce the second Ruby and Rails devroom at Fosdem 2009. Fosdem is a gathering of Free and Open Source Software developers and the ideal occasion to meet fellow Ruby and Rails developers (and 2,000 other FOSS developers). If you have a good idea for a talk or tutorial, consider sending in an abstract. You can find the Call for Papers at http://wiki.rubyist.be/wiki/show/CallForPapers, and quoted below. See you at Fosdem! Kind regards, Peter Vanbroekhoven --- Second Ruby and Rails devroom at Fosdem (Brussels, 7 Feb 2009) After last year's enormous interest, The Belgian Ruby User Group http://www.rubyist.be/ organizes the second Ruby and Rails devroom at Fosdem 2009 (Brussels, 7 February 2009). We are calling on presenters to propose an abstract for a presentation in the Ruby and Rails devroom. Topics include, but are not limited to: * Ruby - Tutorials (installation, basic Ruby, advanced Ruby, metaprogramming, DSLs, testing, design patterns, Rubygems, C-extensions, GUI programming, multi-processing/multi-threading…) - New developments (Ruby 1.9, JRuby, IronRuby, ...) - Important/interesting libraries (your own, other's, HOWTOs, demos, ...) - Technical showcases (interesting applications of Ruby, challenges, solutions, ...) - ... * Rails - Tutorials (installation, basic/advanced web app design, good practices, ...) - New developments (Rails 2.1/2.2, Phusion Passenger, RubyEE, NeverBlock, cloud computing, ...) - Important/interesting plugins (your own, other's, HOWTOs, demos, ...) - Technical showcases (interesting applications of Rails, challenges, solutions, ...) - ... You can view last year's program at http://wiki.rubyist.be/wiki/show/FosdemDevroom2008AceptedPapers to get an idea. We accept 25 minute and 50 minute talks and tutorials, but we are not strict on this so please indicate the preferred length of your talk/tutorial in your proposal. We may still slightly adjust this length depending on the response we receive. We would like to ask you to include a short bio when you submit your proposal. This bio will appear on the Fosdem website and should consist of a single sentence description and an extended description; examples can be found in last year's program: http://archive.fosdem.org/2008/schedule/events . Please send your abstract to cfp_fos...@rubyist.be before Monday 5 January 2009. It will be reviewed by the program committee and you will receive a decision by Friday 9 January 2009 if your presentation is accepted. The program committee that will evaluate the proposals is comprised of: Tom Klaasen (10to1, tom AT 10to1 . be) Peter Vanbroekhoven (XaoP, peter AT xaop . com) Peter Vandenabeele (peter AT vandenabeele . com) Entrance to the Fosdem conference and devrooms is entirely free. Sorry, we cannot give any travel grants to foreign visitors (local hospitality with one of the organizers is possible to save hotel costs). In past years, approx. 2,000 people visited the Fosdem conference. More information on Fosdem can be found at http://www.fosdem.org/ . For all further information, check this page: http://wiki.rubyist.be/wiki/show/FosdemDevRoom2009 . --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] very easy, look
If in Debian-Based type: apt-get install libsqlite3-dev and so: gem install sqlite3-ruby you see this message: Building native extensions. This could take a while... Successfully installed sqlite3-ruby-1.2.4 1 gem installed Installing ri documentation for sqlite3-ruby-1.2.4... Installing RDoc documentation for sqlite3-ruby-1.2.4... $_ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] update parent in assocation callback
I'd like to update an attribute on the parent using an association callback. For example class User < ActiveRecord::Base has_many :peeps, :after_add => :update_latest_peep protected def update_latest_peep(peep) self.latest_peed_id= peep.id end end If I debug and step through the code, I see that @owner (which is the user in question) actually does have that attribute set however when the code exists, it doesn't seem to save. Thanks. -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] How to select a style based on the controller?
I know I've seen this somewhere before, but my friend Google and I just can't seem to recall where. I would like to change the style of a link (in my application layout) based upon which controller is currently active. This is what I have, which doesn't work: <%= link_to "Part", part_path, :class => @controller.name == "parts" ? 'selectedmenu' : 'unselectedmenu' %> I'm sure I've seen this sort of construct in the past, but I can't recall how to construct it. Specifically, this bombs because name is undefined. I can probably figure that one out myself. More generally, is there a nice helper method defined to select a specific class based on the controller? --wpd --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Fleximage and RMagick on Dreamhost
Hi, I installed Fleximage with RMagick on InstantRails and had it working on my development box. When I moved to the production box on Dreamhost, I started to get the following error when I tried to render images: === Processing PhotosController#show to jpg (for 86.145.229.162 at 2008-12-11 08:49:18) [GET] Parameters: {"id"=>"1"} Rendering photos/show ActionView::TemplateError (wrong number of arguments (2 for 1)) on line #1 of app/views/photos/show.jpg.flexi: 1: @photo.operate do |image| 2: image.resize '240x160' 3: end app/views/photos/show.jpg.flexi:1:in `render' app/views/photos/show.jpg.flexi:1:in `_run_flexi_app47views47photos47show46jpg46flexi' Rendering rescues/layout.erb (internal_server_error) === The line #1 does not refer to something in my show.jpg.flexi file, as I get the same error when all lines are commented out. Does anyone know what this error message means ? Here is my config: * class ApplicationController < ActionController::Base require "rubygems" require 'RMagick' * class PhotosController < ApplicationController require 'RMagick' include Magick * class ApplicationController < ActionController::Base require 'RMagick' include Magick * class Photo < ActiveRecord::Base require 'RMagick' include Magick * show.jpg.flexi @photo.operate do |image| image.resize '240x160' end * show.html.erb <%= image_tag formatted_photo_path(@photo, :jpg) %> Thanks, SBM --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: access ActionView::Base in configuration
Because the code you're writing is running before the framework has been loaded. Stick it in an initializer Sent from my iPhone On 11 Dec 2008, at 18:09, Erwin wrote: > > Why is it impossible to access ActionView::Base in my environment.rb ? > getting uninitialized constant error > > thanks fyl > > erwin > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: uninitialized constant ActionVie
Frederick Cheung wrote: > On 11 Dec 2008, at 15:47, Kad Kerforn wrote: >> active_support/testing/setup_and_teardown.rb:14:in >> `included':NameError: uninitialized constant ActiveSupport::Callbacks >> >> /usr/local/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/ >> console_with_helpers.rb:19:NoMethodError: >> undefined method `require_dependency' for main:Object >> >> >> what could be the error ? thanks for your help ... >> > ActionView hasn't been loaded yet. Move all of that into a file in > config/initializers > > Fred Thanks a lot. is there any link to a doc where i can read more about the initialization process... ? (like the one I have on boot process of my OS X system...) -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] calendar_date_select on Dreamhost
Hi, I have installed the calendar_date_select gem on Dreamhost using the instructions on http://code.google.com/p/calendardateselect/. The gem is properly installed and I can find it in my ~/.gems directory. However, the server does not recognize any calendar_date_select method. In particular, the calendar_date_select_includes gives this error: <%= calendar_date_select_includes "blue" %> undefined method `calendar_date_select_includes' for # I restarted the server many times and have already reinstalled the gem several times. Would you know what may be causing this problem ? I added a "require 'calendar_date_select'" in my applicationcontroller with no effect. Thanks, SBM Here is my configuration running on Dreamhost: *** LOCAL GEMS *** actionmailer (2.2.2, 2.1.1, 2.1.0, 2.0.2, 1.1.3) actionpack (2.2.2, 2.1.1, 2.1.0, 2.0.2, 1.11.2, 1.11.0) actionwebservice (1.2.6, 1.2.3, 0.9.3) activerecord (2.2.2, 2.1.1, 2.1.0, 2.0.2, 1.13.2, 1.13.0) activeresource (2.2.2, 2.1.1, 2.1.0, 2.0.2) activesupport (2.2.2, 2.1.1, 2.1.0, 2.0.2, 1.2.3) acts_as_taggable (2.0.2, 1.0.4) ajax_scaffold_generator (3.1.11, 2.2.1) archive-tar-minitar (0.5.2, 0.5.1) auth_generator (2.0.1, 1.5.3, 1.1.0) Bloglines4R (0.1.0) BlueCloth (1.0.0) builder (2.1.2, 2.0.0, 1.2.4) calendar_date_select (1.13) camping (1.5) capistrano (2.5.3, 2.5.1, 1.4.1, 1.4.0) classifier (1.3.1) cmdparse (2.0.2, 2.0.0) color (1.4.0) columnize (0.2) curb (0.1.4) daemons (1.0.10, 1.0.9, 1.0.7, 1.0.6) diff-lcs (1.1.2) facets (2005.10.30, 2.4.3, 1.8.54, 1.8.51, 1.8.49, 1.0.3) fastercsv (1.2.3) fastthread (1.0.1) feedtools (0.2.29, 0.2.26) ferret (0.11.6, 0.11.4, 0.10.13, 0.10.11) flickr (1.0.2) gd2 (1.1.1, 1.1, 1.0) gen (0.41.0, 0.29.0) geoip (0.8.0, 0.3.0, 0.2.0) gettext (1.93.0, 1.10.0, 1.8.0, 1.3.0) glue (0.41.0, 0.29.0) gnuplot (2.2, 2.1) google-geocode (1.2.1) gravtastic (2.0.0) gruff (0.3.4, 0.2.8) haml (2.0.5, 2.0.3) highline (1.5.0) hoe (1.8.2, 1.2.1, 1.1.7) hpricot (0.6.164, 0.6) htmltools (1.10, 1.09) launchy (0.3.2) linecache (0.43) localization_generator (1.0.8, 1.0.7) login_generator (1.2.2) madeleine (0.7.3, 0.7.1) mailfactory (1.4.0) maruku (0.5.9) mechanize (0.8.5, 0.7.6) mime-types (1.15) mini_magick (1.2.3) mocha (0.9.3) mysql (2.7, 2.6) needle (1.3.0, 1.2.1) net-scp (1.0.1) net-sftp (2.0.1, 1.1.0) net-ssh (2.0.6, 1.1.2, 1.0.10, 1.0.8) net-ssh-gateway (1.0.0) nitro (0.41.0, 0.29.0) og (0.41.0, 0.29.0) packet (0.1.14, 0.1.13) PageTemplate (2.2.3, 2.2.0, 2.1.3) ParseTree (3.0.2, 1.7.1, 1.6.3, 1.3.7) payment (1.0.1, 0.9) pdf-writer (1.1.8) podcast (0.0.4, 0.0.3) rack (0.4.0, 0.3.0) radiant (0.6.9) rails (2.2.2, 2.1.1, 2.1.0, 2.0.2, 0.14.3) rake (0.8.3, 0.8.2, 0.8.1, 0.6.2) ramaze (2008.06) rc-rest (2.2.1) RedCloth (4.1.1, 3.0.4, 3.0.3) rfacebook (0.9.8, 0.8.3) rmagick (2.7.1, 1.15.12, 1.15.10) rspec (1.1.11, 1.1.3) ruby-breakpoint (0.5.1, 0.5.0) ruby-debug (0.10.3, 0.9.3, 0.9.2) ruby-debug-base (0.10.3) ruby-openid (2.1.2, 2.0.3) ruby-yadis (0.3.4) ruby_odeum (0.4.1) rubyforge (1.0.1, 0.4.2, 0.4.0) RubyInline (3.8.1, 3.6.3, 3.6.2, 3.4.0) rubypants (0.2.0) rubyzip (0.9.1, 0.5.12, 0.5.9) ruport (1.6.1, 1.4.0) ruport-util (0.14.0, 0.13.0) ruwiki (0.9.3) salted_login_generator (2.0.2, 1.1.1, 1.1.0) sexp_processor (3.0.0) shipping (1.5.1, 1.3.0, 1.2.1) SimpleSearch (0.5.0) sqlite3-ruby (1.2.4, 1.2.1, 1.1.0) stemmer (1.0.1) switchtower (1.0.1) syntax (1.0.0, 0.7.0) tagtools (0.0.3) tidy (1.1.2) transaction-simple (1.4.0) tzinfo (0.3.12, 0.3.3) unicode (0.1) uuidtools (1.0.7, 1.0.1, 1.0.0, 0.1.4) webgen (0.5.6, 0.4.5, 0.3.8, 0.3.6) wee (0.10.0, 0.9.1) xhtmldiff (1.0.0) xml-simple (1.0.11) ym4r (0.6.1) youtube-g (0.4.9.9) ZenTest (3.11.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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: different views for a single model?
map.resources can take additional specifications for either member-level methods (operating on a single instance of the model), or collection-level methods (operating on a collection). You can extend your routes in a RESTful fashion to your hearts content. http://api.rubyonrails.org/classes/ActionController/Resources.html -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] access ActionView::Base in configuration
Why is it impossible to access ActionView::Base in my environment.rb ? getting uninitialized constant error thanks fyl erwin --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: Pagination on arrays
will_paginate does work on arrays. You need to create an instance of WillPaginate::Collection targetting your array. I think there's an example in the dogs Sent from my iPhone On 11 Dec 2008, at 17:25, Mark Mr wrote: > > I'm looking for a way to paginate an array of data basically. I know > about will_paginate but from what I've seen that only works on > activerecord searches. I can't seem to find a good resource that lets > you paginate a regular data set. Anyone got a tip on this? I'd really > 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 rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Get an attrifutes from joins in a find method
I have wrote an example: example=Example.find(:all,:joins=>"(select id,"hello" as hello_name from examples2) as examples3 where examples3.id=examples.id") I want get the attribute hello_name that not exits in db. example[0].hello_word not works example[0].example3.hello_name not works how can i do? thanks -- Posted via http://www.ruby-forum.com/. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] database.yml and .gitignore
Hi, For some reason git is not ignoring my database.yml file even though I have config/database.yml in my .gitignore file. Any suggestions as to what the problem might be and/or how I can fix it? It's causing major annoyances. Is there a way to remove the database.yml from the repo entirely? 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] Pagination on arrays
I'm looking for a way to paginate an array of data basically. I know about will_paginate but from what I've seen that only works on activerecord searches. I can't seem to find a good resource that lets you paginate a regular data set. Anyone got a tip on this? I'd really 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] restful_authentication errors
When I run [code] script/generate authenticated user --include-activation [/ code] it seems to work at first, but then it reports: " The name 'SessionsHelper' is either already used in your application or reserved by Ruby on Rails. Please choose an alternative and run this generator again " I've heard that having both acts_as_authenticated and restful_authentication installed at the same time can cause this error, but that's not the case with my app. I just started a new app and installed only the restful_authentication plugin. Any suggestions? --~--~-~--~~~---~--~~ You received 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] Full time, direct hire Ruby/Rails position in Upstate SC
PCSS, Inc (www.pcssinc.com) is looking to hire at least one new Ruby/ Rails developer. PCSS serves the judicial system, offering jury and case management solutions to help Courts move towards a paperless environment and comply with their initiatives to make court records more easily accessible. We are looking for someone with demonstrable OOP skills, at least a year of experience with Ruby, rspec, and comfort with JavaScript (knowing the ExtJs framework is a big plus). We are located in the Upstate region of South Carolina, midway between Charlotte and Atlanta. Please reply with a resume and code sample in an introductory email to [EMAIL PROTECTED] Thanks, AndyV --~--~-~--~~~---~--~~ You received 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 do I get the host or Ip address where my rails app is running
Hi I would like to get in a variable the ip address of the host where my app is running, to change some parameters if it's running locally or remotely .. is it possible ? I cannot use request.host, since there is no request yet I suppose I should test it in application.rb, not in environment.rb during initialization .. thanks for your suggestions .. erwin --~--~-~--~~~---~--~~ You received 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 stop SOAP4R/OpenSSL requiring cert?
Rob, thanks for your response. > SOAP::WSDLDriverFactory.new("https://server.com/xxx.wsdl";, >{ 'ssl_config' => { 'verify_mode' => OpenSSL::SSL::VERIFY_NONE }}) This gives "wrong number of arguments (2 for 1)" Michael -- 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: Odd problem with rake test
On Dec 10, 2008, at 4:23 PM, John Small wrote: > I've got a strange problem with raking my tests. They come up all > clear > when I do rake:functionals but when I run them as individual ruby > files > the test fail as they should. What's the difference? Does anyone else > have problems like this. > > John Small My guess is that you are using fixtures and each test that fails isn't specifying the ones on which it relies. -Rob Rob Biedenharn http://agileconsultingllc.com [EMAIL PROTECTED] +1 513-295-4739 Skype: rob.biedenharn --~--~-~--~~~---~--~~ You received 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] Time zone oddity with Rails 2.2.2 and Ruby 1.8.6 (win32)
The rfc822 method and to_s(:rfc822) are behaving differently. See below: C:\projects>rails -v Rails 2.2.2 C:\projects>ruby -v ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32] C:\projects>rails odd create create app/controllers create app/helpers ... C:\projects>cd odd C:\projects\odd>ruby script/console Loading development environment (Rails 2.2.2) >> Time.now => Thu Dec 11 11:24:58 -0500 2008 >> Time.now.to_s => "Thu Dec 11 11:25:00 -0500 2008" >> Time.now.rfc822 => "Thu, 11 Dec 2008 11:25:05 -0500" >> Time.now.rfc2822 => "Thu, 11 Dec 2008 11:25:07 -0500" BUT: >> Time.now.to_s(:rfc822) => "Thu, 11 Dec 2008 11:25:12 Eastern Standard Time" I'm running gem Rails 2.2.2 here. The problem does not occur on Linux with the same Rails revision and a comparable (1.8.6, 2007-03-13) build of Ruby. Any thoughts? Thanks, Sven --~--~-~--~~~---~--~~ You received 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 stop SOAP4R/OpenSSL requiring cert?
On Dec 10, 2008, at 11:44 AM, Michael Mcgrath wrote: > > Hi > I want to consume some web services that are only available over > HTTPS. > > My method looks like this: > def lookup_id >myid=params[:id] >driver = > SOAP::WSDLDriverFactory.new("https://server.com/xxx.wsdl"; Try this: SOAP::WSDLDriverFactory.new("https://server.com/xxx.wsdl";, { 'ssl_config' => { 'verify_mode' => OpenSSL::SSL::VERIFY_NONE }}) Rob Biedenharn http://agileconsultingllc.com [EMAIL PROTECTED] > ).create_rpc_driver >@p=driver.verifyId(AUTH_TOKEN, PIN, myid) > end > > Although this works fine on my local box (with a warning), when > deployed > to the staging server I get: > OpenSSL::SSL::SSLError (certificate verify failed): > > Can anyone assist me in telling SOAP4R and/or OpenSSL to simply treat > this is a warning rather than an error? > > Thanks in advance, > Michael. > -- > 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] different views for a single model?
How could you do it, in a *RESTful* way? I have a very simple model with 2 attrs and each view is a Model.find_all_by_attr1 and _attr2. How is this modeled in REST? I've been in rails for 6 months now and REST is continuing giving me headaches and tbh, it seems to me that it's unsuitable for user centric applications, where the same information could be presented in many different ways. index and show simply wouldn't cut it as it seems to me that they are tightly coupled to a more DB-centric approach. (Where is index fit into REST, if REST is based on CRUD? Can't I have an "index2 or index_by_whatever_criteria_I_want, and still be RESTful? ) Of course, decision logic could be moved to the view layer but that seems like a regression to MVC. Im tempted to stop thinking in REST terms and simply move on; Maybe I just need a good reason to convince myself. thank you --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~--~~~~--~~--~--~---
[Rails] Re: find_or_create_by_name
On 11 Dec 2008, at 16:17, Gi Ga wrote: > > If I have a table: (id, lastname, firstname), can I use > "find_or_create_by_name" if I have to search by first and last name? no. find_or_create_by_foo requires foo to be an actual column (but you can do find_or_create_by_foo_and_bar) Fred > > -- > 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] find_or_create_by_name
If I have a table: (id, lastname, firstname), can I use "find_or_create_by_name" if I have to search by first and last name? -- 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: Select count(*) using Ruby on Rails
Frederick Cheung wrote: > On 11 Dec 2008, at 16:05, Joe Peck wrote: > >> something like Blah.find(:all, :conditions => blah blah).size >> > Blah.count(:all, :conditions => ...) > > or if you had a named_scope for that set of conditions, > Blah.some_scope.count > > Fred Beautiful. Thanks Fred, you seem to answer a lot of questions on this board. -- 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 -~--~~~~--~~--~--~---