[Rails] Re: valdate_presnce_of email, :if => :validate_id + Factory

2009-06-01 Thread Sijo Kg

Mukund wrote:
> Move that to a module and include it as a mixin in your model?
   Did not understand this.Could you please  elaborate?
Sijo

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: valdate_presnce_of email, :if => :validate_id + Factory girl

2009-06-01 Thread Mukund

N/M. Realized that you were talking about the factory-girl gem.

On Jun 2, 11:36 am, Mukund  wrote:
> Move that to a module and include it as a mixin in your model?
>
> On Jun 2, 10:00 am, Sijo Kg  wrote:
>
> > Hi
> >     In the model I have User
> > attr_accessor :validate_email_id
> > validates_presence_of :email ,:if => :validate_email_id
> >   Could anybody please tell me how can I define a Factory for the above?
>
> > Thanks in advance
> > Sijo
> > --
> > 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: valdate_presnce_of email, :if => :validate_id + Factory girl

2009-06-01 Thread Mukund

Move that to a module and include it as a mixin in your model?

On Jun 2, 10:00 am, Sijo Kg  wrote:
> Hi
>     In the model I have User
> attr_accessor :validate_email_id
> validates_presence_of :email ,:if => :validate_email_id
>   Could anybody please tell me how can I define a Factory for the above?
>
> Thanks in advance
> Sijo
> --
> 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] postgresql broken on windows in 2.3-stable

2009-06-01 Thread snacktime
The addition of quote_indent in the postgresql adapter has broken postgresql
support on windows.   The postgres-pr gem was the only driver working with
rails on windows, and it doesn't have quote_indent.  The newer drivers such
as ruby-pg  probably do have the quote_indent method, but rails doesn't
support them yet.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] engine migration in main application in rail 2.3.2 on window

2009-06-01 Thread Vikas Gholap

Hello all,

I am developing a small rails engine. using rails 2.3.2 version on
windows OS

I followed steps from railscast video.
"http://media.railscasts.com/videos/149_rails_engines.mov";

I am stopped at how to do migration from rails engine to main
application

in railscasts video they given a rake task like

but this task is not for windows environment.
-
namespace :create_subscription do
  desc "Sync extra files from create_subscription plugin."
  task :sync do
   system "rsync -ruv vendor/plugins/floxee/db/migrate db"
  end
end
---

Is there any command to run migration task.

Can any one tell me what should I use, so that I can run plugins
migration ?

Thanks,
Vikas.
-- 
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] Days of the Week and Models

2009-06-01 Thread sir ziggles

Hi All,

Would love to hear your input on this:

I have a model called Demonstration.

A Demonstration can take place on any, some or all of the days in a
given week.

i.e. Monday, Tuesday and Friday

How should I setup my model(s) to support this relationship?  Is there a
preferred method??




Two ideas i've had:
 - Create a model named Days with a row for each day of the week.
Create a days_demonstrations table and create a HABTM relationship

 - Use the built in Date::DAYNAMES that comes with Ruby.  Create a field
in the Demonstration table called 'days' and store the supported days as
a string: 0,3,5.  Then break it up when it's time to use them as check
boxes in the view.


thanks!
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Daemons causing Mysql::Error:Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock'

2009-06-01 Thread Ram

Ummm. Maybe I should cut the long story short.

couple of daemons, when running on server, slow down and crash my
Rails apps. Logs show me errors like

Mysql::Error:Can't connect to local MySQL server through socket '/var/
run/mysqld/mysqld.sock'
&
MySQL server has gone away

Sometimes, I also get a Passenger::Railz::ApplicationSpawner::Error.
Any ideas on what might be going wrong? Tried
"ActiveRecord::Base.connection.reconnect! " in the daemons but that
dint help.

On Jun 1, 11:42 am, Ram  wrote:
> Hi all,
>
> Ive been having this problem for the past few days on production. I
> have a couple of daemons (using the daemons gem and daemon_generator)
> that I run every hour on the server. One of them sends out email too
> (just in case thats relevant information). Besides this, I have 4
> Rails apps running on the server one of which contains the above
> mentioned daemons.
>
> Now everytime I deploy, I have a couple of Capistrano tasks that stop
> the daemons before:update_code and start them again after:update_code.
> This I do because they stop running altogether during the deployment
> window because MySQL locks down and the daemons, when trying to
> connect to MySQL, fail.
>
> However, once both daemons are started, everything funcitons fine for
> about 15-20 minutes after which, if I try to access any of the 4 Rails
> apps, I get "Mysql::Error:Can't connect to local MySQL server through
> socket '/var/run/mysqld/mysqld.sock'". I also sometimes get the "MySQL
> server has gone away" error. I especially get the 2nd error in the
> daemons logs when they try to run again.
> Sometimes, when I try to access one of my apps, Passenger throws an
> error saying
>
> Passenger::Railz::ApplicationSpawner::Error
> application_spawner.rb line 111 in `spawn_ application'
>
> Now all these are related only to the daemons cos if I stop them and
> reboot my server, the apps work just great.
> Googling around, I found that the "MySQL server has gone away" error
> can be fixed by adding
>
>   ActiveRecord::Base.connection.reconnect!
>
> just before running AR queries from daemons. I tried it but it dint
> stop the apps from crashing. Is the connection apparent to anyone? Any
> ideas on how I can resolve this with least impact on my 4 apps running
> on production??
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: ArgumentError - Unable to rectify please help

2009-06-01 Thread Aslam Syed

I have written a ActionMailer class called the Mailer and I am sending 
email on that line:
  Mailer.deliver_confirm(email, code)

There is no additional information other than the error message which I 
have pasted.



Rick Lloyd wrote:
> What's going on in line 105 of accounts_controller.rb?  Also, is there
> any information in the log file that corresponds to the failure?
> 
> On Jun 1, 8:47�am, Aslam Syed 

-- 
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] valdate_presnce_of email, :if => :validate_id + Factory girl

2009-06-01 Thread Sijo Kg

Hi
In the model I have User
attr_accessor :validate_email_id
validates_presence_of :email ,:if => :validate_email_id
  Could anybody please tell me how can I define a Factory for the above?

Thanks in advance
Sijo
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: table less model

2009-06-01 Thread Marnen Laibow-Koser

pharrington wrote:
> If your model isn't abstracting the DB in anyway, just don't have it
> inherent from ActiveRecord::Base...

Exactly.  Also, I recommend that you (the OP, that is) take a look at 
Authlogic, which uses a tableless model for user authentication; perhaps 
it will do what you want.

Best,
--
Marnen Laibow-Koser
http://www.marnen.org
mar...@marnen.org
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: table less model

2009-06-01 Thread pharrington

If your model isn't abstracting the DB in anyway, just don't have it
inherent from ActiveRecord::Base... or perhaps I'm not understanding
part of your question?

On Jun 1, 11:30 pm, Craig White  wrote:
> I want to have a simple model without a table for ACL purposes because
> there aren't going to be many methods at all.
>
> How could I have a Model like...
>
> ControllerMethod securitylevel
>
> users_list       8
> reports_ar       6
> ar_print_checks  7
>
> so I can use retrieve and use these values in a before_filter in
> ApplicationController.rb? The intent is to create a lightweight ACL
> system.
>
> I don't see the need to actually create a table or store the data in a
> table at all.
>
> Any suggestions on how I can accomplish this?
>
> Craig
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] table less model

2009-06-01 Thread Craig White

I want to have a simple model without a table for ACL purposes because
there aren't going to be many methods at all.

How could I have a Model like...

ControllerMethod securitylevel

users_list   8
reports_ar   6
ar_print_checks  7

so I can use retrieve and use these values in a before_filter in
ApplicationController.rb? The intent is to create a lightweight ACL
system.

I don't see the need to actually create a table or store the data in a
table at all.

Any suggestions on how I can accomplish this?

Craig


-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: simple tables question

2009-06-01 Thread Philip Hallstrom

> Sorry for this rudimentary question... I've been following Pragprog's
> rails book, and somehow I'm still missing something basic:
>
> I need to make a table (class) where one of the columns' (attributes')
> type is an array of objects of another class.  In other words, I  
> need to
> know how to implement a phone-book list, where you can click on the  
> name
> of the entry and be taken to that person's, say, bank info.
>
> Does anybody know of any guides that might walk me through this, or be
> able to give me a rough picture of what needs to be done so I can  
> figure
> it out myself?

I think you want two separate models... where one has many of the other.

That is...

class Contact << AR..
   has_many :phone_numbers
end

class PhoneNumber << AR..
   belongs_to :contact
end

Your sql table "phone_numbers" would then have a "contact_id" field.

-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] Edge - stable at the moment?

2009-06-01 Thread Tim Haines

Hi there,

Is anyone running a site on close to edge at the moment?  I know the
changes going on are fairly significant, so I'm wondering if it's more
unstable than usual.

There's a couple of features beyond 2.3 stable that I'm keen to get my
hands on..

Tim.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] simple tables question

2009-06-01 Thread Tyler Wolf

Sorry for this rudimentary question... I've been following Pragprog's
rails book, and somehow I'm still missing something basic:

I need to make a table (class) where one of the columns' (attributes')
type is an array of objects of another class.  In other words, I need to
know how to implement a phone-book list, where you can click on the name
of the entry and be taken to that person's, say, bank info.

Does anybody know of any guides that might walk me through this, or be
able to give me a rough picture of what needs to be done so I can figure
it out myself?

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] UTF-8, AES encryption, the works - help !

2009-06-01 Thread Abe Ced

Hi,

I would like to store some sensitive data into my DB using Rails, it has
to be encrypted. I've tried a lot of methods of encryption, they all
work. Fine by now, yet when I try to store the results into my DB
(tables are UTF-8, SET NAMES UTF8; is there, server UTF-8, DB Connection
UTF-8) -- I can cmd (yeah, Windows..) and enter a UTF-8 record into the
table, so that's not where the problem is.

So after I use the encryption method (AES, Blowfish yada - all returning
UTF-8, they all work - encrypt then decrypt, strings match), I would
like to store the result in the DB -> Just using an insert with the
encrypted string fails, as it inserts only regular, Latin1-chars, the
other characters are being discarded. I have googled and tried all
options,

ic = Iconv.new('UTF-8//IGNORE', 'UTF-8')
valid_string = ic.iconv(enc + ' ')[0..-2]

raises InvalidCharacter or InvalidSequence on some strings so not
viable.. Should I convert the result of AES and so on into Latin1 ?? I'm
quite lost as you can see, spent too much on it already.

So am I beating around the bush too much (wasted a lot of time on this
already), or should I search for a non-Unicode encryption solution
(Salted base64 ?) ? Message digests like SHA1 MD5 and so on are not an
option, need to be able to recreate the message (username or email, for
instance).

Thanks a whole lot ! I can provide extra details if required, no
problem.
-- 
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: Set a session variable in a link_to

2009-06-01 Thread Freddy Andersen

link_to("my link", my_task_path, :special_needs => true)

That would give you params[:special_needs]

What are the actions maybe you should have different controllers?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: Model Name Conflict

2009-06-01 Thread Saty Nos

Thanks Ar Chon for the prompt response. But that runs me to another 
question.

How is Filter.find() different from ::Filter.find()?
What exactly does prefixing :: does?

I was under the impression that
Filter.find(),
self::Filter.find() and \
::Filter.find()
all the same. What is the difference between them? and how does these 
effect the Dependencies mechanism?

Hope that is not a lot to ask. Thanks in advance.
-Satynos
Ar Chron wrote:
> Use
> 
> ::Filter.find(blah blah lbah)
> 
> to force Rails to look at your Filter class rather than 
> ActionController's

-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] auto_complete plugin for rails 2.2.2

2009-06-01 Thread semi

Can anyone help me as to why I can't get this thing to work for rails
2.2.2? I get the following error when I ruby script/server:

=> Booting WEBrick...
C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load': syntax error on line 5,
col 11: `-a=
-z (ArgumentError)
¤'
from C:/Ruby/lib/ruby/1.8/yaml.rb:133:in `load'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
initializer.rb:819:i
n `database_configuration'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
initializer.rb:391:i
n `initialize_database'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
initializer.rb:139:i
n `process'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
initializer.rb:112:i
n `send'
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/
initializer.rb:112:i
n `run'
from C:/Users/marvin/Desktop/test_complete/config/
environment.rb:13
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `ge
m_original_require'
 ... 10 levels...
from C:/Ruby/lib/ruby/gems/1.8/gems/rails-2.2.2/lib/commands/
server.rb:4
9
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `ge
m_original_require'
from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
31:in `re
quire'
from script/server:3

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] Conditions for Multiple Columns?

2009-06-01 Thread Jay Covington

Hello,

I have a table called "Itemlist" and have multiple columns in it such as
"item1", "item2", "item3", "item4". These columns often have repetitious
data between them and I'm trying to count it. The only working code I
have so far is:

statcount = Itemlist.count(:all, :condition => {:item1 => "Apple"})

And this works fine for retrieving the count for "Apple" in all the
:item1 fields, but I need to retrieve the count for "Apple" from the
columns :item2, :item3, and :item4 as well as :item1. Any ideas? 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] Set a session variable in a link_to

2009-06-01 Thread JannaB

I need to link_to a particular method in a particular controller that
needs to do something one time, from one page, and something
dfifferent another time, from another page.

I intend to set and subsequently get a session variable to do this.
This would require setting a session variable in the link_to code --
is there a way to do this? Thanks, Janna
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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 Delete Table from Database?

2009-06-01 Thread Brian

Or, if you created it with a migration, you can just undo it the same
way (the code is already written for you):

rake db:migrate:down VERSION=x

You can grab the version number from the front of your file name in db
\migrations

On Jun 1, 5:41 pm, Zayd Connor 
wrote:
> I want to delete my project, how do I delete my table inside my sqlite
> database?
>
> Thanks
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Access values with has_and_belongs_to_many assocciation

2009-06-01 Thread Brian



On Jun 1, 5:01 pm, LOUPOS KONSTANTINOS  wrote:
> Hi!
> I have 2 models author and product.
>
> class Author < ActiveRecord::Base
>   has_and_belongs_to_many :products
> end
>
> class Product < ActiveRecord::Base
>   has_and_belongs_to_many :authors
> end
>
> I have also created the migration for the jointable authors_products
> with the keys author_id and product_id.
>
> Now, i suppose that when i have eg an author with author_id = 1 and a
> product_id=4 in the join table, i should be able to access the product
> title of that product and the author name of my author.
>
> How can i access these values???
>

The association adds some helper attributes to your model.  If you
have an instance of an author you can use the products attribute to
get all of the associated products in an array:

my_author = Author.find(1)
my_author.products


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: Convert Date to DateTime

2009-06-01 Thread Rick DeNatale

On Mon, Jun 1, 2009 at 7:44 PM, David  wrote:
>
> The method I am using to convert Date objects to DateTime objects is:
>
> date_obj = DateTime.parse(Date.to_s)
>
> Is this an okay way to go about doing this?  Or is there a more
> efficient way?

Well, on Rails you can do

date_obj.to_date_time

It's part of ActiveSupport

-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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] Convert Date to DateTime

2009-06-01 Thread David

The method I am using to convert Date objects to DateTime objects is:

date_obj = DateTime.parse(Date.to_s)

Is this an okay way to go about doing this?  Or is there a more
efficient way?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] Does has_many collection '<<' (append operator) always save/create child in DB when parent isn't new?

2009-06-01 Thread Kendall Gifford

Howdy, the title mostly asks the question.

Given the following:

class Article < ActiveRecord::Base ; has_many :comments ; end
class Comment < ActiveRecord::Base ; belongs_to :article ; end

I have an article already instantiated in the database, referenced as
@article.

Will the following code always "create" (save to DB) a new comment?

@article.comments << Comment.new :text => "Blah blah..."

I would like to be able to add comments to an article that already
already exists (and may already have comments that exist) in the
database w/out the new comment being saved to the database.

I would try this: @article.comments.build :text => "Blan blah..."

The reason I don't is because my Comment class is sub-classed using
STI. Thus, my code really looks more like this:

klass = Comment.get_class(params[:comment_type]) # get_class returns
Comment or a sub-type
@article.comments << klass.new :text => "Blah blah..."

Anyone have any ideas on how I can add STI comments to an article w/
out saving them, doing so "the right way" (I'm sure I could ugly-hack
it)?

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: multiple controllers/views for one model

2009-06-01 Thread Robert Walker

JannaB wrote:
> How does you handle this in the Rails MVC design? I already have a
> controller and a view for users (where you CRUD on the user). How do
> you handle different required functionality/view like this? Thanks,
> Janna

The first thing I would suggest is to take a step back from Rails and 
try to focus on Model-View-Controller itself. What you are describing is 
one of the fundamental design principals that MCV was created to solve.

The model should exist entirely independently from any views or 
controllers. This is often referred to as decoupling. Any system based 
on MVC should be able to share the same model with any number of views 
and controllers.

Views and controllers are typically more tied together than are models 
to view and controllers. What you want to separate from views and 
controllers are the responsibilities. Plus there is usually not a 
one-to-one correspondence between views and controllers. Imagine a 
Graphical User Interface that contains buttons, text boxes, combo boxes, 
checkboxes, image views, etc. Each of these are typically instances of 
view classes. There is a "button" class, a "text box" class, etc.

These view are then composed into a hierarchy, and the hierarchy is 
typically managed by a single controller. The responsibility of the 
controller is to react to, and process, user input (e.g. clicking a 
button or entering text in a text box). Then the controller takes that 
input and communicates with the model (if necessary) and uses the data 
to update the views, hence providing feedback to the user.

Now back in the world of Rails, much of this still holds true. Views 
provide the interface to the user in the form of web forms with text 
boxes, submit buttons, etc. The difference is rather than an event loop 
that processes user interaction in "real time," web applications 
typically have a request-response cycle and process user input in 
"batches." The controller would typically receive all the user input 
from a web form in one chunk (the URI and parameters). Then interact 
with the model and produce a "page" as output to present back to the 
user.

An additional aspect to Rails MVC is that controllers, along with the 
routes file, serve to map URIs to resources. Keep in mind that resources 
are not equivalent to controller+model.

While it makes sense to have one controller and a set of views to manage 
a "User" resource. You are not at all limited to one controller per 
model. Maybe in your case you might have a "Friend" resource that has 
it's own controller and set of views that shows information about a 
user's friend. The friends_controller might then have a "show" action 
that displays information about the friend's whereabouts. I don't know 
if all that makes sense, but it should serve to illustrate the idea of 
resources as something separate, and in some ways more abstract, than 
controllers and models.
-- 
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: Simple problem of negating boolean in params-hash

2009-06-01 Thread Frederick Cheung


On Jun 1, 6:49 pm, Adrian D  wrote:
> Hi,
>
> I have a simple problem. I get a boolean value in the parameter hash
> and want to negate it. But somehow I missed there a fundamental
> concept, because that doesn't make any sense to me:
>
> Code:
>
> test1 = !params[:editmode]
> test2 = params[:editmode]

All controller parameters are strings, so this negation doesn't do
what you think it does (because strings are not nil and they are not
the boolean value false, any string always has the logical value true,
and its negation the logical value false). You need to compare the
parameters with whatever string you have decided represents true/false

Fred
>
> logger.info("Editmode: #{params[:editmode]} Test 1: #{test1} und Test
> 2: #{test2}")
>
> Output:
>
> "Editmode: false Test 1: false und Test 2: false"
>
> or when editmode is true: "Editmode: true Test 1: false und Test 2:
> true"
>
> Thanks for your 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] Simple problem of negating boolean in params-hash

2009-06-01 Thread Adrian D

Hi,

I have a simple problem. I get a boolean value in the parameter hash
and want to negate it. But somehow I missed there a fundamental
concept, because that doesn't make any sense to me:

Code:

test1 = !params[:editmode]
test2 = params[:editmode]

logger.info("Editmode: #{params[:editmode]} Test 1: #{test1} und Test
2: #{test2}")

Output:

"Editmode: false Test 1: false und Test 2: false"

or when editmode is true: "Editmode: true Test 1: false und Test 2:
true"

Thanks for your help

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: instance variable (conroller>view) and RESTful

2009-06-01 Thread zambezi


Hi to Colin, Jennifer and anyone else,

If nothing else, this forum serves as a sanity check.

My difficulty arose when I created an application wide template as a
container for various views and attempted to pass a title variable to
the template.  None of my fiddling raised any errors.  After reading
your replies I went back to my application and sacrificed another hour
to Ruby idiosyncracies.  Here is what I've done and the results.

# within layout/application
class LinkController < ApplicationController
def display
@title = "title (display)"
end
def index
  @title = "title (index)"
end
def foo
  @title = "title (foo)"
end
end

<%= @title %>
---
I created a view named 'display'  with the above embedded Ruby and
opened it in the browser.  The title was BLANK.
Next I renamed the view 'index' and opened it in the browser. The
title appropriately showed "title (index)"
Then I renamed the view 'foo' and again a BLANK title.
I renamed the view back to 'index' and the title reappeared.

The above was with a template, so I decided to try the same fun
experiment with a standalone view.  And things got murkier.  Views
named 'index' and 'foo' display their titles.  Views named 'display'
are BLANK.

Just on the off chance that Ruby is weirder than I think, I checked
the list of reserved words.  No conflicts there.  I also considered
there might be something bizarre about the title tags, so just stuck a
variable in the middle of the view  <@= @title %>.  This
just reproduced the earlier results.

So there is the sad story.  Help!  I suppose I can just test all of my
view names to see if they pass muster, but I am really hoping to
eventually get to where Ruby is a time saver.

Any suggestions and/or comments on the instance variable behavior will
be welcomed.

Bill
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Forcing use of gem in vendor/gems?

2009-06-01 Thread Denis Haskin
Sorta surprised this isn't a FAQ, but...

Maybe this is not good practice, but I have a gem that is both installed 
in the system and in vendor/gems.  The vendor/gems copy has some local 
mods.  Seems like the only way I could find to forced that one to be 
loaded for capistrano over the system one was to put:

$LOAD_PATH.insert 0, 
"#{File.dirname(__FILE__)}/../vendor/gems/myfavoritegem/lib"

in deploy.rb.

Is that really the best way to do it?  I guess I was sort of figuring 
that vendor/gems would be preferred over the system gem library, in the 
case of duplicates.

Thanks,

dwh


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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 Delete Table from Database?

2009-06-01 Thread Maurício Linhares

ActiveRecord::Base.connection.drop_table :your_table_name

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Mon, Jun 1, 2009 at 6:41 PM, Zayd Connor
 wrote:
>
> I want to delete my project, how do I delete my table inside my sqlite
> database?
>
> 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 Delete Table from Database?

2009-06-01 Thread Zayd Connor

I want to delete my project, how do I delete my table inside my sqlite
database?

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] Outlook like calendar

2009-06-01 Thread CiriusMex

Hi,

I'm working on a reservation system for a site and I would like to
display a calendar with the programation of a cine movies or the hours
of classes for a gym center...that kind of stuff.
The Outlook calendar is really great, and on the other hand I want the
calendar to be displayed for the selected day, week or month just like
in outlook...

So if anyone know of a existing component that already does this it
would be great and save me a couple of hours of development :)

Thanks for the help and have a good day ^^
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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 values with has_and_belongs_to_many assocciation

2009-06-01 Thread LOUPOS KONSTANTINOS

Hi!
I have 2 models author and product.

class Author < ActiveRecord::Base
  has_and_belongs_to_many :products
end

class Product < ActiveRecord::Base
  has_and_belongs_to_many :authors
end

I have also created the migration for the jointable authors_products
with the keys author_id and product_id.

Now, i suppose that when i have eg an author with author_id = 1 and a
product_id=4 in the join table, i should be able to access the product
title of that product and the author name of my author.

How can i access these values???

Thanx in advance for your time!

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] smart data loading

2009-06-01 Thread Greg Donald

I need something to load my seed data when I stage my app for
milestone releases.  I'm using fixtures currently but maintaining the
foreign key relationships is getting more difficult as the app grows
larger.

I'd like something that's aware of my foreign keys constraints and
knows to load the data in the proper order.

I've looked at FactoryGirl and seed_fu so far but would love to hear
of any alternatives.


Thanks,

-- 
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] Re: Updated Tutorials?

2009-06-01 Thread J. D.

Philip Hallstrom wrote:
>> Are there any tutorials out there that work for rails 2.3.2 that I can
>> follow along with and where?  I'd love to learn more about the model
>> transitioning with databases..  I've learned a great deal already but
>> I'm missing tutorials that interact with databases.
> 
> http://guides.rubyonrails.org/

Thanks Philip

-- 
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: IE6 CSS and Rails Routes

2009-06-01 Thread p_W

Sorry if this is a dumb question, but are you putting actual link tags
in your templates or are you using 'stylesheet_link_tag()' ?

On Jun 1, 4:20 pm, Bob O  wrote:
> so i found out it was a pathing problem when i went to a url like /
> controller/action, it caused my stylesheet path to break.
>
> if i add a ../stylesheets/ie6stinks.css then it works for those pages
> that have the controller in the url.
>
> So now i have to conditionals that basically point to the same
> stylesheet stylesheets/file.css and ../stylesheets/file.css seems
> rather dumb to have to do it this way, does anyone have any ideas on
> how to remedy or DRY up this issue?
>
> Thanks
>
> On Jun 1, 10:11 am, "bhan...@hcinsight.com" 
> wrote:
>
> > I dont know if anyone has come across this issue.
>
> > I have 2 different layouts for my app. both contain the same partial
> > with the same CSS files in the head.
>
> > in that i also have a IE6 CSS Hack file. Pretty standard.
>
> > The Problem in IE6
> > My issue is this. on any of my main pages that have named routes like
> > so
> >   map.privacy 'privacy-policy', :controller => "information", :action
> > => "privacy_policy"
> >   map.admin 'dashboard', :controller => "admin", :action =>
> > "dashboard"
> >   map.home 'home', :controller => "information", :action => "home"
> >   map.search 'search', :controller => "information", :action =>
> > "search"
>
> > the CSS is picked up fine. but if i go to an action like /information/
> > home (this is in the url vs just home), where the controller is
> > listed. The CSS breaks and doesnt render the page correctly. But...
> > The file is still listed in the source(view source)..
>
> > very strange. any help would be great.
>
> > Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: Model Name Conflict

2009-06-01 Thread Ar Chron

Use

::Filter.find(blah blah lbah)

to force Rails to look at your Filter class rather than 
ActionController's
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Updated Tutorials?

2009-06-01 Thread Philip Hallstrom

> Are there any tutorials out there that work for rails 2.3.2 that I can
> follow along with and where?  I'd love to learn more about the model
> transitioning with databases..  I've learned a great deal already but
> I'm missing tutorials that interact with databases.

http://guides.rubyonrails.org/

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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] Model Name Conflict

2009-06-01 Thread Saty Nos

I have a model by the name Filter but due to the changes in reorganizing
the filters from 2.0.3, it is conflicting with the

ActionController::Filters::Filter (class)

In my filters_controller.rb when I try to find the filter

Filter.find(:id)

as rails is infering the ActionController::Filters::Filter class rather
than my model class Filter. Is there any work around other than renaming
my model?

BTW: If I use ActiveRecord::Base::Filter.find(:id) to load my filter
object, its working, but I am not quite sure if there are any unforseen
implications by doing this, when rails try to unload/reload constants.

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: IE6 CSS and Rails Routes

2009-06-01 Thread Bob O

so i found out it was a pathing problem when i went to a url like /
controller/action, it caused my stylesheet path to break.

if i add a ../stylesheets/ie6stinks.css then it works for those pages
that have the controller in the url.

So now i have to conditionals that basically point to the same
stylesheet stylesheets/file.css and ../stylesheets/file.css seems
rather dumb to have to do it this way, does anyone have any ideas on
how to remedy or DRY up this issue?

Thanks

On Jun 1, 10:11 am, "bhan...@hcinsight.com" 
wrote:
> I dont know if anyone has come across this issue.
>
> I have 2 different layouts for my app. both contain the same partial
> with the same CSS files in the head.
>
> in that i also have a IE6 CSS Hack file. Pretty standard.
>
> The Problem in IE6
> My issue is this. on any of my main pages that have named routes like
> so
>   map.privacy 'privacy-policy', :controller => "information", :action
> => "privacy_policy"
>   map.admin 'dashboard', :controller => "admin", :action =>
> "dashboard"
>   map.home 'home', :controller => "information", :action => "home"
>   map.search 'search', :controller => "information", :action =>
> "search"
>
> the CSS is picked up fine. but if i go to an action like /information/
> home (this is in the url vs just home), where the controller is
> listed. The CSS breaks and doesnt render the page correctly. But...
> The file is still listed in the source(view source)..
>
> very strange. any help would be great.
>
> Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: counter_cache is making a redundant SELECT before UPDATE

2009-06-01 Thread Jeffrey L. Taylor

Quoting Fernando Perez :
> 
> Hmm, actually I just watched the railscasts about the counter_cache, and 
> in his log he also has this redundant SELECT that he didn't even spot.
> 
> So I guess this could be an additional feature added to Rails to save 1 
> DB query.

Is the title declared unique?  Then Rails queries the DB to check that there
is no existing record before doing the UPDATE.

HTH,
  Jeffrey

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: override finders?

2009-06-01 Thread Michal Burak

Maurício Linhares wrote:
> http://ryandaigle.com/articles/2008/11/18/what-s-new-in-edge-rails-default-scoping

Thats it! Thanks!

M.
-- 
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] Updated Tutorials?

2009-06-01 Thread J. D.

Summary:

Every book I've purchased has either been a) outdated using rails 1.x or
b) outdated using rails 2.x where there are issues working through some
of the books.

A good example is a book that others said was wonderful.  It's called
Foundation Rails 2.

I started going through the book and everything is being taught the
exact way I like to learn.  So, I'm thinking "alright this is great!".
Then, I get to the first partial tutorial involving "clients".  I'm
supposed to add the unfinished clients (that I downloaded) and work from
that.

I download it, place it in my projects directory, fire up netbeans 6.5
and add it and encounter a rake error.  I try to get more information so
I drop down into a command prompt and run rake -D on the directory
called Clients and receive the following error:

rake aborted!
undefined method 'new!' for Rational:Class
C:/Ruby/lib/ruby/gems/1.9.1/gems/rake-0.8.7/lib/rake.rb:2383:in
'raw_load_rakefile'

I spent hours finally getting both mysql and sqlite3 up and running on
1.9.1 on a windows environment and I'm able to create new projects in
either DB platform on rails using netbeans 6.5.

However, it seems that every tutorial I find (other than the 10-minute
weblog tutorial for netbeans) has failed or is outdated and contains
errors.  I wouldn't be bothered by this so much if it wasn't for the
fact that I've paid money for these books and many of them have some
nice concepts but nothing to work with or through.

So, my frustration is not with rails and it's ever changing environment.
It's that people are selling books that are stating they work fine with
rails 2.x and they aren't.

Are there any tutorials out there that work for rails 2.3.2 that I can
follow along with and where?  I'd love to learn more about the model
transitioning with databases..  I've learned a great deal already but
I'm missing tutorials that interact with databases.

Many 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] rendering layouts/views from plugins

2009-06-01 Thread wbsurf...@yahoo.com


 I am wondering if there is an easy way to render layouts and views
from the plugin directory, as well as javascript and css ?

 I know I could have a rake task copy them from the plugins to where
they would normally go, but they may change from time to time within
the application and then need to go back into the plugin. If I cause
them to function as a plugin, then as I develop my app, the plugin
changes as well. This is just a plugin that I use for myself only and
would not get used alot except shared between a few apps, though if I
updated it, I would update it in one app and then copy the changes to
the other apps by copying that plugin from one app to another.

 The other possibility is I could have a rake task copy them from the
app back into the plugin dir, but that seems sort of strange.

 I'm not sure if there are some better approaches ...



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: legacy db connection

2009-06-01 Thread Frederick Cheung



On Jun 1, 7:10 pm, Bill McGuire 
wrote:

> >> b=Freak_Project.find(:first)
>
> => #
>
> >> a.freak_project.name
>
> LoadError: Expected /home/admin/ie/app/models/freak_project.rb to define
> FreakPr
> oject

That looks like it was trying to find a class called FreakProject and
you only have Freak_Project. Use the :class_name option to belongs_to/
has_many.

Fred
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: collection_select option with multiple symbols

2009-06-01 Thread Aldo Italo

muito obrigado :-)

-- 
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: legacy db connection

2009-06-01 Thread Bill McGuire

E. Litwin wrote:
> Are you getting an error message that you can post?
> 
> On May 29, 2:24�pm, Bill McGuire 

This is what i get when running via console - thanks

ruby script/console
Loading development environment (Rails 2.1.2)
>> a=Freak_Item.find(:first)
=> #

>> b=Freak_Project.find(:first)
=> #

>> a.freak_project.name
LoadError: Expected /home/admin/ie/app/models/freak_project.rb to define 
FreakPr
oject

-- 
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: collection_select option with multiple symbols

2009-06-01 Thread Maurício Linhares

Here's how it would look like:

 <%= f.label :customer, t('admin.customers.index.items') %>
 <%= f.select( :customer, @customers.map {|c| ["#{c.surname} #{c.name}
- #{c.company}", c.id] } ) %>

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Mon, Jun 1, 2009 at 2:44 PM, Aldo Italo
 wrote:
>
> i have this collection_select:
>
>  <%= f.label :customer, t('admin.customers.index.items') %>
>  <%= f.collection_select( :customer, @customers, :id, :surname, options
> = {:prompt => t('admin.customers.index.item') } ) %>
>
>
>
>
> and i want to obtain this in my html:
>
>  ..  surname name company  ...
>
>
>
> i tryed:
>  <%= f.label :customer, t('admin.customers.index.items') %>
>  <%= f.collection_select( :customer, @customers, :id, :surname + :name
> + :company , options = {:prompt => t('admin.customers.index.item') } )
> %>
>
>
>
> but it isn't possible. ho can i do?
> --
> 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: override finders?

2009-06-01 Thread Maurício Linhares

http://ryandaigle.com/articles/2008/11/18/what-s-new-in-edge-rails-default-scoping

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Mon, Jun 1, 2009 at 2:42 PM, Michal Burak
 wrote:
>
> Hi,
>
> 1.
> I have my model for e.g. "Car".
> I used this model in lots of places.
>
> 2.
> In a migration I added Car.is_visible default => false.
>
> 3.
> Now I wan all of the finder methods to take this flag under
> consideration. So initaly none of the Cars will be displayed on my site.
> I will have to look for the places where I want to display "not visible"
> cars and there add the special condition to the finder method (whitelist
> pattern).
>
> Any help appreciated.
>
> M.
> --
> 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: process request and redirect to another url with all params

2009-06-01 Thread Mk 27

The key issue here is that this will need to be send as a POST request, 
whereas I assume the default of redirect_to is GET.

You will have to put the params onto to the end of the url string 
yourself, eg.

param1=this¶m2=16¶m3=that
-- 
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] why the cult-like adherence to the One True Way of Agile works...

2009-06-01 Thread Phlip

 From else-net, here's the results of an informal survey why professional 
testers who actually help do all the developer- and customer-testing we authors 
advocate feel about the results:

Here's my final top ten list, with responses from this list, twitter, and 
coworkers. Thanks for all your contributions!

Top Ten Reasons I Love Agile Testing:

10. No more manual test scripts!

9. I don't have to work in a cubicle.

8. I'm allowed to think about stuff and learn stuff.

7. Developers don't hide when they see me coming!

6. I investigate and solve complicated, interesting problems every day - and 
they pay me to do this!

5. I can impact quality, instead of just documenting it.

4. Customers actually like the product.

3. No more death marches!

2. There's always time for testing, because testing happens first.

And the number one reason I love agile testing...

1. I get to hear people say "this is the best project I've ever worked on in my 
life!"

-UtahKay

-- 
   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] riding case in form_for.label

2009-06-01 Thread JannaB

It seems for_for.label wishes to override the case  of the label I
give it. Is there a way to stop this behavior? Thanks Janna
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] collection_select option with multiple symbols

2009-06-01 Thread Aldo Italo

i have this collection_select:

  <%= f.label :customer, t('admin.customers.index.items') %>
  <%= f.collection_select( :customer, @customers, :id, :surname, options
= {:prompt => t('admin.customers.index.item') } ) %>




and i want to obtain this in my html:

  ..  surname name company  ...



i tryed:
  <%= f.label :customer, t('admin.customers.index.items') %>
  <%= f.collection_select( :customer, @customers, :id, :surname + :name
+ :company , options = {:prompt => t('admin.customers.index.item') } )
%>



but it isn't possible. ho can i do?
-- 
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] override finders?

2009-06-01 Thread Michal Burak

Hi,

1.
I have my model for e.g. "Car".
I used this model in lots of places.

2.
In a migration I added Car.is_visible default => false.

3.
Now I wan all of the finder methods to take this flag under
consideration. So initaly none of the Cars will be displayed on my site.
I will have to look for the places where I want to display "not visible"
cars and there add the special condition to the finder method (whitelist
pattern).

Any help appreciated.

M.
-- 
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 mysql error

2009-06-01 Thread Gerardo Gonzalez Cruz
The message said, update your MySQL client, reverify your conf file, and try
again. What MySQL version have you?

On Mon, Jun 1, 2009 at 8:05 AM, Gourav Tiwari wrote:

>
> Thanks for your reply Vipin,
>
> I am able to connect to Mysql through command prompt and mysql query
> browser.
>
> Also, I am able to connect to a remote system by mysql query browser
> tool.
> I have copied ibmySQL.dll from MYSQL_INSTALL/bin  forlder to
> RUBY_INSTALL/bin folder
>
> I have mysql gem installed 2.7.1
>
> but it still doesn't work.
>
> -gourav
>
> On Jun 1, 5:28 pm, Vipin  wrote:
> > On Jun 1, 4:44 pm, Gourav Tiwari  wrote:
> >
> >
> >
> > > Hi,
> >
> > > I am getting a mysql error while running a ruby file on my system
> > > (Windows):
> >
> > > D:/ruby/lib/ruby/1.8/mysql.rb:453:in `read': Client does not support
> > > authentication protocol requested by server; consider upgrading MySQL
> > > c
> > > lient (Mysql::Error)
> > > from D:/ruby/lib/ruby/1.8/mysql.rb:130:in `real_connect'
> > > from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > > active_record/connection_adapters/mysql_adapter.rb:576:in `connect'
> > > from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > > active_record/connection_adapters/mysql_adapter.rb:204:in `initialize'
> > > from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > > active_record/connection_adapters/mysql_adapter.rb:76:in `new'
> > > from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > > active_record/connection_adapters/mysql_adapter.rb:76:in
> > > `mysql_connectio
> > > n'
> > > from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > > active_record/connection_adapters/abstract/connection_pool.rb:223:in
> > > `sen
> > > d'
> > > from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > > active_record/connection_adapters/abstract/connection_pool.rb:223:in
> > > `new
> > > _connection'
> > > from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > > active_record/connection_adapters/abstract/connection_pool.rb:245:in
> > > `che
> > > ckout_new_connection'
> > >  ... 16 levels...
> > > from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > > active_record/base.rb:1991:in `all_attributes_exists?'
> > > from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > > active_record/base.rb:1847:in `method_missing'
> > > from test1.rb:28:in `select_type'
> > > from test1.rb:39
> >
> > > I have Ruby 1.8.6 and Mysql Server 5.0 installed. I also have gone
> > > through google:
> http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/198795htt
> ..
>  >
> > > but it did not help. Do I need to make any configuration for this?
> >
> > > Thanks in advance
> > > -gourav
> >
> > Can you verify if following things are in proper place.
> >
> > 1. Are you able to connect to mysql otherwise on your system.
> > 2. Have you done $gem install mysql
> > 3. Copy libmySQL.dll from MYSQL_INSTALL/bin  forlder to RUBY_INSTALL/
> > bin folder
> > 3. Verify database.yml has your password
> >
> > vipin
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] process request and redirect to another url with all params

2009-06-01 Thread Doug Mathews

I am trying to do the following:
process a request containing form data. Once I my app has successfully
completed its processing, I would like to redirect_to a totally
different site and pass along the parameters that came in with the
original request.

This is how I am currently handling it in the controller:
[code=]def create
  @subscription = Subscription.new(params[:subscription])

  @subscription.user_id = current_user.id

  @subscription.subscribe

  respond_to do |format|

  if @subscription.save
parms2 = params

format.html {redirect_to
"http://www.someothersite.com/process",parms2}
  else
   #handle the problem
  end
end

  end[/code]
Everything up to the redirect is happening correctly. Then I am
redirected to www.someothersite.com but it is behaving as though the
parms2 are missing. I am new to Ruby and Rails and am probably missing
something very easy here.

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: multiple controllers/views for one model

2009-06-01 Thread JannaB

Duh.a different view with a different method in the controller.

On Jun 1, 1:13 pm, JannaB  wrote:
> I am wondering how to handle this: I have a model, 'users'. The table
> can be edited. So far, so good, standard CRUD on a given model,
> standard views, etc.
>
> One of the fields in the users table is a text field for their
> whereabouts, with info put in by the users themselves. I want a
> different, separate view in my application, that shows only ther
> whereabouts of a select user. So, in this second view, a user picks a
> different user to see where he or she is.
>
> How does you handle this in the Rails MVC design? I already have a
> controller and a view for users (where you CRUD on the user). How do
> you handle different required functionality/view like this? Thanks,
> Janna
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] multiple controllers/views for one model

2009-06-01 Thread JannaB

I am wondering how to handle this: I have a model, 'users'. The table
can be edited. So far, so good, standard CRUD on a given model,
standard views, etc.

One of the fields in the users table is a text field for their
whereabouts, with info put in by the users themselves. I want a
different, separate view in my application, that shows only ther
whereabouts of a select user. So, in this second view, a user picks a
different user to see where he or she is.

How does you handle this in the Rails MVC design? I already have a
controller and a view for users (where you CRUD on the user). How do
you handle different required functionality/view like this? Thanks,
Janna
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: Event Calendar in Rails

2009-06-01 Thread Rick DeNatale

On Mon, Jun 1, 2009 at 10:45 AM, lyntaff  wrote:
>
> Thanks so much.
>
> This is the perfect solution.
>

Note that the latest version of this is on github

http://github.com/topfunky/calendar_helper/tree/master

-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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] IE6 CSS and Rails Routes

2009-06-01 Thread bhan...@hcinsight.com

I dont know if anyone has come across this issue.

I have 2 different layouts for my app. both contain the same partial
with the same CSS files in the head.

in that i also have a IE6 CSS Hack file. Pretty standard.

The Problem in IE6
My issue is this. on any of my main pages that have named routes like
so
  map.privacy 'privacy-policy', :controller => "information", :action
=> "privacy_policy"
  map.admin 'dashboard', :controller => "admin", :action =>
"dashboard"
  map.home 'home', :controller => "information", :action => "home"
  map.search 'search', :controller => "information", :action =>
"search"

the CSS is picked up fine. but if i go to an action like /information/
home (this is in the url vs just home), where the controller is
listed. The CSS breaks and doesnt render the page correctly. But...
The file is still listed in the source(view source)..

very strange. any help would be great.

Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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] [ANN] ri_cal 0.5.3 Released

2009-06-01 Thread Rick DeNatale

ri_cal version 0.5.3 has been released!

* 
* 

A new Ruby implementation of RFC2445 iCalendar.

The existing Ruby iCalendar libraries (e.g. icalendar, vpim) provide
for parsing and generating icalendar files,
but do not support important things like enumerating occurrences of
repeating events.

This is a clean-slate implementation of RFC2445.

A Google group for discussion of this library has been set up
http://groups.google.com/group/rical_gem

Changes:

### 0.5.3 - 1 June, 2009
 * Improved performance of time zone enumeration, TimeZonePeriod now
caches occurrences
 * Added a profiling directory which contains ruby programs which
benchmark and/or profile performance
### 0.5.2
 * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/11
   Export folding is not UTF-8 Safe
### 0.5.1
 * Fixed README to acknowledge release on RubyForge
### 0.5.0 rubyforge release candidate Tue May 26 10:26:43 2009 -0400
 * Added OccurrenceEnumerator#zulu_occurrence_range
### 0.0.11 Sat May 23 18:24:57 2009 -0400
 * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/5
 * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/9
### 0.0.10
 * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/8
### 0.0.9
  * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/4
Missing comparison methods in PropertyValue::Date
  * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/6
Type of dtstart and dtend (DATE or DATETIME) now preserved on enumeration
### 0.0.8
  * Fixed http://rick_denatale.lighthouseapp.com/projects/30941-ri_cal/tickets/1
EXDATE and RDATE now pick up the timezone from DateTime, Time, and
TimeWithZone values
  * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/2
Missing arithmetic methods in PropertyValue::Date
  * Fixed http://rick_denatale.lighthouseapp.com/projects/30941/tickets/3
   Components with no recurrence rules or rdate properties failed
on enumeration, they now
   will enumerate a single occurrence
### 0.0.7
 * Fixed a bug relating to properly recognizing ActiveRecord::TimeWithZone
 * DATETIME propertyvalues will now return an instance of TimeWithZone
instead of DateTime when
   activesupport is present, and it is appropriate. See the README for details
### 0.0.6
 * Added rake tasks to run specs with either the tzinfo gem or
activesupport (<=2.2)
 * Default rake task now runs both of these
### 0.0.5
 * Fixed a bug in occurrence enumeration reported by paulsm on github
### 0.0.4
 * Fixed a bug in imported timezones reported by paulsm on github
### 0.0.3
 * Added tzid method to Ruby Time and DateTime instances, and to
ActiveRecord::TimeWithZone if it is defined this method is used to
determine the desired
timezone when an instance of one of these classes is given as the
value of a datetime property.  If the tzid is nil then the default
tzid is used,
if it is set to :floating then the property will be a floating time.
 * Removed the ability to pass an array with a tzid string and a
date-time since the above made it unnecessary
 * The ruby datetime property returned from the ruby_value method on
the DateTime property will return an instance of ::DateTime with:
   ** The proper utc offset
   ** The tzid set to the right tzid
 * Made exdate/rdate building possible
 * Added a default_tzid attribute to the Calendar component, if this
attribute is not set for a particular calendar it will delegate to the
default set
for the DateTime property class.
 * Added fix patches from
   ** http://github.com/kjwierenga/ri_cal
   ** http://github.com/wesmaldonado/ri_cal

### 0.0.2
 * Fixed gemspec
## 0.0.1

* 
* 


-- 
Rick DeNatale

Blog: http://talklikeaduck.denhaven2.com/
Twitter: http://twitter.com/RickDeNatale
WWR: http://www.workingwithrails.com/person/9021-rick-denatale
LinkedIn: http://www.linkedin.com/in/rickdenatale

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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] Specific exceptions for database errors: please speak up

2009-06-01 Thread Michael Schuerig


With ActiveRecord as it currently is, you get the same error for 
anything that might go wrong in the database, 
ActiveRecord::InvalidStatement. That's rather undistinctive, considering 
that there are some problems only the database server can recognize, in 
particular violated uniqueness and foreign key constraints.

If specific exceptions for these tow latter error conditions would help 
you in your code, or if you are interested in the topic in general, 
please review the following ticket and patch

https://rails.lighthouseapp.com/projects/8994/tickets/2419-raise-
specific-exceptions-for-violated-database-constraints

Please state your opinion and/or support, for otherwise the issue might 
be delayed interminably.

Thanks,
Michael

-- 
Michael Schuerig
mailto:mich...@schuerig.de
http://www.schuerig.de/michael/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] Engine Yard Adds JRuby Support -- http://bit.ly/MALvT

2009-06-01 Thread LJMecca

Today at Java One, Engine Yard is announcing support for JRuby. This
means that people will soon be able to select JRuby as a runtime
option in the Engine Yard Cloud, and subsequently on the Engine Yard
private cloud for cluster and slice customers. Engine Yard is excited
to partner with Charlie Nutter and Tom Enebo and the broader JRuby
team to make this happen.

Check out the full blog post here: http://bit.ly/MALvT
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: shorten a link

2009-06-01 Thread Pardee, Roy

Can you post a sample @article.url that results in blank .host output from 
URI.parse?

-Original Message-
From: rubyonrails-talk@googlegroups.com 
[mailto:rubyonrails-t...@googlegroups.com] On Behalf Of Sean Six
Sent: Thursday, May 28, 2009 8:53 PM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Re: shorten a link


I have @article.url and I want to parse that url.  When I tried:
@homepage = URI.parse(@article.url).host in the controller I simply got a blank 
output.

--
Posted via http://www.ruby-forum.com/.



GHC Confidentiality Statement

This message and any attached files might contain confidential information 
protected by federal and state law. The information is intended only for the 
use of the individual(s) or entities originally named as addressees. The 
improper disclosure of such information may be subject to civil or criminal 
penalties. If this message reached you in error, please contact the sender and 
destroy this message. Disclosing, copying, forwarding, or distributing the 
information by unauthorized individuals or entities is strictly prohibited by 
law.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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 and RoR Setup Frustrations

2009-06-01 Thread Pardee, Roy

It's not an IDE, but I really like the 'e' text editor for ruby/rails 
development on windows.  Google for 'e text editor' & you'll find it.  It's a 
textmate clone (or started out that way anyway).

HTH,

-Roy

-Original Message-
From: rubyonrails-talk@googlegroups.com 
[mailto:rubyonrails-t...@googlegroups.com] On Behalf Of J. D.
Sent: Saturday, May 30, 2009 5:40 AM
To: rubyonrails-talk@googlegroups.com
Subject: [Rails] Re: Ruby and RoR Setup Frustrations


Jruby is not for me - it looks more like a pre-packaged version that is not 
1.9.1 and researching it (many say it's slow).  I need an IDE that is going to 
work with 1.9.1.

--
Posted via http://www.ruby-forum.com/.



GHC Confidentiality Statement

This message and any attached files might contain confidential information 
protected by federal and state law. The information is intended only for the 
use of the individual(s) or entities originally named as addressees. The 
improper disclosure of such information may be subject to civil or criminal 
penalties. If this message reached you in error, please contact the sender and 
destroy this message. Disclosing, copying, forwarding, or distributing the 
information by unauthorized individuals or entities is strictly prohibited by 
law.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: ArgumentError - Unable to rectify please help

2009-06-01 Thread Rick

What's going on in line 105 of accounts_controller.rb?  Also, is there
any information in the log file that corresponds to the failure?

On Jun 1, 8:47 am, Aslam Syed 
wrote:
> Hello,
>
> I am stuck in a problem which I am unable to understand. I am trying to
> send an email, which I have done before, after user registers himself on
> a website. User provides email address which he has to confirm before
> getting any further communication. I have to do three things before the
> user object is saved, like creating some other records and sending email
> to confirm email, in a transaction. But, rails is throwing some error
> (ArgumentError (interning empty string)) while calling
> Mailer.deliver_confirm(email, code).
>
> The stack trace is athttp://pastie.org/496446
>
> Please provide suggestions as where I am going wrong. I am using
> Rails-2.3.2 and Ruby-1.8.7 this time.
> --
> 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: Event Calendar in Rails

2009-06-01 Thread lyntaff

Thanks so much.

This is the perfect solution.

On Jun 1, 5:47 am, nodoubtarockstar 
wrote:
> Try calendar_helper Rails plugin. I'm using this in my events-based
> app right now and love it! It adds appropriate classes to your table
> cells and allows you to add your own classes as well, if you'd rather.
> Plus: No javascript necessary. :)
>
> http://agilewebdevelopment.com/plugins/calendar_helper
>
> In my app, I display the event type, the comedian name with a link to
> edit, ticket price and showtime:
>
> controller:
>
> @year = params[:year].blank? ? Date.today.year : params[:year].to_i
> @month = params[:month].blank? ? Date.today.month : params
> [:month].to_i
> @events = Event.all
>
> view:
>
> <%= calendar({:year => @year, :month => @month}) do |d|
>         cell_text = "#{d.mday}"
>         cell_attrs = {:class => 'day'}
>         @events.each do |e|
>                 if e.showtime.mday == d.mday
>                         cell_text << link_to ( e.comedian.full_name, :action 
> => 'edit', :id
> => e ) << ""
>                         cell_text << e.event_type << ""
>                         cell_text << e.ticket_price << ""
>                         cell_text << e.showtime << ""
>                         cell_attrs[:class] = 'event_date'
>                 end
>         end
>         [cell_text, cell_attrs]
> end
> %>
>
> On May 31, 12:14 pm, lyntaff  wrote:
>
> > Hi,
>
> > I'm looking to develop a dynamic event calendar for a rails
> > application. I found some nifty little embeddable calendars in jQuery
> > and Moo Tools that use Json feeds but they seem to conflict with some
> > features that I have already developed using prototype.
>
> > Is there a rails plugin that I can work with or an embeddable
> > prototype solution that I can feed with xml or json?
>
> > If anybody has any advice or tips please let me know.
>
> > Thanks in advance.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ruby 1.9.1, cygwin & rails 2.3.2: undefined method camelize

2009-06-01 Thread danmack-gmail

Thanks for the tip.  I already have that package installed so the
problem might be that my private (/opt/ruby.../)  copy of ruby didn't
see or detect the iconv stuff when I built it from the source code.

I don't see the ruby-iconv package on cygwin so there must be another
package or build option I'm missing there.

Dan

On May 29, 6:11 pm, John D  wrote:
> simply install ruby-iconv
> (http://john.vipvip.com/blog/?p=71)
>
> On 26 май, 22:21, dmack  wrote:
>
>
>
> > I tried to get this working and ran into a problem:
>
> >  - latest cygwin
> >  - ruby 1.9.1p129 (same problem with p0).   install in /opt/ruby19
> >  - rails 2.3.2
>
> > 1)  Installed ruby 1.9.1p129 with:  --prefix=/opt/ruby19.  No errors
> > or problems.  make install worked.
>
> > 2)  gem install rails
>
> >   No problem, rails installs just fine in the /opt/ruby19 hierarchy.
>
> > 3)  Attempt to create a new rails application:  FAILED
>
> >     (cygwin) % rails testapp
> >     undefined method `camelize' for "app":String
>
> >     The back-trace:
>
> >     undefined method `camelize' for "app":String
> >   /opt/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails_generator/
> > spec.rb:29:in `class_name'
> >   /opt/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails_generator/
> > spec.rb:38:in `block in lookup_class'
> >   /opt/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails_generator/
> > spec.rb:36:in `each_object'
> >   /opt/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails_generator/
> > spec.rb:36:in `lookup_class'
> >   /opt/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails_generator/
> > spec.rb:18:in `klass'
> >   /opt/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails_generator/
> > lookup.rb:140:in `instance'
> >   /opt/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.2/lib/rails_generator/
> > scripts.rb:31:in `run'
> >   /opt/ruby19/lib/ruby/gems/1.9.1/gems/rails-2.3.2/bin/rails:18:in
> > `'
> >   /opt/ruby19/bin/rails:19:in `load'
> >   /opt/ruby19/bin/rails:19:in `'
>
> > Anyone have any ideas on how this could be fixed?
>
> > If I use a 1.8.x version of ruby, everything works fine.
>
> > ???
>
> > 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: autocomplete lookup speedup

2009-06-01 Thread nodoubtarockstar

Sorry, I got the conditions backwards, it was late :) And I also
didn't replace my test data with your erb...

> FasterCSV.foreach('CIS.csv') do |row|
>   port,ip,circuitid,node,eqpt,org = row
>   if connection.select_count("select count(1) from configuration_items
> ci where ci.name='#{port}'") > 0
> update configuration_items ci set ci.name='#{port}', ci.org_id=
> (select id from organizations o where o.name='#{org}'), ci.equipment_id=
> (select id from equipments e where e.name='#{eqpt}'), ci.ip_id=(select id
> from ips i where i.name='#{ip}'), ci.circuitid=4, ci.site_id=(select
> id from sites s where s.name='#{node}') where ci.name='#{port}'
>   else
> insert into configuration_items (name, org_id, equipment_id,
> ip_id, circuitid, site_id) select '#{port}', (select id from
> organizations o where o.name='#{org}'), (select id from equipments e
> where e.name='#{eqpt}'), (select id from ips i where i.name='#{ip}'),
> (select '#{circuit}'), (select id from sites s where s.name='#{node}')
>   end
> end

On Jun 1, 12:06 am, nodoubtarockstar 
wrote:
> First, your find_or_creates are just a hack to not throw a runtime
> error if you were to try to call id on nil , while also setting
> conditions for your finder... Either way,
>
> Honestly, in my opinion, you'd be better off doing this in pure sql --
> using Rails for this type of stuff is sometimes too slow :-/
> Especially since you're not really using Rails for anything except the
> getters/setters, it's not like you're performing operations on any of
> your queries, you're just finding records and setting field values
>
> This is just an "initial" stab at what you're looking at (in MySQL) --
> could probably be beefed up a ton more, who knows:
> FasterCSV.foreach('CIS.csv') do |row|
>   port,ip,circuitid,node,eqpt,org = row
>   if connection.select_count("select count(1) from configuration_items
> ci where ci.name='#{port}'") > 0
>     insert into configuration_items (name, org_id, equipment_id,
> ip_id, circuitid, site_id) select '#{port}', (select id from
> organizations o where o.name='#{org}'), (select id from equipments e
> where e.name='#{eqpt}'), (select id from ips i where i.name='#{ip}'),
> (select '#{circuit}'), (select id from sites s where s.name='#{node}')
>   else
>     update configuration_items ci set ci.name='1234', ci.org_id=
> (select id from organizations o where o.name='test'), ci.equipment_id=
> (select id from equipments e where e.name='test'), ci.ip_id=(select id
> from ips i where i.name='test 4'), ci.circuitid=4, ci.site_id=(select
> id from sites s where s.name='test 2') where ci.name='test'
>   end
> end
>
> This could *possibly* be done in one query with an on duplicate key
> update, but I'm honestly not quite familiar enough with MySQL to do
> this complex of a query with DKU, I'm used to just doing things like
> insert or increment with DKU :).
>
> Anyway, run that in query browser or something and see how the times
> compare when you're not doing any Rails lookups...
>
> Cheers!
>
> On May 31, 12:09 pm, Chris Habgood  wrote:
>
> > Well this is crazy.  I do most of my dev work on my computer I use as I work
> > from home.  Running Vista I was able to insert 388,000 records in 2:40
> > mins.  I hesitated trying to do it on my laptop.  BUT!!  I am running winxp
> > on it and I inserted 389,000 records in 40 mins.  WOW!  also in winxp the
> > autocomplete lookup runs much faster in XP than Vista.  Also it involves
> > putting repetitive data in the ier own tables for better normalization.
> > This is really more of a test to see how it compares to another system we
> > use(JAVA) for doing data uploads.
>
> > FasterCSV.foreach('CIS.csv') do |row|
> >     port,ip,circuitid,node,eqpt,org = row
>
> >     ip1 = Ip.find_or_create_by_name(ip).id
> >     node1 = Site.find_or_create_by_name(node).id
> >     ci = ConfigurationItem.find_by_name(port)
> >     eq = Equipment.find_or_create_by_name(eqpt).id
> >     organ = Organization.find_or_create_by_name(org).id
> >     if ci.nil?
> >         ConfigurationItem.create(:name => port, :org_id => organ
> > ,:equipment_id => eq ,:ip_id => ip1, :circuitid => circuitid, :site_id =>
> > node1)
> >     else
> >         ci.update_attributes(:name => port, :org_id => organ , :equipment_id
> > => eq,  :ip_id => ip1, :circuitid => circuitid, :site_id => node1)
>
> >     end
> > end
>
> > On Sat, May 30, 2009 at 5:12 PM, Conrad Taylor  wrote:
> > > 2009/5/30 Maurício Linhares 
>
> > >> Have you tried to add a :limit clause to your select statement?
>
> > >> Maybe show only the first 15 results and make sure there's an index at
> > >> the column being searched for.
>
> > >> -
> > >> Maurício Linhares
> > >>http://alinhavado.wordpress.com/(pt-br) |http://blog.codevader.com/(en)
>
> > >> On Sat, May 30, 2009 at 3:08 PM, Me  wrote:
>
> > >> > Is there anything I can do to speed up the query of a table that has
> > >> > 380,000 entries and will only get bigger?
>
> > >> > I tried the recipe in th

[Rails] Re: nested forms with select lists

2009-06-01 Thread anrake

Thanks. Somewhat edited, it basically looks like this.

MODEL:

class Cpicture < ActiveRecord::Base
  belongs_to :historicsite
  has_many :tags, :dependent => :destroy
  accepts_nested_attributes_for :tags, :allow_destroy => true,
  :reject_if => proc { |attrs| attrs.all? { |k, v|
v.blank? }}
end


VIEW: part of edit.html.erb
<% cpform.fields_for :tags do |tag_form| %>
<%= tag_form.select('tag', 'tag_group', [["value_1","value1"],
["value_2","value2"], ["value_3","value3"]]) %>
<%= tag_form.select('tag', 'tag_name', [["value_1","value1"],
["value_2","value2"], ["value_3","value3"]]) %>

<% unless tag_form.object.nil? || tag_form.object.new_record? %>
  <%= tag_form.label '_delete', 'Remove:' %>
  <%= tag_form.check_box '_delete' %>
<% end %>
<% end %>

CONTROLLER:

  def edit
@cpicture = Cpicture.find(params[:id])
2.times {...@cpicture.tags.build}
  end

  def update
@cpicture = Cpicture.find(params[:id])
if @cpicture.update_attributes(params[:cpicture])
  flash[:notice] = 'Cpicture was successfully updated.'
  redirect_to :action => 'show', :id => @cpicture
else
  render :action => 'edit'
end
  end



On Jun 1, 1:53 pm, nodoubtarockstar 
wrote:
> Can you possibly post some sample code so that we can see how your
> select lists are defined and how your controller is attaching the
> categories to your object? It might be a fairly easy fix to point out.
>
> Cheers!
>
> On May 30, 10:37 pm, anrake  wrote:
>
>
>
> > I'd like to use a drop down select field to add multiple categories to
> > my model (has_many relationship) using nested forms in Rails 2.3.2.  I
> > can get it to work fine with straight text fields, but no matter what
> > I do with select elements I always end up with "undefined method
> > `merge' for #"
>
> > Does anyone have a working example of using nested forms with select?
>
> > Thank you
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to use fusion charts in ror

2009-06-01 Thread diegocal...@gmail.com

Are you still having problems?

There are many ways to display the chart but the one I've used and
works fine for me is to create dinamically the XML using a builder and
then to render it in the view. You just need to include the js file
under /public/javascript/ and to include the SWF file under public/
FusionCharts/



On May 26, 8:01 am, Kiran Mandava 
wrote:
> hi this is kiran can anyone help how to use angular fusion charts in ror
> iam using rails 1.2.6 version   do i need to use any plugin for angular
> fusion charts
> --
> 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: Handling multiple form data

2009-06-01 Thread charan

thanx for the reply

its not that way

let me explain u..

if the user submits the form (submitted data stored into db) and moves
to next form ,now the user press back button and again press the
submit button.???.now the data is stored 2 times in DB



im planning to handle in such a way that,all the form data to store in
objects, at the end of all forms the data should be written into DB


chandra sekhar

On May 31, 8:53 pm, Maurício Linhares 
wrote:
> If you did a redirect after receiving the posted form, the user will
> be redirected to the form page, it will not re-submit the data.
>
> -
> Maurício Linhareshttp://alinhavado.wordpress.com/(pt-br) 
> |http://blog.codevader.com/(en)
>
> On Sun, May 31, 2009 at 3:04 AM, charan  wrote:
>
> > HI guys
>
> > I am using different forms with respective controller,model and
> > view.If the user press back button in the browser,after submitting
> > the form data.How do we handle such scenario..
>
> > chandra sekhar
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: Calendar in Rails

2009-06-01 Thread Joao Silva

Check out http://github.com/p8/table_builder/tree/master. It works 
similar to form_for. It requires objects with a method that returns a 
date.

  <% calendar_for(@tasks, :year => @year, :month => @month) do |t| %>
<%= t.head('mon', 'tue', 'wed', 'thu', 'fri', 'sat', 'sun') %>
<% t.day(:day_method => YOUR_DATE_METHOD) do |day, tasks| %>
  <%= day.day %>
  <% tasks.each do |task| %>
  <%= h(task.name) %>
<% end %>
  <% end %>
<% end %>
  <% end %>
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] radio_button_tag checked='checked'

2009-06-01 Thread Chetan Thorat

Hello,


I have 3 radio buttons,

<%= radio_button_tag('method', 'auto', checked = 'checked',
options = {:onclick => "Element.show('avsAutoWrapper');
Element.hide('avsCustomWrapper'); Element.hide('avsLocalWrapper');"})
%>Auto

<%= radio_button_tag('method', 'custom', checked = false,
options = {:onclick => "Element.hide('avsAutoWrapper');
Element.show('avsCustomWrapper'); Element.hide('avsLocalWrapper');"})
%>Custom

<%= radio_button_tag('method', 'local', checked = false,
options = {:onclick => "Element.hide('avsAutoWrapper');
Element.hide('avsCustomWrapper'); Element.show('avsLocalWrapper');"})
%>Local

Every radio button has its respective text field.
I want radio button Auto to be checked default.

And these are their 's


<%= render(:partial => "a_b_auto", :object => @product_build) %>



<%= render(:partial => "a_b_custom", :object => @Product_build) %>



<%= render(:partial => "a_b_local", :object => @product_build) %>




Now when the application starts and the page containing this three radio
buttons display at the very first time,I can see all the three text
fields of all of these radio buttons,which I don't want.

Just the text field of respective radio button must be displayed.
But this is not happening..
I had also tried the following format of radio buttons

<%= radio_button_tag('method', 'local', checked = true,
options = {:onclick => "Element.hide('avsAutoWrapper');
Element.show('avsCustomWrapper'); Element.hide('avsLocalWrapper');"})
%>Custom


and

<%= radio_button_tag('method', 'local', true,
options = {:onclick => "Element.hide('avsAutoWrapper');
Element.show('avsCustomWrapper'); Element.hide('avsLocalWrapper');"})
%>Custom

but it wont work.


Please help me.

Thanks

Chetan.
-- 
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 mysql error

2009-06-01 Thread Gourav Tiwari

Thanks for your reply Vipin,

I am able to connect to Mysql through command prompt and mysql query
browser.

Also, I am able to connect to a remote system by mysql query browser
tool.
I have copied ibmySQL.dll from MYSQL_INSTALL/bin  forlder to
RUBY_INSTALL/bin folder

I have mysql gem installed 2.7.1

but it still doesn't work.

-gourav

On Jun 1, 5:28 pm, Vipin  wrote:
> On Jun 1, 4:44 pm, Gourav Tiwari  wrote:
>
>
>
> > Hi,
>
> > I am getting a mysql error while running a ruby file on my system
> > (Windows):
>
> > D:/ruby/lib/ruby/1.8/mysql.rb:453:in `read': Client does not support
> > authentication protocol requested by server; consider upgrading MySQL
> > c
> > lient (Mysql::Error)
> >         from D:/ruby/lib/ruby/1.8/mysql.rb:130:in `real_connect'
> >         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > active_record/connection_adapters/mysql_adapter.rb:576:in `connect'
> >         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > active_record/connection_adapters/mysql_adapter.rb:204:in `initialize'
> >         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > active_record/connection_adapters/mysql_adapter.rb:76:in `new'
> >         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > active_record/connection_adapters/mysql_adapter.rb:76:in
> > `mysql_connectio
> > n'
> >         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > active_record/connection_adapters/abstract/connection_pool.rb:223:in
> > `sen
> > d'
> >         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > active_record/connection_adapters/abstract/connection_pool.rb:223:in
> > `new
> > _connection'
> >         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > active_record/connection_adapters/abstract/connection_pool.rb:245:in
> > `che
> > ckout_new_connection'
> >          ... 16 levels...
> >         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > active_record/base.rb:1991:in `all_attributes_exists?'
> >         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> > active_record/base.rb:1847:in `method_missing'
> >         from test1.rb:28:in `select_type'
> >         from test1.rb:39
>
> > I have Ruby 1.8.6 and Mysql Server 5.0 installed. I also have gone
> > through 
> > google:http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/198795htt..
>
> > but it did not help. Do I need to make any configuration for this?
>
> > Thanks in advance
> > -gourav
>
> Can you verify if following things are in proper place.
>
> 1. Are you able to connect to mysql otherwise on your system.
> 2. Have you done $gem install mysql
> 3. Copy libmySQL.dll from MYSQL_INSTALL/bin  forlder to RUBY_INSTALL/
> bin folder
> 3. Verify database.yml has your password
>
> vipin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: using attachment fu in masse

2009-06-01 Thread holden

nevermind found this lurking in the documentation... i suppose i
should have read it better before looking else where... ;-(

#!/usr/bin/env ./script/runner

# required to use ActionController::TestUploadedFile
require 'action_controller'
require 'action_controller/test_process.rb'

path = "./public/images/x.jpg"

# mimetype is a string like "image/jpeg". One way to get the mimetype
for a given file on a UNIX system
# mimetype = `file -ib #{path}`.gsub(/\n/,"")

mimetype = "image/jpeg"

# This will "upload" the file at path and create the new model.
@attachable = AttachmentMetadataModel.new(:uploaded_data =>
ActionController::TestUploadedFile.new(path, mimetype))
@attachable.save



On Jun 1, 2:46 pm, Franco Catena  wrote:
> You can try with the example in the attachment_fu home (http://
> github.com/technoweenie/attachment_fu/tree/master):
>
> i.uploaded_data = ActionController::TestUploadedFile.new(file_path,
> mimetype)
>
> Regards.
>
> Franco Catena.
>
> On Jun 1, 6:23 am, holden  wrote:
>
> > I tried using ActionController::UploadedStringIO.new( data )
>
> > and it does create the files... but the images don't work.
>
> > Is data supposed to be the filepath?  ie. photos/joe.jpg ?
>
> > I also found an example of exactly what I want to do in the Practical
> > Rails Plugins book, but which is outdated using "temp_data ="  It
> > looks simple and perfect, what am I missing?
>
> >http://books.google.com/books?id=c1L4IzmUzicC&pg=PA49&lpg=PA49&dq=att...
>
> > On May 31, 11:22 pm, Maurício Linhares 
> > wrote:
>
> > > Here's how I'm doing it:
>
> > >         file = ActionController::UploadedStringIO.new( data ) #this is
> > > the real data
> > >         file.instance_variable_set( '@original_filename',
> > > "#{rand(1000)}_#{filename}" )
> > >         file.content_type = i.content_type
>
> > >         i.uploaded_data=( file )
> > >         i.save!
>
> > > -
> > > Maurício Linhareshttp://alinhavado.wordpress.com/(pt-br) 
> > > |http://blog.codevader.com/(en)
>
> > > On Sun, May 31, 2009 at 5:52 PM, holden  wrote:
>
> > > > Something like this almost work...
>
> > > > Discussion.new
> > > > (:name=>"test2", :location_id=>"1036", :image_attributes=>
> > > > [{ :uploaded_data=> File.new("/Users/holden/Desktop/pictures/
> > > > LionsFW.jpg") }], :website=>"testdsfdf", :geo=>"", :phone=>"test", 
> > > > :blurb=>"testdsfsdfsdf", :address=>"test", :hwID=>"test", 
> > > > :email=>"t...@aol.com")
>
> > > > undefined method `[]' for # > > > LionsFW.jpg
>
> > > > On May 31, 6:36 pm, holden  wrote:
> > > >> I'm trying to use attachment fu to add a large number of images at
> > > >> once using a script but i can't even get it to add an image from the
> > > >> console... the other documentation i've found no longer seems to work.
>
> > > >> Something like this doesn't work properly
>
> > > >> c = Image.new
> > > >> c.content_type = 'image/jpeg'
> > > >> c.filename = 'test.jpg'
> > > >> c.discussion_id = 7330
> > > >> c.uploaded_data = File.open('/Users/holden/Desktop/pictures/
> > > >> LionsFW.jpg')
> > > >> c.save
>
> > > >> It does save.. but the file doesn't get populated.
>
> > > >> All the previous documentatio circa 2007 says :temp_file but this is
> > > >> no longer available to i tried switching it to :uploaded_data, but
> > > >> that doesn't seem to work either
>
> > > >> also it want's the size and is a required field, but shouldn't this be
> > > >> automatically deduced.. providing it doesn't help either...
>
> > > >> Any suggestions would be a great help,
>
> > > >> Thanks,
>
> > > >> holden
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: Routing Error with Passenger for Images and stylesheets

2009-06-01 Thread John T.

John T. wrote:

> Oh, yeah, thought the config file would make it obvious. It's Apache 
> with Passenger. And I am pointing to the public directory:
> 
> Directory "/home/me/public_html/myapp/current/public

With thanks to Hongli Lai over on the Phusion Passenger Google Group, I 
got this sorted out. And for completeness and to help others this is 
what I did.

I set up a new directory under /var/www:

/var/www/myapp

and created a symlink from there to my app's public folder:

ln -s /home/me/public_html/myapp/current/public myapp

and changed my apache vhost file to be:


  ServerName myserver.com
  DocumentRoot /var/www/myapp
  
Options FollowSymLinks
AllowOverride None
Order allow,deny
Allow from all
  
  RailsBaseURI /myapp


and made sure to include:

config.action_controller.relative_url_root = '/myapp'

in my environment.rb file.

Hongli's description:

> /var/www/myapp should be a directory. Inside this
> directory there should be a 'myapp' symlink. Like this:

> /var/www/myapp/
> /var/www/myapp/myapp -> /home/me/public_html/myapp/current/public

> When you say "RailsBaseURI /something", then Phusion Passenger will
> look for a filesystem entry "$DOCUMENT_ROOT/something", and this
> *must* be a symlink to the 'public' directory of your Rails app. 

Hope this helps someone else!

jt
-- 
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] ArgumentError - Unable to rectify please help

2009-06-01 Thread Aslam Syed

Hello,

I am stuck in a problem which I am unable to understand. I am trying to
send an email, which I have done before, after user registers himself on
a website. User provides email address which he has to confirm before
getting any further communication. I have to do three things before the
user object is saved, like creating some other records and sending email
to confirm email, in a transaction. But, rails is throwing some error
(ArgumentError (interning empty string)) while calling
Mailer.deliver_confirm(email, code).

The stack trace is at http://pastie.org/496446

Please provide suggestions as where I am going wrong. I am using
Rails-2.3.2 and Ruby-1.8.7 this time.
-- 
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] ArgumentError (interning empty string)

2009-06-01 Thread Zufar

Hello,

I am trying to send an email out on registration for confirming and I
am thrown this error. I am unable to understand as nothing is nil in
the class which I am passing to the Mailer. Please do help me. The
stack trace follows:
ArgumentError (interning empty string):
  app/controllers/accounts_controller.rb:103:in `register'
  app/controllers/accounts_controller.rb:43:in `register'
  /usr/lib/ruby/1.8/mongrel.rb:159:in `process_client'
  /usr/lib/ruby/1.8/mongrel.rb:158:in `each'
  /usr/lib/ruby/1.8/mongrel.rb:158:in `process_client'
  /usr/lib/ruby/1.8/mongrel.rb:285:in `run'
  /usr/lib/ruby/1.8/mongrel.rb:285:in `initialize'
  /usr/lib/ruby/1.8/mongrel.rb:285:in `new'
  /usr/lib/ruby/1.8/mongrel.rb:285:in `run'
  /usr/lib/ruby/1.8/mongrel.rb:268:in `initialize'
  /usr/lib/ruby/1.8/mongrel.rb:268:in `new'
  /usr/lib/ruby/1.8/mongrel.rb:268:in `run'

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: using attachment fu in masse

2009-06-01 Thread Franco Catena

You can try with the example in the attachment_fu home (http://
github.com/technoweenie/attachment_fu/tree/master):

i.uploaded_data = ActionController::TestUploadedFile.new(file_path,
mimetype)

Regards.

Franco Catena.

On Jun 1, 6:23 am, holden  wrote:
> I tried using ActionController::UploadedStringIO.new( data )
>
> and it does create the files... but the images don't work.
>
> Is data supposed to be the filepath?  ie. photos/joe.jpg ?
>
> I also found an example of exactly what I want to do in the Practical
> Rails Plugins book, but which is outdated using "temp_data ="  It
> looks simple and perfect, what am I missing?
>
> http://books.google.com/books?id=c1L4IzmUzicC&pg=PA49&lpg=PA49&dq=att...
>
> On May 31, 11:22 pm, Maurício Linhares 
> wrote:
>
> > Here's how I'm doing it:
>
> >         file = ActionController::UploadedStringIO.new( data ) #this is
> > the real data
> >         file.instance_variable_set( '@original_filename',
> > "#{rand(1000)}_#{filename}" )
> >         file.content_type = i.content_type
>
> >         i.uploaded_data=( file )
> >         i.save!
>
> > -
> > Maurício Linhareshttp://alinhavado.wordpress.com/(pt-br) 
> > |http://blog.codevader.com/(en)
>
> > On Sun, May 31, 2009 at 5:52 PM, holden  wrote:
>
> > > Something like this almost work...
>
> > > Discussion.new
> > > (:name=>"test2", :location_id=>"1036", :image_attributes=>
> > > [{ :uploaded_data=> File.new("/Users/holden/Desktop/pictures/
> > > LionsFW.jpg") }], :website=>"testdsfdf", :geo=>"", :phone=>"test", 
> > > :blurb=>"testdsfsdfsdf", :address=>"test", :hwID=>"test", 
> > > :email=>"t...@aol.com")
>
> > > undefined method `[]' for # > > LionsFW.jpg
>
> > > On May 31, 6:36 pm, holden  wrote:
> > >> I'm trying to use attachment fu to add a large number of images at
> > >> once using a script but i can't even get it to add an image from the
> > >> console... the other documentation i've found no longer seems to work.
>
> > >> Something like this doesn't work properly
>
> > >> c = Image.new
> > >> c.content_type = 'image/jpeg'
> > >> c.filename = 'test.jpg'
> > >> c.discussion_id = 7330
> > >> c.uploaded_data = File.open('/Users/holden/Desktop/pictures/
> > >> LionsFW.jpg')
> > >> c.save
>
> > >> It does save.. but the file doesn't get populated.
>
> > >> All the previous documentatio circa 2007 says :temp_file but this is
> > >> no longer available to i tried switching it to :uploaded_data, but
> > >> that doesn't seem to work either
>
> > >> also it want's the size and is a required field, but shouldn't this be
> > >> automatically deduced.. providing it doesn't help either...
>
> > >> Any suggestions would be a great help,
>
> > >> Thanks,
>
> > >> holden
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] Quick question - access attributes through form helper?

2009-06-01 Thread Mark Dixon

So within a form_for/fields_for can I access the field attributes.
[code=ruby]<%= form.text_field :name %>#gives me a text box with the
value of :name %>
<%= form.label :name %>#gives me a label with 'name' when I need the
value of :name %>
  # Can I also do something
<%= form.text_field :category %>#gives me a text box with true or false
%>
 <% if :category %> # access an attribute in this way in order to affect
condition??[/code]
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Model structure based on unavailable data

2009-06-01 Thread Matt Jones

This is the more typical Rails idiom - it's how ActiveRecord generates
all kinds of things, from dynamic finders (find_all_by_foo) to
attribute methods.

--Matt Jones


On May 31, 7:58 pm, Brian  wrote:
> On May 31, 7:34 pm, Brian  wrote:
>
> > I'm writing a role-based security plugin for personal use in my apps.
> > The plugin will attach some helper methods to my models automatically
> > (when I run my new class method 'acts_as_a_foo').  Some of these...
>
> The other thought I had was that I could override missing_method and
> delay adding the new methods until they are actually used for the
> first time.  This definitely avoids the timing errors, but seems a
> little strange.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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 mysql error

2009-06-01 Thread Vipin




On Jun 1, 4:44 pm, Gourav Tiwari  wrote:
> Hi,
>
> I am getting a mysql error while running a ruby file on my system
> (Windows):
>
> D:/ruby/lib/ruby/1.8/mysql.rb:453:in `read': Client does not support
> authentication protocol requested by server; consider upgrading MySQL
> c
> lient (Mysql::Error)
>         from D:/ruby/lib/ruby/1.8/mysql.rb:130:in `real_connect'
>         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> active_record/connection_adapters/mysql_adapter.rb:576:in `connect'
>         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> active_record/connection_adapters/mysql_adapter.rb:204:in `initialize'
>         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> active_record/connection_adapters/mysql_adapter.rb:76:in `new'
>         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> active_record/connection_adapters/mysql_adapter.rb:76:in
> `mysql_connectio
> n'
>         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> active_record/connection_adapters/abstract/connection_pool.rb:223:in
> `sen
> d'
>         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> active_record/connection_adapters/abstract/connection_pool.rb:223:in
> `new
> _connection'
>         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> active_record/connection_adapters/abstract/connection_pool.rb:245:in
> `che
> ckout_new_connection'
>          ... 16 levels...
>         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> active_record/base.rb:1991:in `all_attributes_exists?'
>         from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
> active_record/base.rb:1847:in `method_missing'
>         from test1.rb:28:in `select_type'
>         from test1.rb:39
>
> I have Ruby 1.8.6 and Mysql Server 5.0 installed. I also have gone
> through 
> google:http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/198795http://stackoverflow.com/questions/436980/has-anyone-successfully-con...
>
> but it did not help. Do I need to make any configuration for this?
>
> Thanks in advance
> -gourav


Can you verify if following things are in proper place.

1. Are you able to connect to mysql otherwise on your system.
2. Have you done $gem install mysql
3. Copy libmySQL.dll from MYSQL_INSTALL/bin  forlder to RUBY_INSTALL/
bin folder
3. Verify database.yml has your password

vipin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] ruby mysql error

2009-06-01 Thread Gourav Tiwari

Hi,

I am getting a mysql error while running a ruby file on my system
(Windows):

D:/ruby/lib/ruby/1.8/mysql.rb:453:in `read': Client does not support
authentication protocol requested by server; consider upgrading MySQL
c
lient (Mysql::Error)
from D:/ruby/lib/ruby/1.8/mysql.rb:130:in `real_connect'
from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/mysql_adapter.rb:576:in `connect'
from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/mysql_adapter.rb:204:in `initialize'
from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/mysql_adapter.rb:76:in `new'
from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/mysql_adapter.rb:76:in
`mysql_connectio
n'
from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:223:in
`sen
d'
from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:223:in
`new
_connection'
from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/connection_adapters/abstract/connection_pool.rb:245:in
`che
ckout_new_connection'
 ... 16 levels...
from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/base.rb:1991:in `all_attributes_exists?'
from D:/ruby/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/
active_record/base.rb:1847:in `method_missing'
from test1.rb:28:in `select_type'
from test1.rb:39

I have Ruby 1.8.6 and Mysql Server 5.0 installed. I also have gone
through google:
http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-talk/198795
http://stackoverflow.com/questions/436980/has-anyone-successfully-connected-to-mysql-from-ruby

but it did not help. Do I need to make any configuration for this?

Thanks in advance
-gourav
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: Can't get around this Routing Error

2009-06-01 Thread Jay Covington

Frederick Cheung wrote:
> On May 31, 10:45�pm, Jay Covington 
> wrote:
>> (127.0.0.1:3000/user,
>>
>> I receive the error below:
>>
>> --- 
>> --
>> ActionController::RoutingError in User#index
>>
>> edit_listhub_url failed to generate from {:action=>"edit",
>> :controller=>"listhubs", :id=>nil}, expected: {:action=>"edit",
>> :controller=>"listhubs"}, diff: {:id=>nil}
> 
> This looks suspicious - is @listhub non nil in the case where you are
> rendering this partial ?
> 
> Fred

Yea, for some reason I erroneously added "@" to @listhub and was too 
tired to see it. The removal of this worked fine. Thanks!
-- 
Posted via http://www.ruby-forum.com/.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-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: Can't deploy using Git !!!!!

2009-06-01 Thread lpdahito

All that has been done...
I've no problem at all sshing into my instance and cloning the repo
from there...
It seems that the problem would be with capistrano...

On May 31, 8:27 am, Bharat  wrote:
> I think what you want to do is make sure that you can ssh (or git
> clone) from the machine (in this EC2 machine) to git so that github's
> public key certificate can be added to the known_hosts file of your
> "deploy" user (the user that capistrano runs as on EC2 machine) so
> that EC2 machine to Github connection is a trusted connection.  I had
> no ends of trouble because of this since I forgot to do this.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Form validation on non-CRUD activities

2009-06-01 Thread Maurício Linhares

Here's what i use -
http://github.com/staugaard/active_record_base_without_table/tree/master

-
Maurício Linhares
http://alinhavado.wordpress.com/ (pt-br) | http://blog.codevader.com/ (en)



On Mon, Jun 1, 2009 at 5:20 AM, Tom R  wrote:
>
> Hi there,
>
> I'm relativity new to Rails (I've been eying it for some time,
> though). I'm reasonably familiar with Ruby's syntax.
>
> When I pick up a new language, I like to make a simple blog. I'm
> focusing on the authentication at the moment. I am well aware of the
> existing plugins out there, but since this application will never see
> the light of day and I learning by rolling my own.
>
> Now, let's say I have a login form, how do I validate that? I'm not
> saving into  a model, or anything like that. At this stage, I'm just
> using a form_tag, and doing simple if params[:username] == '' in the
> controller. Very ugly indeed.
>
> What is the best way to validate a form (and get the nice error
> messages, like when you are scaffolding) when you are not necessarily
> saving data?
>
> Cheers.
> Tom.
>
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: counter_cache is making a redundant SELECT before UPDATE

2009-06-01 Thread Fernando Perez


> This is basically rails not knowing about inverse associations (which
> it will do in the next version).
> If you do do itself you should use increment_counter rather that doing
> what you show above (which has a race condition).
> 
> Fred

Thank you Frederick for your message :-)
-- 
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: counter_cache is making a redundant SELECT before UPDATE

2009-06-01 Thread Frederick Cheung



On Jun 1, 10:48 am, Fernando Perez 
wrote:
> Hmm, actually I just watched the railscasts about the counter_cache, and
> in his log he also has this redundant SELECT that he didn't even spot.
>
> So I guess this could be an additional feature added to Rails to save 1
> DB query.

This is basically rails not knowing about inverse associations (which
it will do in the next version).
If you do do itself you should use increment_counter rather that doing
what you show above (which has a race condition).

Fred

> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Can't get around this Routing Error

2009-06-01 Thread Ram

What does the partial contain? have u given @listhub any value for
this action that its failing in?

On Jun 1, 3:37 am, Frederick Cheung 
wrote:
> On May 31, 10:45 pm, Jay Covington 
> wrote:
>
>
>
> > Hi All,
>
> > I'm currently stuck trying to get a scaffold routed correctly. The line
> > of code causing me problems is:
>
> > (link_to 'Edit', edit_listhub_path(@listhub))
>
> > It works fine in 127.0.0.1:3000/listhubs.
>
> > However, when I try it in a partial in the "user" controller
> > (127.0.0.1:3000/user,
>
> > I receive the error below:
>
> > --- 
> > --
> > ActionController::RoutingError in User#index
>
> > edit_listhub_url failed to generate from {:action=>"edit",
> > :controller=>"listhubs", :id=>nil}, expected: {:action=>"edit",
> > :controller=>"listhubs"}, diff: {:id=>nil}
>
> This looks suspicious - is @listhub non nil in the case where you are
> rendering this partial ?
>
> Fred
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: counter_cache is making a redundant SELECT before UPDATE

2009-06-01 Thread Fernando Perez

Hmm, actually I just watched the railscasts about the counter_cache, and 
in his log he also has this redundant SELECT that he didn't even spot.

So I guess this could be an additional feature added to Rails to save 1 
DB query.
-- 
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] counter_cache is making a redundant SELECT before UPDATE

2009-06-01 Thread Fernando Perez

Hi,

I have the following code:

Message, belongs_to :topic, :counter_cache => true

topic = Topic.find_from_permalink(params[:id])

topic.messages.create(params[:message])

When the message gets created, then AR issues a supplemental SELECT to
retrieve the message's topic and then updates its messages_count. Why is
that happening?

If I do it manually:

if topic.messages.create(params[:message])
  topic.messages_count += 1
  topic.save!
end

Then I don't get this additional SELECT. Does the sql cache only work
when I do Topic.find(2) ?
-- 
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: sqlite db is note created with "rails" command.

2009-06-01 Thread Bosko Ivanisevic

It will be created once you do:

rake db:migrate

On Jun 1, 4:02 am, John Sun  wrote:
> When I try to create my rail demo application by following an example,
> there is no default database created under db directory? Is that
> normal?
>
> I do have all the sqlite3 stuff installed.
>
> Thanks,
> J.w.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: using attachment fu in masse

2009-06-01 Thread holden

I tried using ActionController::UploadedStringIO.new( data )

and it does create the files... but the images don't work.

Is data supposed to be the filepath?  ie. photos/joe.jpg ?

I also found an example of exactly what I want to do in the Practical
Rails Plugins book, but which is outdated using "temp_data ="  It
looks simple and perfect, what am I missing?

http://books.google.com/books?id=c1L4IzmUzicC&pg=PA49&lpg=PA49&dq=attachment+fu+console+creation&source=bl&ots=0LhR2tApt6&sig=Kufto1uWSuhThKpy-dzVCzybKOI&hl=en&ei=Ca4iSoHZBMyOsAa36NC3Bg&sa=X&oi=book_result&ct=result&resnum=1

On May 31, 11:22 pm, Maurício Linhares 
wrote:
> Here's how I'm doing it:
>
>         file = ActionController::UploadedStringIO.new( data ) #this is
> the real data
>         file.instance_variable_set( '@original_filename',
> "#{rand(1000)}_#{filename}" )
>         file.content_type = i.content_type
>
>         i.uploaded_data=( file )
>         i.save!
>
> -
> Maurício Linhareshttp://alinhavado.wordpress.com/(pt-br) 
> |http://blog.codevader.com/(en)
>
> On Sun, May 31, 2009 at 5:52 PM, holden  wrote:
>
> > Something like this almost work...
>
> > Discussion.new
> > (:name=>"test2", :location_id=>"1036", :image_attributes=>
> > [{ :uploaded_data=> File.new("/Users/holden/Desktop/pictures/
> > LionsFW.jpg") }], :website=>"testdsfdf", :geo=>"", :phone=>"test", 
> > :blurb=>"testdsfsdfsdf", :address=>"test", :hwID=>"test", 
> > :email=>"t...@aol.com")
>
> > undefined method `[]' for # > LionsFW.jpg
>
> > On May 31, 6:36 pm, holden  wrote:
> >> I'm trying to use attachment fu to add a large number of images at
> >> once using a script but i can't even get it to add an image from the
> >> console... the other documentation i've found no longer seems to work.
>
> >> Something like this doesn't work properly
>
> >> c = Image.new
> >> c.content_type = 'image/jpeg'
> >> c.filename = 'test.jpg'
> >> c.discussion_id = 7330
> >> c.uploaded_data = File.open('/Users/holden/Desktop/pictures/
> >> LionsFW.jpg')
> >> c.save
>
> >> It does save.. but the file doesn't get populated.
>
> >> All the previous documentatio circa 2007 says :temp_file but this is
> >> no longer available to i tried switching it to :uploaded_data, but
> >> that doesn't seem to work either
>
> >> also it want's the size and is a required field, but shouldn't this be
> >> automatically deduced.. providing it doesn't help either...
>
> >> Any suggestions would be a great help,
>
> >> Thanks,
>
> >> holden
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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] Form validation on non-CRUD activities

2009-06-01 Thread Tom R

Hi there,

I'm relativity new to Rails (I've been eying it for some time,
though). I'm reasonably familiar with Ruby's syntax.

When I pick up a new language, I like to make a simple blog. I'm
focusing on the authentication at the moment. I am well aware of the
existing plugins out there, but since this application will never see
the light of day and I learning by rolling my own.

Now, let's say I have a login form, how do I validate that? I'm not
saving into  a model, or anything like that. At this stage, I'm just
using a form_tag, and doing simple if params[:username] == '' in the
controller. Very ugly indeed.

What is the best way to validate a form (and get the nice error
messages, like when you are scaffolding) when you are not necessarily
saving data?

Cheers.
Tom.

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: Time.parse seems to fail

2009-06-01 Thread Frederick Cheung



On Jun 1, 9:29 am, Claus-christian Ude  wrote:
> Frederick Cheung wrote:
> > On May 30, 8:48 am, Colin Law  wrote:
> > If you are expecting dates in a particular format strptime is useful,
> > if not some sort of calendary widget is often a better idea.
>
> > Fred
>
> Well yes, I already do so (calendar_select_date), but I get in the
> controller-function as params the dd.mm. format. So
> update_attributes convert the date automaticly, but it do it wrong
> (mm.dd.), therefor I "repair" the Date.parse-Function.
>

if you're guarenteed that the format you get in the controller is
going to be dd.mm. then strptime is probably the easiest way
(although just tearing the string up with a regexp wouldn't be hard
either)

Fred
> mfg C-C
> --
> 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] Nested models and forms

2009-06-01 Thread Sahil Dave
Hi,

I have been trying to use the new nested models & forms feature in rails 2.3

#helper

def add_job_profile_link(name, form, vacancy)
link_to_function name do |page|
  profile = render(:partial => 'job_profile', :locals => { :f =>
form, :job_profile => vacancy.job_profiles.build })
  page << %{
$('job_profiles').insert({ bottom: "#{ escape_javascript profile }"});
  }
end
end

#view


   <%= render(:partial => 'job_profile', :locals => { :f => f,
:job_profile => @vacancy.job_profiles.build }) %>


   <%= add_job_profile_link("Add a job profile", f, @vacancy) %>


The above code is displaying the fields, but on submission picks up values
for just 2 nested models. I tried removing the default rendered partial, and
then it picks up just 1 set of values.
Am i doing something wrong over here?
Does @vacancy.job_profiles.build has different meanings in view and helper?


Regards

-- 
Sahil

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
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: Time.parse seems to fail

2009-06-01 Thread Claus-christian Ude

Frederick Cheung wrote:
> On May 30, 8:48�am, Colin Law  wrote:
> If you are expecting dates in a particular format strptime is useful,
> if not some sort of calendary widget is often a better idea.
> 
> Fred

Well yes, I already do so (calendar_select_date), but I get in the 
controller-function as params the dd.mm. format. So 
update_attributes convert the date automaticly, but it do it wrong 
(mm.dd.), therefor I "repair" the Date.parse-Function.

mfg C-C
-- 
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
-~--~~~~--~~--~--~---



  1   2   >