[Rails] Re: Making the 'Back' link look the same as form.submit "Sav

2009-03-10 Thread Robert Walker

Tom Z Meinlschmidt wrote:
> InventoryTrackers wrote:
>> Does anybody know how Rails paints that cool blue box around the <%=
>> form.submit "Save" %>
>> In most of my forms I've got a "Back" link ( ex: <%= link_to 'Back',
>> return_path %>.
> 
> try to use Safari browser :) apple.com/safari

Yes, If the OP is talking about the Mac OS X "focus ring" (light blue 
border surrounding the first responder) then yes, that's completely 
implemented by Safari and has nothing to do with Rails, HTML or CSS.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: How to store contents of table in Hash???

2009-03-10 Thread Robert Walker

Vrishali wrote:
> N now using the statement
> @companies = Company.find(:all)
> 
> 
> But now i dont understand how can i store these fetched values in hash-
>> 'places'
> 
> I dont want static values...

I'm not quite sure why you need to store the values from the 
ActiveRecords in a hash, but basically ActiveRecord uses a hash, or 
something like a hash, internally and it's easy to get to that using the 
attributes method:

places = []
@companies.each do |company|
  places << company.attributes
end

This will build an array of hashes just like what you had with the 
static values. But, like I said I don't know why you would need to do 
this. You could just use the ActiveRecords directly. And if you wanted a 
serialized version of them for some reason then JSON is a good format 
for that:

@companies.to_json

-- 
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 store contents of table in Hash???

2009-03-10 Thread Vrishali....

Hi evrybody..


I was storing the values in hash using..

 places = [
 {:address=>'555 Irving, San Francisco,
CA',:description=>'Irving',:image=>'/images/1.jpg'},
 {:address=>'1401 Valencia St, San Francisco,
CA',:description=>'Valencia',:image=>'/images/2.jpg'},
  ]


But now I want to take these values from database..I created ,
migrated table correctly...


N now using the statement
@companies = Company.find(:all)


But now i dont understand how can i store these fetched values in hash-
> 'places'

I dont want static values...


So can anybody please help me for 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: RoR on Bluehost

2009-03-10 Thread Paul Reitz

After a very long and stressful day, I finally found my problem 
(actually someone on the bluehost forum had the same problem:) )
in my database.yml file I had 'user' instead of 'username'. A complete 
n00b mistake on my part, but there it is in case some one gets the same 
error :)

-- 
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: polymorphic question

2009-03-10 Thread Sj Tib

Chris Habgood wrote:
> anybody?

It sounds like you will have to use an intermediate table that the 
circuits model will have a one-many relationship with and then use ports 
polymorphically in that intermediate table.
-- 
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] Making a user created in a complex (nested) form an admin.

2009-03-10 Thread Tony Tony

Hi all,

I'm using a nested form
(http://railscasts.com/episodes/73-complex-forms-part-1) to set up a
school + faculty user in a single form. Everything works great following
the above screencast. However, I've come to a temporary halt when trying
to make the first user (the same user that's created in the nested form
along with the school) an administrator. Making the first user of the
school an admin is a requirement.

My idea of how this *should* work is this:

def create
  @school = School.new(params[:school])
  @school.faculties.admin = true
  ...
end

Where admin is a field (boolean) in the table and the relationship with
school (has_many :faculties) and faculty model (belongs_to :school) is
working correctly. This obviously isn't working though. Probably because
the user isn't created yet when trying to look for @school.faculties.

Any suggestions on how to make this work? If you need any other info
please let me know and I'll post as soon as I can! Thanks!!


Thanks,
-Tony
-- 
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] Can you update a db record without first retrieving it?

2009-03-10 Thread Sj Tib

Folks,

I display a set of records to the user who can make changes to one or
more of those records. When the user saves the changes, I get them back
in an array that contains only the changed records - with both the
modified an unmodified attributes for each record. This array also has
the unique id for each record.

What is the best/fastest way for me to update the records in the db? Or
do I just have to iterate through the array, retrieving each record
again from the db and setting up the call to update_attributes by
retrieving each attribute individually from the array?

It feels so unlike rails to have to do that and sounds like there must
be a more efficient way to get all the changed data from the array to
the database perhaps in a single call.

Appreciate any pointers or help. I am using Rails 2.2 if that is a
factor in your answer.

Thanks,
-S
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Getting started, sort of

2009-03-10 Thread Brian Hogan

Hey, I wrote that :)

Should have just sent me an email directly, I'd have helped you get it
working.  I'll update the cookbook to reflect that issue. Thanks for
reminding me.

On Thu, Feb 26, 2009 at 10:50 PM, bachcole  wrote:
>
> I fixed the problem with Eric's original post.  Like I said, I am
> stupid.  End of this discussion.
> >
>

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: crypto in Rails 2.x?

2009-03-10 Thread Jeff Pritchard

Jeff Pritchard wrote:
> I need to encrypt some items in the database in a rails app.
> 
> I tried using the old "sentry" gem, but it doesn't seem to be surviving
> Rails 2.  The stuff I found for Active Crypto on the web appeared to be
> many years old.
> 
> What are folks using to encrypt db data via active record these days?
> 
> thanks,
> jp

I'm starting to question the validity of this whole notion.  It seems to 
be expected that one would encrypt database tables that hold sensitive 
information (like a user's health information for example).

Taking a step back from it though, what's the point?  The database and 
my app are all on the same server.  Nobody can see the database files 
unless they have access to my server.  Anybody who does have access to 
my server can look at the app to figure out how to read the encrypted 
database tables/columns.

So what is the supposed advantage of encrypting them in the first 
place

Sorry for playing my own devil's advocate here, but it just dawned on me 
that perhaps I was chasing a fool's errand.  Please enlighten me.

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

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



[Rails] Re: Disabling session cookie per-request in 2.3

2009-03-10 Thread bill walton

On Tue, 2009-03-10 at 18:52 -0700, Ryan wrote:

> Yeah, it's definitely being set, and I've put nothing in the session.
> As it turns out, just accessing a session value (@user_id = session
> [:user_id]) is enough to make Rails write the session cookie. This
> seems like a bug.

To me, also.

> I worked around this by calling session.include? first, but I
> shouldn't have to hit the hash twice just to avoid writing the session
> cookie.

Testing for an object's existence should not cause it to come into
being.  Kinda pees on the whole REST parade.




--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Disabling session cookie per-request in 2.3

2009-03-10 Thread Ryan

On Mar 10, 6:25 pm, Frederick Cheung 
wrote:

> Are you sure it's actually being set? rails 2.3 is only supposed to
> set the session cookie if you've actually put something in the
> session.

Yeah, it's definitely being set, and I've put nothing in the session.
As it turns out, just accessing a session value (@user_id = session
[:user_id]) is enough to make Rails write the session cookie. This
seems like a bug.

I worked around this by calling session.include? first, but I
shouldn't have to hit the hash twice just to avoid writing the session
cookie.

Seem like bug to you?

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



[Rails] setting up access rules

2009-03-10 Thread Carlos Santana

I am referring to this wonderful post:
http://pivotallabs.com/users/nick/blog/articles/272-access-control-permissions-in-rails/comments
for creating access rules for my application.

So from my controller and views I am calling method in user model as:
@currentuser.topic_admin?(topic)

### User model has this method:
def topic_admin?(topic)
  topic.can_admin?(self)
end


### Topic model has this method:
def can_admin?(user)
  valid_roles = %w{admin editor}
  if valid_roles.include?(user.role.name)
return true
  else
return false
  end
end
---

The @currentuser is returned by a method in topic controller:
def current_user
  @currentuser = User.find(session[:user])
end

Everything works fine as long as some user is logged in. If no one is
logged in then session has no data and I get error regarding nil.object
called...

How can I solve this problem? Am I going the wrong way? I wrote another
method to check if user is logged in and then only call current_user
method or topic_admin method. However, calling logged_in? method before
current_user is useless and calling it before topic_method means too
much code in the view. Any other alternatives? Any clues?

Thanks,
CS.
-- 
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: unit test model validations

2009-03-10 Thread Phlip

Michael Rigart wrote:

>   t.string  'name', :null => false
>   t.string  'address',  :null => false
>   t.string  'zip',  :null => false
>   t.string  'city', :null => false
>   t.string  'country',  :null => false
>   t.string  'phone',:null => true
>   t.string  'fax',  :null => true
>   t.string  'email',:null => false
>   t.integer 'status',   :null => false
>   t.boolean 'is_root',  :null => false, :default => false
>   t.boolean 'access_crm',   :null => false, :default => false
>   t.boolean 'access_project',   :null => false, :default => false
>   t.boolean 'access_dmail', :null => false, :default => false
>   t.boolean 'access_financial', :null => false, :default => false

Access looks like a separate table with a type.

How about, instead of retrofitting tests to existing features, you test-first 
the existence and behavior of this new type? Then test-first the database 
migration that copies your production data into it...



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Disabling session cookie per-request in 2.3

2009-03-10 Thread Frederick Cheung



On Mar 11, 1:17 am, Ryan  wrote:
> I need to disable the Set-Cookie: header that Rails 2.3 issues for
> certain requests, when the request is made to my API action from a non-
> browser client.
>
> I understand that the "session :off" option was removed, but not why
> or how I am now supposed to prevent this cookie from being set.
>
Are you sure it's actually being set? rails 2.3 is only supposed to
set the session cookie if you've actually put something in the
session.

Fred
> Is there a request.session_options value I can set? I didn't see
> anything in the ActionController::Session::CookieStore source.
>
> Thanks!
>
> Ryan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Disabling session cookie per-request in 2.3

2009-03-10 Thread Ryan

I need to disable the Set-Cookie: header that Rails 2.3 issues for
certain requests, when the request is made to my API action from a non-
browser client.

I understand that the "session :off" option was removed, but not why
or how I am now supposed to prevent this cookie from being set.

Is there a request.session_options value I can set? I didn't see
anything in the ActionController::Session::CookieStore source.

Thanks!

Ryan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: crypto in Rails 2.x?

2009-03-10 Thread Jeff Lewis

I'm not a cryptographer, but    One way you could do this,
depending on your app requirements, is to follow an asymmetric
encryption strategy using pub/priv keys, something like:

### gen pub/priv keys to use:

$ cd ./private
$ openssl genrsa -out asym_priv.key 2048
...
$ openssl rsa -in asym_priv.key -out asym_pub.key -pubout
...
$ chmod 400 asym_priv.key
$ chmod 444 asym_pub.key
$ cd ..

### cat ./app/model/cryptor.rb

require 'digest/sha2'
require 'openssl'

class Cryptor

  include Singleton

  ASYM_PUB_KEY = OpenSSL::PKey::RSA.new(IO.read("#{RAILS_ROOT}/private/
asym_pub.key"))
  ASYM_PRIV_KEY = OpenSSL::PKey::RSA.new(IO.read("#{RAILS_ROOT}/
private/asym_priv.key"))
  ...

  def Cryptor.asym_encrypt(str)
return Base64.encode64(ASYM_PUB_KEY.public_encrypt(str))
  end

  def Cryptor.asym_decrypt(str)
return ASYM_PRIV_KEY.private_decrypt(Base64.decode64(str))
  end
  ...
end

### and then test it out:

$ ./script/console
...

>> enc_str = Cryptor.asym_encrypt('testing 1 2 3')
=> "i4d/uc6w1NGCUQLspM7CMsvNMd
+4dFrx3yb0QhM4N3di6Yha8jeW5Ftx4ZA2\nnPn4AzhZPzCrQdds/ERP0Lb9X/
dzJaJt5Tyig12hl4EqlILTnSj9SlPatIr9\n2m9D0K416BRuCJaWOp0lhXIe1XCZisjKKhLhR1T3nH
+NjQnNx4HBFhrFOnSz
\nuWpNfQf8sYxhLiSiKwTy3WUPmSRHPgu8h5mIgtxjU12spf0NvbZEDzwP+/br
\nWMJNQ6rGSNP6smd3YahoQzYjNFn3v+YCjG497eIdHNOBN6LAnW+HoB1TD5qm
\ngJzuOIk1eownT9kfjiykR+lNmw1kNX3bzDqdBvsB8g==\n"

>> dec_str = Cryptor.asym_decrypt(enc_str)
=> "testing 1 2 3"

Using Base64 isn't necessary if your db tbls can handle binary, but it
can be a help when you're testing/debugging.  Also, the size of your
priv key in bits will definitely effect performance of encrypt/decrypt
process, so you'll want to choose according to needs, balancing
performance vs encrypt-strength.

And if such an asym strategy is just too slow for your needs, then you
could pursue a symmetric strategy instead, which would be much faster
in terms of performance, but more complex to implement (likely having
to persist the initialization vector -- iv -- val used when sym
encrypting some val for later use when sym decrypting that val again).

Jeff

On Mar 10, 8:15 am, Jeff Pritchard 
wrote:
> MaD wrote:
> > depends on what you are looking for. if want to have a one-way
> > function (for passwords and such) just try it like this:
>
> >   encrypted_item = Digest::SHA256.hexdigest( string_to_encrypt )
>
> > you could also use SHA1, SHA384, SHA512 depending on your need of
> > security.
>
> Thanks, but I need to decrypt it also.  It is "for your eyes only" user
> data.
>
> thanks,
> jp
> --
> 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: knowing when to go to multiple mongrel instances or dedicated server

2009-03-10 Thread Tom Z Meinlschmidt

Ed wrote:
> I have a rails app with a growing user base.  Right now it is on a
> single mongrel instance on a shared server.  Is there a quantifiable
> method I can use to measure when I need to add mongrel instances, or
> move to a dedicated server?  Are there rules of thumb for how many
> users or page hits an instance can support?  Or is it solely
> subjective, based on when the app starts to "feel" slow?

Ed, why not to move to phusion passenger? It's fast and intended for 
heavier load than mongrel (even in cluster)

tom

-- 
===
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Managing migrations

2009-03-10 Thread Tom Z Meinlschmidt

elliottg wrote:
> I have a migration "x" that when it runs self.up it adds a new column
> to a table, and of course when self. down is run it deletes said
> table...
> 
> After I ran this migration I continued to work and in the process
> added a couple other migrations. After a while I realized that the
> column migration "x" created was a mistake and I no longer need it. So
> I ran rake db:migrate:down VERSION=x to delete the column. It worked
> great, but the problem is whenever I added another migration than ran
> rake db:migrate,  migration "x" ran its self.up again and the column I
> no longer wanted was built back into my schema.
> 
> What the best way to handle something like this? Is it insane to just
> manually delete a migration file to prevent it from ever being ran
> again?
> 
> Thanks heaps,
> Elliott

I'm just editing migration file to add/remove columns and don't create 
new migrations to the same table until first branch/release version... 
then add new migration file (for the same table, if needed) and continue 
to add/remove columns until next branch/release version commit.

It's silly to add migration file for each column change within one 
version...

tom

-- 
===
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Phusion Passenger Installation Problem

2009-03-10 Thread Tom Z Meinlschmidt

Bob Martens wrote:
> I would check your rubygems version and then also ask in the Passenger
> group as well.
> 
> On Mar 10, 4:21 am, elle  wrote:
>> Hello,
>>
>> I am trying to install Passenger on Mac OS 10.5 but running:
>> % sudo gem install passenger
>> gives me:
>>
>> Error installing passenger:
>> invalid gem format for /Library/Ruby/Gems/1.8/cache/
>> passenger-2.0.6.gem
>>
>> I don't remember having problems with other gems. Would anyone know
>> what the problem is?
>>
>> Thanks,
>> Elle

try to update gem itself
gem update --system

tom

-- 
===
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Making the 'Back' link look the same as form.submit "Save"

2009-03-10 Thread Tom Z Meinlschmidt

InventoryTrackers wrote:
> Does anybody know how Rails paints that cool blue box around the <%=
> form.submit "Save" %>
> In most of my forms I've got a "Back" link ( ex: <%= link_to 'Back',
> return_path %>.

try to use Safari browser :) apple.com/safari

.snap

tom

-- 
===
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===

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



[Rails] Re: Help starting rails

2009-03-10 Thread Tom Z Meinlschmidt

Jeremy Woertink wrote:
> hmm, ok so it's working now... kinda...
> 
> It only works when I have my port set to 80.
> 
> So, doing ruby script/server -p 80
> 
> 
> Why would this be?

try to add -b 127.0.0.1 for sure..

script/server -p 3000 -b 127.0.0.1

if it doesn't work, post your netstat table

t

-- 
===
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: update a table depending on icon click

2009-03-10 Thread Tom Z Meinlschmidt

Sacredceltic wrote:
> Hi,
> 
> in a 'new' view for a persons model & controller, I want to be able to
> present a number of attribute options in the shape of icons. Each
> click on a different icon should set a given value to an attribute.
> For instance, if the user clicks on the icon for a "girl", I want the
> 'sex' attribute to be set to 'F' and the 'girl' icon to be somehow
> highlighted with a different border...
> When the user is satisfied with the options he set, he clicks on a
> submit button.
> 
> I don't know how to pass the icon clicks as attribute values to my
> controller...

Just create hidden_field in your form and set it values from javascript 
(onChange).. then submit the form and construct your query with these 
values...

tom


> Thanks
> 
> 

-- 
===
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
===

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



[Rails] Re: uninitialized constant CachedModel

2009-03-10 Thread vlo

Well, well, well. Problem solved. I should have reread the release
notes. The easy solution is to use config.gems in environment.rb.

Vincent

On Mar 10, 2:00 pm, vlo  wrote:
> I just upgraded my app from 1.2.6 to 2.2.2. When I do the rake
> db:migrate, I hit "uninitialized constant CachedModel." (Full stack at
> the end of the message.) I found out from doing a Google search that
> CachedModel and the initialization process created a chicken-and-egg
> problem long time ago. However, I thought that the problem was solved
> as I didn't have to anything special to make it work in 1.2.6.
>
> BTW, if I move the require 'cached_model' before
> Rails::Initializer.run do |config|, it dies somewhere else. And I am
> pretty sure that it is not the recommended place for the require
> anyway.
>
> Has anyone encountered this problem before? And how did you solve it?
>
> Thanks,
> Vincent
>
> P.S. Full stack:
>
> uninitialized constant CachedModel
> /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> dependencies.rb:445:in `load_missing_constant'
> /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> dependencies.rb:77:in `const_missing'
> /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> dependencies.rb:89:in `const_missing'
> /usr/local/myapp/app/models/baby.rb:1 (<= class Baby < CachedModel )
> /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
> /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> dependencies.rb:155:in `require'
> /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> dependencies.rb:262:in `require_or_load'
> /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> dependencies.rb:221:in `depend_on'
> /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> dependencies.rb:133:in `require_dependency'
> /usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:368:in
> `load_application_classes'
> /usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:367:in
> `each'
> /usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:367:in
> `load_application_classes'
> /usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:365:in
> `each'
> /usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:365:in
> `load_application_classes'
> /usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:185:in
> `process'
> /usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in
> `send'
> /usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in
> `run'
> /usr/local/myapp/config/environment.rb:13 (<= Rails::Initializer.run
> do |config|)
> /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
> `gem_original_require'
> /usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
> /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> dependencies.rb:153:in `require'
> /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> dependencies.rb:521:in `new_constants_in'
> /usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
> dependencies.rb:153:in `require'
> /usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/misc.rake:3
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `execute'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `execute'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in
> `invoke_with_call_chain'
> /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
> `invoke_with_call_chain'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:588:in
> `invoke_prerequisites'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:585:in `each'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:585:in
> `invoke_prerequisites'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:577:in
> `invoke_with_call_chain'
> /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
> `invoke_with_call_chain'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in `invoke'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in
> `invoke_task'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
> `top_level'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `each'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
> `top_level'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
> `standard_exception_handling'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in
> `top_level'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run'
> /usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
> `standard_exception_h

[Rails] update a table depending on icon click

2009-03-10 Thread Sacredceltic

Hi,

in a 'new' view for a persons model & controller, I want to be able to
present a number of attribute options in the shape of icons. Each
click on a different icon should set a given value to an attribute.
For instance, if the user clicks on the icon for a "girl", I want the
'sex' attribute to be set to 'F' and the 'girl' icon to be somehow
highlighted with a different border...
When the user is satisfied with the options he set, he clicks on a
submit button.

I don't know how to pass the icon clicks as attribute values to my
controller...

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] [JOBS] Ruby Developer in Manhattan Beach, CA

2009-03-10 Thread micha...@thorgroup.com

Hello everyone,

I'm looking for a Ruby Developer who is willing to work out of the
Manhattan Beach location on a full-time permanent onsite basis.  My
client is doing a confidential search but they are a social networking
site that is looking to go live by May 1st.  I've pasted the job
description below.

Position Description and Responsibilities:
- Architect, design, code, test and implement scalable, reliable and
secure web applications that support millions of users.
- Work closely with management and our amazing user experience team to
translate business requirements into functional and technical
specifications.
- Work closely with our friends (i.e. thrid party partners) on
integration and migration projects.
-Document, optimize and re-factor existitng code, SQL queries, and
engineering processes.

Required Experience and skills:
- BS in Computer Science or equivalent experience, 4+ years.
- Knowledge of object oriented programming and design patterns.
- Knowledge of re-factoring with unit/functional tests, and SQL query
optimization.
- Knowledge of scripting languages including PHP, Pearl, etc.
- Knowledge of Ruby and Ruby on Rails required.

They are looking for Rockstar Ruby Developers with abilities to
develop scalable ruby apps and are willing to compensate aggressively
for the right candidate.
Please let me know if you are interested along with your resume, your
citizenship/visa status, and your salary requirement.  You can reach
me at micha...@thorgroup.com

Best regards,
Michael


Michael Joo
THOR Group, Inc.
3601 Aviation Boulevard, Suite #3900
Manhattan Beach, California 90266
Direct Line: (310) 727-5617
Fax:   (310) 727-1770
Email: micha...@thorgroup.com
www.thorgroup.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] uninitialized constant CachedModel

2009-03-10 Thread vlo

I just upgraded my app from 1.2.6 to 2.2.2. When I do the rake
db:migrate, I hit "uninitialized constant CachedModel." (Full stack at
the end of the message.) I found out from doing a Google search that
CachedModel and the initialization process created a chicken-and-egg
problem long time ago. However, I thought that the problem was solved
as I didn't have to anything special to make it work in 1.2.6.

BTW, if I move the require 'cached_model' before
Rails::Initializer.run do |config|, it dies somewhere else. And I am
pretty sure that it is not the recommended place for the require
anyway.

Has anyone encountered this problem before? And how did you solve it?

Thanks,
Vincent

P.S. Full stack:

uninitialized constant CachedModel
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:445:in `load_missing_constant'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:77:in `const_missing'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:89:in `const_missing'
/usr/local/myapp/app/models/baby.rb:1 (<= class Baby < CachedModel )
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:155:in `require'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:262:in `require_or_load'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:221:in `depend_on'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:133:in `require_dependency'
/usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:368:in
`load_application_classes'
/usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:367:in
`each'
/usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:367:in
`load_application_classes'
/usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:365:in
`each'
/usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:365:in
`load_application_classes'
/usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:185:in
`process'
/usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in
`send'
/usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/initializer.rb:112:in
`run'
/usr/local/myapp/config/environment.rb:13 (<= Rails::Initializer.run
do |config|)
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require'
/usr/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:153:in `require'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:521:in `new_constants_in'
/usr/lib64/ruby/gems/1.8/gems/activesupport-2.2.2/lib/active_support/
dependencies.rb:153:in `require'
/usr/lib64/ruby/gems/1.8/gems/rails-2.2.2/lib/tasks/misc.rake:3
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `call'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:617:in `execute'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `each'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:612:in `execute'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:578:in
`invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
`invoke_with_call_chain'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:588:in
`invoke_prerequisites'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:585:in `each'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:585:in
`invoke_prerequisites'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:577:in
`invoke_with_call_chain'
/usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:571:in
`invoke_with_call_chain'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:564:in `invoke'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2027:in
`invoke_task'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
`top_level'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in `each'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2005:in
`top_level'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
`standard_exception_handling'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1999:in
`top_level'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1977:in `run'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:2044:in
`standard_exception_handling'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/lib/rake.rb:1974:in `run'
/usr/lib64/ruby/gems/1.8/gems/rake-0.8.4/bin/rake:31
/usr/bin/rake:19:in `load'
/usr/bin/rake:19



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to

[Rails] Re: Managing migrations

2009-03-10 Thread Rob Biedenharn

The answer gets a bit more strict if there are multiple developers  
involved. In that case, I'd always create the extra migration.

However, if you never checked the migration into source control, then  
migrate:down, change it and migrate:up (or just delete it), is the  
right thing to do even in a multi-user development environment.

-Rob

On Mar 10, 2009, at 5:37 PM, elliottg wrote:

>
> Thanks for the insight.
>
> EG
>
> On Mar 10, 5:31 pm, Starr Horne  wrote:
>>> So, create another migration that would undo what the old problem  
>>> one
>>> does... Would that be considered a better practice over just  
>>> deleting
>>> the one you no longer need or is it just a personal preference?
>>
>> If you're in production, or far along in development it's probably  
>> best to create the extra migration.
>>
>> If you're early in development, I'd just delete it to keep things  
>> clean.
>>
>> SH
>>
>> --
>> Starr Horne
>> My blog:http://starrhorne.com
>> Check out my Helpdesk RailsKit:http://railskits.com/helpdesk/
> >

Rob Biedenharn  http://agileconsultingllc.com
r...@agileconsultingllc.com
+1 513-295-4739
Skype:  rob.biedenharn



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



[Rails] Re: Resubmitting remote form via AJAX -- old parameters get passed!!

2009-03-10 Thread gaveeno

I realized that the form is actually sending the new parameters but I
shouldn't be using a remote form here if I want a redirect...the
format.js {redirect_to setup_campaigns_path } doesn't actually
redirect the browser.

On Mar 10, 3:14 pm, gaveeno  wrote:
> When I submit a form via AJAX and get back some errors in my "errors"
> div, if I try to resubmit the form with the errors corrected it still
> passes the old parameters.  See my code at:  http://pastie.org/413269
> (also pasted below).  I can't figure out why the 2nd time the form is
> submitted, it still has the old parameters even though the fields are
> populated with the new parameters. Anybody know why this could be?
>
> ## views/campaigns/_edit.html.erb
> <% remote_form_for @campaign, :url => {:controller => :setup, :action
> => :update_campaign, :id => @campaign },:html => {:id =>
> 'campaign_form'},
>         :loading => "Element.show('campaign_spinner');",
>         :complete => "Element.hide('campaign_spinner');" do |campaign_form|
> %>
>         <%= render :partial => 'campaigns/edit_form_contents', :locals =>
> {:form_type => form_type,:campaign_form => campaign_form} %>
> <% end %>
>
> ## views/campaigns/_edit_form_contents.html.erb
> 
> 
>         
>                 
>         
>         
>             <%= campaign_form.label :description, "Description" %>
>                 <%= campaign_form.text_field :description, :class => 'custom 
> span-8'
> %>
>         
> 
> 
>         
>                 
>         
>         
>                 <%= campaign_form.label :start_date, "Start date" %>
>                 <%= campaign_form.calendar_date_select :start_date, :time =>
> false, :class => "span-4" %>
>
>         
> 
> 
>         
>                 <%= button_submit_to_remote 
> "Save",{:icon=>"accept",:submit_form =>
> 'campaign_form',:size => "small"},"left","campaign_spinner" %>
>         
>         
>          = "campaign_spinner" src = "/images/spinners/
> spin_small_dark_blue.gif">
>         
> 
>
> ## helpers/setup_helper.rb
>
>   def button_submit_to_remote(name,options=
> {},alignment=nil,spinner=nil)
>     path = {}
>     position = get_position(alignment)
>     img_tag = get_image(options.delete(:icon) || "")
>     button_type = get_button_size(options.delete(:size) || "")
>     link = (img_tag ||= "") + name + " "
>     options.store(:class,"#{button_type} #{position}")
>     submit_form = options.delete(:submit_form) || nil
>
>     if submit_form
>       link_to_function link, options, :class => "#{button_type} #
> {position}" do |page|
>         page << "Element.show('#{spinner}');" if spinner
>         page << "$('#{submit_form}').onsubmit()"
>       end
>     end
>   end
>
> ## controllers/campaigns_controller.rb
>
>   def update
>     @campaign = Campaign.find(params[:id])
>
>     respond_to do |format|
>       if @campaign.update_attributes(params[:campaign])
>         flash[:success] = 'Updates saved.'
>         format.html { redirect_to setup_campaigns_path }
>         format.js { redirect_to setup_campaigns_path }
>       else
>         flash.now[:error] = "Couldn't save campaign."
>         format.html { redirect_to :action => 'edit'}
>         format.js {
>           render :update do |page|
>           page.replace_html :errors, error_messages_for([:campaign])
>           page << "window.scrollTo(0,0);"
>           end }
>       end
>     end
>   end
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Resubmitting remote form via AJAX -- old parameters get passed!!

2009-03-10 Thread gaveeno

When I submit a form via AJAX and get back some errors in my "errors"
div, if I try to resubmit the form with the errors corrected it still
passes the old parameters.  See my code at:  http://pastie.org/413269
(also pasted below).  I can't figure out why the 2nd time the form is
submitted, it still has the old parameters even though the fields are
populated with the new parameters. Anybody know why this could be?

## views/campaigns/_edit.html.erb
<% remote_form_for @campaign, :url => {:controller => :setup, :action
=> :update_campaign, :id => @campaign },:html => {:id =>
'campaign_form'},
:loading => "Element.show('campaign_spinner');",
:complete => "Element.hide('campaign_spinner');" do |campaign_form|
%>
<%= render :partial => 'campaigns/edit_form_contents', :locals =>
{:form_type => form_type,:campaign_form => campaign_form} %>
<% end %>

## views/campaigns/_edit_form_contents.html.erb






<%= campaign_form.label :description, "Description" %>
<%= campaign_form.text_field :description, :class => 'custom 
span-8'
%>







<%= campaign_form.label :start_date, "Start date" %>
<%= campaign_form.calendar_date_select :start_date, :time =>
false, :class => "span-4" %>





<%= button_submit_to_remote 
"Save",{:icon=>"accept",:submit_form =>
'campaign_form',:size => "small"},"left","campaign_spinner" %>






## helpers/setup_helper.rb

  def button_submit_to_remote(name,options=
{},alignment=nil,spinner=nil)
path = {}
position = get_position(alignment)
img_tag = get_image(options.delete(:icon) || "")
button_type = get_button_size(options.delete(:size) || "")
link = (img_tag ||= "") + name + " "
options.store(:class,"#{button_type} #{position}")
submit_form = options.delete(:submit_form) || nil

if submit_form
  link_to_function link, options, :class => "#{button_type} #
{position}" do |page|
page << "Element.show('#{spinner}');" if spinner
page << "$('#{submit_form}').onsubmit()"
  end
end
  end


## controllers/campaigns_controller.rb

  def update
@campaign = Campaign.find(params[:id])

respond_to do |format|
  if @campaign.update_attributes(params[:campaign])
flash[:success] = 'Updates saved.'
format.html { redirect_to setup_campaigns_path }
format.js { redirect_to setup_campaigns_path }
  else
flash.now[:error] = "Couldn't save campaign."
format.html { redirect_to :action => 'edit'}
format.js {
  render :update do |page|
  page.replace_html :errors, error_messages_for([:campaign])
  page << "window.scrollTo(0,0);"
  end }
  end
end
  end
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Managing migrations

2009-03-10 Thread elliottg

Thanks for the insight.

EG

On Mar 10, 5:31 pm, Starr Horne  wrote:
> > So, create another migration that would undo what the old problem one
> > does... Would that be considered a better practice over just deleting
> > the one you no longer need or is it just a personal preference?
>
> If you're in production, or far along in development it's probably best to 
> create the extra migration.
>
> If you're early in development, I'd just delete it to keep things clean.
>
> SH
>
> --
> Starr Horne
> My blog:http://starrhorne.com
> Check out my Helpdesk RailsKit:http://railskits.com/helpdesk/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: polymorphic question

2009-03-10 Thread Me

anybody?

On Mar 9, 7:33 pm, Me  wrote:
> I have a "ports" model I wanted to makepolymorphic.  I have an alarm
> table that has a port, and I also have a circuits model that has 2
> ports.
>
> Is there a way to use the circuits model aspolymorphicwith 2 ports
> each one a different port?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Managing migrations

2009-03-10 Thread Starr Horne

> So, create another migration that would undo what the old problem one
> does... Would that be considered a better practice over just deleting
> the one you no longer need or is it just a personal preference?

If you're in production, or far along in development it's probably best to 
create the extra migration.

If you're early in development, I'd just delete it to keep things clean.

SH

-- 
Starr Horne
My blog: http://starrhorne.com
Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: knowing when to go to multiple mongrel instances or dedicated server

2009-03-10 Thread Ed

Thanks, good info.  That is more for a dedicated server, though.  If
I'm on a shared server, how can I measure/compare to determine whether
I need the expense of a dedicated server?

On Mar 10, 3:20 pm, Philip Hallstrom  wrote:
> > I have a rails app with a growing user base.  Right now it is on a
> > single mongrel instance on a shared server.  Is there a quantifiable
> > method I can use to measure when I need to add mongrel instances, or
> > move to a dedicated server?  Are there rules of thumb for how many
> > users or page hits an instance can support?  Or is it solely
> > subjective, based on when the app starts to "feel" slow?
>
> A couple of years old, but it's from the horses mouth...
>
> http://rubyforge.org/pipermail/mongrel-users/2006-May/000200.html
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Managing migrations

2009-03-10 Thread elliottg

So, create another migration that would undo what the old problem one
does... Would that be considered a better practice over just deleting
the one you no longer need or is it just a personal preference?

Thanks

On Mar 10, 5:02 pm, Rob Biedenharn 
wrote:
> On Mar 10, 2009, at 4:52 PM, Starr Horne wrote:
>
> >> What the best way to handle something like this? Is it insane to just
> >> manually delete a migration file to prevent it from ever being ran
> >> again?
>
> > Yeah, you can delete it. It's just a file.
>
> > --
> > Starr Horne
> > My blog:http://starrhorne.com
> > Check out my Helpdesk RailsKit:http://railskits.com/helpdesk/
>
> Just create another migration that is the opposite of this one.
>
> -Rob
>
> Rob Biedenharn          http://agileconsultingllc.com
> r...@agileconsultingllc.com
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Managing migrations

2009-03-10 Thread Rob Biedenharn

On Mar 10, 2009, at 4:52 PM, Starr Horne wrote:
>> What the best way to handle something like this? Is it insane to just
>> manually delete a migration file to prevent it from ever being ran
>> again?
>
> Yeah, you can delete it. It's just a file.
>
> -- 
> Starr Horne
> My blog: http://starrhorne.com
> Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/


Just create another migration that is the opposite of this one.

-Rob

Rob Biedenharn  http://agileconsultingllc.com
r...@agileconsultingllc.com



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



[Rails] Re: Phusion Passenger Installation Problem

2009-03-10 Thread elle

% gem list

*** LOCAL GEMS ***

actionmailer (2.2.2, 1.3.6)
actionpack (2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.2.2, 1.15.6)
activeresource (2.2.2)
activesupport (2.2.2, 1.4.4)
acts_as_ferret (0.4.3, 0.4.1)
brynary-webrat (0.4.0)
capistrano (2.5.4, 2.0.0)
cgi_multipart_eof_fix (2.5.0)
columnize (0.3.0)
daemons (1.0.10, 1.0.9)
dnssd (0.7.0, 0.6.0)
fastercsv (1.4.0)
fastthread (1.0.1)
fcgi (0.8.7)
ferret (0.11.6, 0.11.4)
gem_plugin (0.2.3)
highline (1.5.0, 1.2.9)
hoe (1.8.3)
hpricot (0.6.164, 0.6)
libxml-ruby (0.9.8, 0.3.8.4)
linecache (0.43)
liquid (1.9.0)
mislav-will_paginate (2.3.7)
mongrel (1.1.5, 1.1.4)
mysql (2.7)
needle (1.3.0)
net-scp (1.0.2)
net-sftp (2.0.2, 1.1.0)
net-ssh (2.0.10, 1.1.2)
net-ssh-gateway (1.0.1)
nokogiri (1.1.1)
rack (0.9.1)
radiant (0.7.1)
rails (2.2.2, 1.2.6)
rake (0.8.3, 0.7.3)
RedCloth (4.1.1, 3.0.4)
rspec (1.1.12)
rspec-rails (1.1.12)
ruby-debug (0.10.3)
ruby-debug-base (0.10.3)
ruby-openid (2.1.4, 1.1.4)
ruby-yadis (0.3.4)
rubyforge (1.0.2)
rubygems-update (1.3.1)
rubynode (0.1.5, 0.1.3)
sqlite3-ruby (1.2.4, 1.2.1)
termios (0.9.4)
tzinfo (0.3.12)


I am using ruby 1.8.6. Going to upgrade to latest now as well.


On Mar 11, 5:25 am, Bob Martens  wrote:
> I would check your rubygems version and then also ask in the Passenger
> group as well.
>
> On Mar 10, 4:21 am, elle  wrote:
>
>
>
> > Hello,
>
> > I am trying to install Passenger on Mac OS 10.5 but running:
> > % sudo gem install passenger
> > gives me:
>
> > Error installing passenger:
> >         invalid gem format for /Library/Ruby/Gems/1.8/cache/
> > passenger-2.0.6.gem
>
> > I don't remember having problems with other gems. Would anyone know
> > what the problem is?
>
> > Thanks,
> > Elle
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Making the 'Back' link look the same as form.submit "Sav

2009-03-10 Thread Robert Walker

InventoryTrackers wrote:
> Has anybody built .css around any of these properties to make this
> link look like the same graphic button created by <%= form.submit
> "Save" %>?

That button doesn't even look the same between different browsers. Your 
only hope is to use a button to go back instead of a link. CSS isn't 
going to cut it. You can use a button with JavaScript to make it act 
like a link to back.

Well actually, I can think of another way, but it's just the opposite. 
You could use a link with JavaScript to replace your submit button, 
where the JavaScript submits the form. Then you can create CSS to make 
the two links look like buttons.
-- 
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: Managing migrations

2009-03-10 Thread Starr Horne

> What the best way to handle something like this? Is it insane to just
> manually delete a migration file to prevent it from ever being ran
> again?

Yeah, you can delete it. It's just a file.

-- 
Starr Horne
My blog: http://starrhorne.com
Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Making the 'Back' link look the same as form.submit "Save"

2009-03-10 Thread Eric

What "cool blue box?" My submit buttons just look like buttons, so you
probably already have some CSS that you could copy.

On Mar 10, 1:31 pm, InventoryTrackers 
wrote:
> Does anybody know how Rails paints that cool blue box around the <%=
> form.submit "Save" %>
> In most of my forms I've got a "Back" link ( ex: <%= link_to 'Back',
> return_path %>.
>
> I'd like this link to share the same 'look and feel'.
>
> When I look at the browser source the code that rails generates it
> shows this;
>
>   
>      value="Save" />
>   
>
> Has anybody built .css around any of these properties to make this
> link look like the same graphic button created by <%= form.submit
> "Save" %>?
>
> David
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] autosave no longer a valid option for belongs_to?

2009-03-10 Thread Jason Fox

The Rails API doc (api.rubyonrails.org) says that :autosave is still a
valid option for belongs_to in the latest version of Rails.  However, a
look at the activerecord/lib/active_record/associations.rb (line 1590)
reveals that it is not in the @@valid_keys_for_belongs_to_association
array. I also noticed that it's not in the ActiveRecord API doc
(ar.rubyonrails.org).

Does anyone have any more information on this?  What is the current best
practice for persisting your child objects when saving a parent object?
Here's an example:

class PaymentMethod < ActiveRecord::Base
  belongs_to :billing_address, :class_name => "Address"
end
class Address < ActiveRecord::Base
  validates_presence_of :line_one
end
class PaymentMethodsController < ActionController::Base
  def update
@pm = PaymentMethod.find(params[:id])
@pm.billing_address.line_one = params[:billing_address][:line_one]
# ...
if @pm.save
  # ...
end
  end
end

Thanks in advance.

Jason
-- 
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] Managing migrations

2009-03-10 Thread elliottg

I have a migration "x" that when it runs self.up it adds a new column
to a table, and of course when self. down is run it deletes said
table...

After I ran this migration I continued to work and in the process
added a couple other migrations. After a while I realized that the
column migration "x" created was a mistake and I no longer need it. So
I ran rake db:migrate:down VERSION=x to delete the column. It worked
great, but the problem is whenever I added another migration than ran
rake db:migrate,  migration "x" ran its self.up again and the column I
no longer wanted was built back into my schema.

What the best way to handle something like this? Is it insane to just
manually delete a migration file to prevent it from ever being ran
again?

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



[Rails] Making the 'Back' link look the same as form.submit "Save"

2009-03-10 Thread InventoryTrackers

Does anybody know how Rails paints that cool blue box around the <%=
form.submit "Save" %>
In most of my forms I've got a "Back" link ( ex: <%= link_to 'Back',
return_path %>.

I'd like this link to share the same 'look and feel'.

When I look at the browser source the code that rails generates it
shows this;

  

  

Has anybody built .css around any of these properties to make this
link look like the same graphic button created by <%= form.submit
"Save" %>?

David

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



[Rails] unit test model validations

2009-03-10 Thread Michael Rigart

Hi,

since I want to improve my Rails skills, I decided to start using the
Rails testing framework. But I find it a bit hard to start testing model
validations. Some of my tests don't pass, but I know they must, since I
have added the validation in the model.

Here is an example:

The migration:

create_table :clients do |t|
  t.string  'name', :null => false
  t.string  'address',  :null => false
  t.string  'zip',  :null => false
  t.string  'city', :null => false
  t.string  'country',  :null => false
  t.string  'phone',:null => true
  t.string  'fax',  :null => true
  t.string  'email',:null => false
  t.integer 'status',   :null => false
  t.boolean 'is_root',  :null => false, :default => false
  t.boolean 'access_crm',   :null => false, :default => false
  t.boolean 'access_project',   :null => false, :default => false
  t.boolean 'access_dmail', :null => false, :default => false
  t.boolean 'access_financial', :null => false, :default => false
  t.timestamps
end
Extension in test_helper.rb:

  def assert_presence_required(object, field)
  # Test that the initial object is valid
  assert object.valid?

  # Test that it becomes invalid by removing the field
  temp = object.send(field)
  object.send("#{field}=", nil)
  assert object.valid?
  assert(object.errors.invalid?(field), "#{field} is required")

  # Make object valid again
  object.send("#{field}=", temp)
end

def assert_required_length(object, field, minlength, maxlength)
dup_object = object.clone

if(minlength)
  # Invalid at minlength-1
  dup_object.send("#{field}=", "a"*(minlength-1))
  assert dup_object.valid?
  assert(dup_object.errors.invalid?(field), "#{field} has a
minimum length of #{minlength} character(s)")

  # Valid at minlength
  dup_object.send("#{field}=", "a"*minlength)
  assert dup_object.valid?

  # Valid at minlength+1
  dup_object.send("#{field}=", "a"*(minlength+1))
  assert dup_object.valid?
end

if(maxlength)
  # Valid at maxlength-1
  dup_object.send("#{field}=", "a"*(maxlength-1))
  assert dup_object.valid?

  # Valid at maxlength
  dup_object.send("#{field}=", "a"*maxlength)
  assert dup_object.valid?

  # Invalid at maxlength+1
  dup_object.send("#{field}=", "a"*(maxlength+1))
  assert dup_object.valid?
  assert(dup_object.errors.invalid?(field), "#{field} has a
maximum length of #{maxlength} character(s)")
end
end

The unit test:

  def setup
@netronix = clients(:netronix)
  end

  def test_validates_presence_of
assert_presence_required(@netronix, :name)
assert_presence_required(@netronix, :address)
assert_presence_required(@netronix, :zip)
assert_presence_required(@netronix, :city)
assert_presence_required(@netronix, :country)
assert_presence_required(@netronix, :email)
assert_presence_required(@netronix, :status)
assert_presence_required(@netronix, :is_root)
assert_presence_required(@netronix, :access_crm)
assert_presence_required(@netronix, :access_project)
assert_presence_required(@netronix, :access_dmail)
assert_presence_required(@netronix, :access_financial)
  end

  def test_validates_length_of
assert_required_length(@netronix, :name, false, 255)
assert_required_length(@netronix, :address, false, 255)
assert_required_length(@netronix, :zip, false, 255)
assert_required_length(@netronix, :city, false, 255)
assert_required_length(@netronix, :country, false, 255)
assert_required_length(@netronix, :email, false, 255)
  end

  def test_validates_format_of
regex = /^[A-Z0-9._%-]+@([A-Z0-9-]+\.)+[A-Z]{2,4}$/i
assert_match(regex, @netronix.email)
tmp = @netronix.email
@netronix.email = "michael.rig...@gmail.com"
assert_match(regex, @netronix.email)
@netronix.email = "michael.adrien.rig...@gmail.curious"
assert_match(regex, @netronix.email)
@netronix.email = "michael_rig...@gmail.be"
assert_match(regex, @netronix.email)
@netronix.email = tmp
  end

  def test_validates_uniqueness_of
user = Client.new(:name => @netronix.name)
user.valid?
assert_not_nil user.errors.on(:name)

user = Client.new(:email => @netronix.email)
user.valid?
assert_not_nil user.errors.on(:email)

  end

I know there are some things wrong with my test, but I don't know what.
The first thing wrong is the validate_length_of helper. For some reason,
it throws a failure even when the validation is filled in the model:

  3) Failure:
test_validates_presence_of(ClientTest)
[/test/test_helper.rb:45:in `assert_presence_required'
 /test/unit/client_test.rb:10:in `test_validates_presence_of

[Rails] Re: Help starting rails

2009-03-10 Thread Jeremy Woertink

hmm, ok so it's working now... kinda...

It only works when I have my port set to 80.

So, doing ruby script/server -p 80


Why would this be?
-- 
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: Rails cross platform problem

2009-03-10 Thread Harold

This is related to the fact that on *nix the default end of line
character is \n, and on windows, it's \r\n (note that this is not Ruby
specific, but platform specific - Ruby is just following along).

There's a utility on unixes called unix2dos which you can use to
substitute all \n characters to \r\n, or if you need to stay in Ruby-
land, use gsub with something like gsub!(/\n/,"\r\n").

Hope that helps,
-H


On Mar 9, 8:43 pm, Zhao Yi  wrote:
> My Rails working on a Linux system and a client access this server from
> Windows. The client inputs something in a text area and click submit, in
> the server side, it put the input into a file. The problem is that at
> the end of each line in the file, there is a "^M". How can I avoid this?
> I use File.puts method to write to the file.
>
> thanks.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: inheritance problem

2009-03-10 Thread Chris Kottom
JRuby can do what you're asking.  You should go post the question to the
JRuby mailing list and ask for links to basic tutorials which should
generally cover this kind of thing.

On Tue, Mar 10, 2009 at 7:36 PM, Starr Horne  wrote:

>
> > i create java class and i want to create ruby class and inherit from
> > this java class
>
> You just need to write an adapter in c# and you should be all set.
>
> SH
>
> >
>

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



[Rails] RAILS_ROOT issue - plugin unit tests won't work under vendor/plugins

2009-03-10 Thread Lee

Hi,

I'm relatively new to Ruby/Rails (and developing on Windows boxes).
I've inherited a system and am trying to get the unit tests for a
plugin running in Windows. Specifically, I have a plugin with some
unit tests running under my app's vendor/plugins dir. When I try and
run a specific model unit test I get a failure:

-
c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require': no such file to load -- C:/Documents and
Settings/leedoejgi/workspace/Ruby/config/environment (LoadError)
-

It's looking in C:/Documents and Settings/leedoejgi/workspace/Ruby/
config/environment instead of C:/Documents and Settings/leedoejgi/
workspace/Ruby/myapp/clients/myapp_client/config/environment.

The unit test is requiring test_helper in the same directory, which
looks like this:


$:.reject! { |e| e.include? 'TextMate'}
ENV["RAILS_ENV"] = "test"

unless defined? RAILS_ROOT
  RAILS_ROOT = '../../..'
end

require File.expand_path("#{RAILS_ROOT}/config/environment")
require 'test_help'
require 'logger'
require 'fileutils'



If I set an environment variable for RAILS_ROOT in Windows of and make
the following changes to test_helper give it the right RAILS_ROOT


$:.reject! { |e| e.include? 'TextMate'}
ENV["RAILS_ENV"] = "test"

# Support for NetBeans testing in Windows with RAILS_ROOT set in
environement.
if !ENV['RAILS_ROOT'].empty?
  RAILS_ROOT = ENV['RAILS_ROOT']
end

unless defined? RAILS_ROOT
  RAILS_ROOT = '../../..'
end

require File.expand_path("#{RAILS_ROOT}/config/environment")
require 'test_help'
require 'logger'
require 'fileutils'



I now get a different error:

-
c:/ruby/lib/ruby/gems/1.8/gems/rails-2.0.2/lib/initializer.rb:499:in
`replace': can't modify frozen string (TypeError)
-

Can anyone offer me guidance on how to get the unit tests running
under Windows?

Thanks!

  Lee

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 Active Record Connection

2009-03-10 Thread johnr

The error that you found in railsforum is probably on the right track.
Is there any other declaration of the class OrderDetail other than
what you have shown? If so, this is the problem. Also, if all of the
servers in you server model have the same set of models, you may want
to consider the following:

1) Create a RemoteModel class that inherits from ActiveRecord. This
class will only be used for inheritance and to simplify connections.
2) Create "local" models for each model in the remote server. In your
example, this would mean creating an order.rb and an order_details.rb
3) Each of the models created in step 2 should inherit from
RemoteModel. From your example

class Order < RemoteModel
end

4) Your code can then look like this

Server.find_all_by_server_type("sybase_t").each do |s|
if s.server_name =~ /^LIS_..._ST1[0-2]/ and s.is_active?
  RemoteModel. establish_connection s.connection_hash
  # Do remote model stuff here
end
end

This approach DRY's up your code and kinda puts things where they
belong.


On Mar 10, 10:19 am, Valentino Lun 
wrote:
> Dear all
>
> My ActiveRecord::Base is connected to server_a (local server), has a
> Server model contains about 100 server records (remote server).
>
> I use the following block to retrieve the server infomation. It works
> fine.
>
> Server.find_all_by_server_type("sybase_t").each do |s|
>
>     if s.server_name =~ /^LIS_..._ST1[0-2]/ and s.is_active?
>       class Order < ActiveRecord::Base
>         set_table_name = "orders"
>       end
>       Order.establish_connection s.connection_hash
>
>       begin
>         puts "#{s.server_name} has #{Order.count} orders"
>       rescue
>         puts "#{s.server_name} is down"
>       end
>
>     end
> end
>
> I want to create another model OrderDetail in the remote server (see
> below code). It does not work. It said "TypeError: superclass mismatch
> for class OrderDetail".
>
> Server.find_all_by_server_type("sybase_t").each do |s|
>     if s.server_name =~ /^LIS_..._ST1[0-2]/ and s.is_active?
>       class Order < ActiveRecord::Base
>         set_table_name = "orders"
>       end
>       Order.establish_connection s.connection_hash
>       class OrderDetail < ActiveRecord::Base
>         set_table_name = "order_detail"
>       end
>       OrderDetail.establish_connection s.connection_hash
>       begin
>         puts "#{s.server_name} has #{Order.count} orders and
> #{OrderDetail.count} order_detail"
>       rescue
>         puts "#{s.server_name} is down"
>       end
>     end
> end
>
> I used google and find that the error will happen if the code like 
> thishttp://railsforum.com/viewtopic.php?id=10993
>
>    1. class Cool
>    2. end
>    3.
>    4. class SpecialCool < Cool
>    5. end
>    6.
>    7. class SpecialCool # this line will raise an error
>    8. end
>
> How can I change my code so that I can have more than 1 models in the
> remote server?
>
> Thank you very much
> Valentino
> --
> 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: Help starting rails

2009-03-10 Thread Jeremy Woertink

Greg Donald wrote:
> 
> Check that your hosts file doesn't have any "new" entries added to it
> since yesterday.  I've seen spyware prevention apps add stuff in there
> sometimes.
> 


I checked it, seems it was missing a line...

It had, ::1 localhost
and I added 127.0.0.1   localhost

Still doesn't work though :(

Thanks for the idea, any others?

~Jeremy
-- 
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: rake:db:prepare Mysql::Error: #42000BLOB/TEXT column ' used in key specification without a length

2009-03-10 Thread Will

I was able to create another migration to drop that database and
create it again with no indexes on these text fields.  Once I did this
all appears to be well.

Thanks
Will

On Mar 9, 5:52 pm, bill walton  wrote:
> Hi Will,
>
> On Mon, 2009-03-09 at 15:42 -0700, Will wrote:
> > When I run a rake db:prepare.  I see this message "Mysql::Error:
> > #42000BLOB/TEXT column 'short_description' used in key specification
> > without a key length:  CREATE INDEX 'short_description' on cached_cars
> > ('short_description')
>
> MySQL requires an indexed field have a length and blobs don't support
> it.  I can't recall right off the top of my head what the max length is,
> but we fought this same issue at my last on-site gig.
>
> Good luck,
> 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] Re: Help starting rails

2009-03-10 Thread Greg Donald

On Tue, Mar 10, 2009 at 2:08 PM, Jeremy Woertink
 wrote:
>
> I have a weird issue. I can't start my rails project.
>
> I was working on it yesterday, and everything was fine. I came into work
> today and I can't boot it up...
>
> The server comes up fine when I run ruby script/server, but when I go to
> my browser and type localhost:3000, I get a can't establish a connection
> to the server at localhost:3000.


Check that your hosts file doesn't have any "new" entries added to it
since yesterday.  I've seen spyware prevention apps add stuff in there
sometimes.



-- 
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: knowing when to go to multiple mongrel instances or dedicated server

2009-03-10 Thread Philip Hallstrom

> I have a rails app with a growing user base.  Right now it is on a
> single mongrel instance on a shared server.  Is there a quantifiable
> method I can use to measure when I need to add mongrel instances, or
> move to a dedicated server?  Are there rules of thumb for how many
> users or page hits an instance can support?  Or is it solely
> subjective, based on when the app starts to "feel" slow?

A couple of years old, but it's from the horses mouth...

http://rubyforge.org/pipermail/mongrel-users/2006-May/000200.html

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



[Rails] Re: How do I organize my model code?

2009-03-10 Thread Jeremy Woertink

David Dennis wrote:
> I have a basic question.  I've been working with Rails for a couple
> months now, and I've read the O'Reilly book on it, but once I started
> making a basic sized application, it seems like my main model "List" has
> waaay too much code, and I want to break it down into classes and
> subclasses.
> 
> Most of the code in "List" is for HTML parsing, so as a first step, I
> would want to make a class "Parser" that is accessible to "List."
> 
> But I have so many questions about how to create this new class:
> 
> Where do I put "Parser"?
>  - In "List" as another class?
> Is OOP in Rails only centered around database objects?
>  - Would I have to make a "Parser" model?
> - Even if there's no DB table for "Parser"?
> Is there any guide to Rails best programming practices?
> 
> Thanks,
> David

I would suggest starting with reading Object Thinking by David West 
(http://www.microsoft.com/learning/en/us/books/6820.aspx) This may help 
you to build your objects out.

You can have objects that don't extend ActiveRecord::Base, just make a 
new class, and call it whatever you want. Place that file into the 
models folder.

Just stick to conventions and make your code work first, then go back 
and refactor. Make lots of tests, and you will be fine.

~Jeremy
-- 
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] knowing when to go to multiple mongrel instances or dedicated server

2009-03-10 Thread Ed

I have a rails app with a growing user base.  Right now it is on a
single mongrel instance on a shared server.  Is there a quantifiable
method I can use to measure when I need to add mongrel instances, or
move to a dedicated server?  Are there rules of thumb for how many
users or page hits an instance can support?  Or is it solely
subjective, based on when the app starts to "feel" slow?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Help starting rails

2009-03-10 Thread Jeremy Woertink

I have a weird issue. I can't start my rails project.

I was working on it yesterday, and everything was fine. I came into work
today and I can't boot it up...

The server comes up fine when I run ruby script/server, but when I go to
my browser and type localhost:3000, I get a can't establish a connection
to the server at localhost:3000.

I have tried this in FireFox 3, I.E. 7, Chrome, Opera 9.6, Safari(win),
I tried switching the port with ruby script/server -p 3001, I have tried
restarting my machine.

I don't have any firewalls, haven't done any updates on any gems. I have
have tried using both mongrel and webrick. I can hop into console with
ruby script/console in another window, and finding an object will show
the queries in the server window.

Here is what comes up with each server.

C:\rails_apps\vwd_login>ruby script/server webrick
=> Booting WEBrick...
=> Rails 2.1.0 application started on http://0.0.0.0:3000
=> Ctrl-C to shutdown server; call with --help for options
[2009-03-10 11:54:44] INFO  WEBrick 1.3.1
[2009-03-10 11:54:44] INFO  ruby 1.8.6 (2007-09-24) [i386-mswin32]
[2009-03-10 11:54:44] INFO  WEBrick::HTTPServer#start: pid=3264
port=3000
[2009-03-10 11:55:42] INFO  going to shutdown ...
[2009-03-10 11:55:42] INFO  WEBrick::HTTPServer#start done.

*

C:\rails_apps\vwd_login>ruby script/server
=> Booting Mongrel (use 'script/server webrick' to force WEBrick)
=> Rails 2.1.0 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
** Starting Mongrel listening at 0.0.0.0:3000
** Starting Rails with development environment...
** Rails loaded.
** Loading any Rails specific GemPlugins
** Signals ready.  INT => stop (no restart).
** Mongrel 1.1.5 available at 0.0.0.0:3000
** Use CTRL-C to stop.

**
C:\rails_apps\vwd_login>ruby -v
ruby 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]

C:\rails_apps\vwd_login>rails -v
Rails 2.2.2

C:\rails_apps\vwd_login>ver
Microsoft Windows [Version 6.0.6001] (yes, I know this is an issue, but
besides this)

C:\rails_apps\vwd_login>gem -v
1.3.1

Any ideas on what I'm missing?

Thanks,
~Jeremy
-- 
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: inheritance problem

2009-03-10 Thread Starr Horne

> i create java class and i want to create ruby class and inherit from
> this java class

You just need to write an adapter in c# and you should be all set.

SH

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



[Rails] inheritance problem

2009-03-10 Thread mahmoud_cs

i create java class and i want to create ruby class and inherit from
this java class

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: will_paginate plugin

2009-03-10 Thread Bob Martens

Check your routes.rb file and see if you have it namspaced under
admin.

On Mar 9, 7:39 am, Nilesh Kulkarni 
wrote:
> hi all,
>
> I am using will_paginate plug_in i am getting URL as
>
> http://localhost:3000/admin/edit#/admin/edit?page=3
>
> but i want it should be
>
> http://localhost:3000/admin/edit?page=3
>
> how can I do it.
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Phusion Passenger Installation Problem

2009-03-10 Thread Bob Martens

I would check your rubygems version and then also ask in the Passenger
group as well.

On Mar 10, 4:21 am, elle  wrote:
> Hello,
>
> I am trying to install Passenger on Mac OS 10.5 but running:
> % sudo gem install passenger
> gives me:
>
> Error installing passenger:
>         invalid gem format for /Library/Ruby/Gems/1.8/cache/
> passenger-2.0.6.gem
>
> I don't remember having problems with other gems. Would anyone know
> what the problem is?
>
> Thanks,
> Elle
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Implementing a dashboard-style controller, (think iGoogle)

2009-03-10 Thread Starr Horne

> Unfortunately, I don't think a partial will work for my purposes.  I
> have a lot of partial use throughout my app to help create DRY views -
> even across different controllers - but in this case, I need full-
> fledged MVC components dynamically rendered in a div.  A partial will
> render a particular view, but I also need the controller, it's
> actions, and a set of params sent to it.

Yeah, I would avoid using components, as they're deprecated. And you may 
already know this, but just because a partial is rendered as a result of a 
request to a specific controller, that doesn't mean that the partial can't link 
to other controllers or render arbitrary content.

SH

-- 
Starr Horne
My blog: http://starrhorne.com
Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Phusion Passenger Installation Problem

2009-03-10 Thread Charles Johnson
On Tue, Mar 10, 2009 at 4:21 AM, elle  wrote:

>
> Hello,
>
> I am trying to install Passenger on Mac OS 10.5 but running:
> % sudo gem install passenger
> gives me:
>
> Error installing passenger:
>invalid gem format for /Library/Ruby/Gems/1.8/cache/
> passenger-2.0.6.gem
>
> I don't remember having problems with other gems. Would anyone know
> what the problem is?
>
> Thanks,
> Elle
>
What version of rubygems are you using?
Cheers--

Charles

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Implementing a dashboard-style controller, (think iGoogle)

2009-03-10 Thread Lasertoast

Thanks for the quick response!

Unfortunately, I don't think a partial will work for my purposes.  I
have a lot of partial use throughout my app to help create DRY views -
even across different controllers - but in this case, I need full-
fledged MVC components dynamically rendered in a div.  A partial will
render a particular view, but I also need the controller, it's
actions, and a set of params sent to it.

I may have found the answer myself a few minutes ago when I stumbled
upon a specialized render method called render_component.  This method
is actually exactly what I was looking for, but it looks like its
slated for deprecation in Rails 2.3.  Anyone familiar with this method
as far as advantages and disadvantages?  I'm assuming there are
problems with it since it is being removed (unless it's going to be
placed in a plugin that I'm unaware of).

Thanks again in advance for you help!


On Mar 10, 11:30 am, Starr Horne  wrote:
> On Tue, 10 Mar 2009 04:46:22 -0700 (PDT)
>
>
>
> Lasertoast  wrote:
>
> > I'm a relatively new Rails developer, but I think I have a good grasp
> > on the paradigm and I'm trying my best to adhere to RESTful standards.
>
> > First, let me describe the basic structure of my Rails app (only the
> > pieces relevant to my problem of course):
>
> > I have a User_Layouts controller.  Each User contains multiple
> > User_Layouts.  Each User_Layout entry describes a Module that the user
> > is subscribing to (and thus will be displayed on hisdashboard-
> > essentially a collection of User_Layouts).  Thus, the
> > User_Layouts#index should display adashboardcontaining all Modules
> > the User is subscribed to (very similar to iGoogle). I want to be able
> > to create these Modules easily (perhaps using a tailored generate
> > script) - each module having its own model, view, and controller.
>
> > My question is, what is the proper way to structure this?  When
> > User_Layouts#index is invoked, how to I tell Rails to render each
> > Module's view and place it in the proper div on the User_Layouts#index
> > view?  I've toyed with rendering partials, and render :update to
> > replace the innerHTML, but none of these seem elegant enough to be
> > standard practice.
>
> I would probably just create partials for each type of module. Then you can 
> use render :partial => @module, which will render the correct partial for the 
> object type.
>
> SH
> --
> Starr Horne
> My blog:http://starrhorne.com
> Check out my Helpdesk RailsKit:http://railskits.com/helpdesk/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Implementing a dashboard-style controller, (think iGoogle)

2009-03-10 Thread Lasertoast

Thanks for the quick response!

Unfortunately, I don't think a partial will work for my purposes.  I
have a lot of partial use throughout my app to help create DRY views -
even across different controllers - but in this case, I need full-
fledged MVC components dynamically rendered in a div.  A partial will
render a particular view, but I also need the controller, it's
actions, and a set of params sent to it.

I may have found the answer myself a few minutes ago when I stumbled
upon a specialized render method called render_component.  This method
is actually exactly what I was looking for, but it looks like its
slated for deprecation in Rails 2.3.  Anyone familiar with this method
as far as advantages and disadvantages?  I'm assuming there are
problems with it since it is being removed (unless it's going to be
placed in a plugin that I'm unaware of).

Thanks again in advance for you help!


On Mar 10, 11:30 am, Starr Horne  wrote:
> On Tue, 10 Mar 2009 04:46:22 -0700 (PDT)
>
>
>
> Lasertoast  wrote:
>
> > I'm a relatively new Rails developer, but I think I have a good grasp
> > on the paradigm and I'm trying my best to adhere to RESTful standards.
>
> > First, let me describe the basic structure of my Rails app (only the
> > pieces relevant to my problem of course):
>
> > I have a User_Layouts controller.  Each User contains multiple
> > User_Layouts.  Each User_Layout entry describes a Module that the user
> > is subscribing to (and thus will be displayed on hisdashboard-
> > essentially a collection of User_Layouts).  Thus, the
> > User_Layouts#index should display adashboardcontaining all Modules
> > the User is subscribed to (very similar to iGoogle). I want to be able
> > to create these Modules easily (perhaps using a tailored generate
> > script) - each module having its own model, view, and controller.
>
> > My question is, what is the proper way to structure this?  When
> > User_Layouts#index is invoked, how to I tell Rails to render each
> > Module's view and place it in the proper div on the User_Layouts#index
> > view?  I've toyed with rendering partials, and render :update to
> > replace the innerHTML, but none of these seem elegant enough to be
> > standard practice.
>
> I would probably just create partials for each type of module. Then you can 
> use render :partial => @module, which will render the correct partial for the 
> object type.
>
> SH
> --
> Starr Horne
> My blog:http://starrhorne.com
> Check out my Helpdesk RailsKit:http://railskits.com/helpdesk/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: finding out template's filename in application layout file code?

2009-03-10 Thread michael.hasenst...@googlemail.com

Well, it seems @_first_render.filename does the trick. Now, I'm just a
little unsure about the "_" in front - usually that denotes the
variable as "internal - don't use". Is there a "more official" way to
access this information?


On Mar 10, 5:34 pm, "michael.hasenst...@googlemail.com"
 wrote:
> Hi,
>
> I would like to access the filename of the (main) template used for a
> request, and I would like to do so in the (main application) layout
> template. I know about @template, but @template.template.filename
> yields the filename of the application template file, not of the view
> template file. On the other hand, the filename is in @template
> somewhere - I can see it when I look at @template.inspect. I'm just
> too stupid to find out where exactly...
>...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: chained search

2009-03-10 Thread Frederick Cheung

On Mar 10, 4:43 pm, Pesho Petrov 
wrote:

> In other words, each Member is in a Group, and has a Role in this
> Group(the triples member-group-role are defined in the model
> Membership). On the other hand, each Message is associated to a
> Membership. If we look at the two sets:
>    1. All Messages with is_pending=true
>    2. All the Memberships where Member m has role "admin"
> ... then I need the messages from (1.), which belong to the Memberships
> from (2.)
>
> I realize it's quite complicated, but if you can suggest me another way
> to achieve this, I'll be happy to change my approach.
>

One way to do this is to join the tables which have the extra
information so that you can then  put conditions on those. So at a
basic level if it was just messages and memberships the raw sql would
be something like

select messages.* from messages
inner join memberships on memberships.id = messages.membership_id
where some conditions on messages and memberships.

You don't need to write out all this, Message.find :all, :joins
=> :memberships, :conditions => [...]

You can join several layers down - there's some examples at
http://www.spacevatican.org/2008/8/8/nested-includes-and-joins

Fred


> Thanks!
> Petar
>
> --
> 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: High Priority Problem , when uploading image

2009-03-10 Thread Freddy Andersen

Could we get a look at the picture model? looks like it has issues at
line 6
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: 'unknow column error' when using include and associated table condition in find

2009-03-10 Thread Frederick Cheung



On Mar 10, 4:33 pm, boblu  wrote:
> So, after re-examine, I found that I have changed Lexeme.column_names
> in another models in validation process.
> Everything goes well in development environment because in development
> environment 'config.cache_classes' is set to false.
> so every request will reload code, and Lexeme.column_names get the
> right value every time.
> But in production environment,  'config.cache_classes' is set to true,
> my app coda get loaded only once,
> so I did not notice that Lexeme.column_names has been changed in other
> process.

Yup that would do it. All i meant by the last comment was that AR has
2 eager loading strategies, as explained by that blog post of mine you
found. Glad you got to the bottom of it!

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: Post request from controller

2009-03-10 Thread bill walton

Not sure that this is the only problem, but a couple of things pop out
at me ...

On Tue, 2009-03-10 at 08:26 -0700, bbtosurf wrote:
> I am sorry here it is again:
> 
> I have tried posting to test method and it doesn't do anything. The
> browser stays on waiting for response...and after a couple of minutes
> I get this:
> 
> Timeout::Error in BuildsController#create execution
> expired
> 
> def create

I don't think it's the source of your current problem since the POST is
happening, but it's more typical for the files in the require lines to
be loaded when the Class is loaded, rather than when a method is
invoked.  I'd move them outside the method.

>   require 'net/http'
>   require 'uri'


>   @build = Build.new(params[:build])
>   if @build.save
> res = Net::HTTP.post_form(URI.parse('http://localhost:3000/apps/1/
> build'),  {'q'=>'ruby', 'max'=>'50'})
>   end
> end

Two things:

1) Assuming we're inside the BuildsController, are you sure you've got a
route that maps the url above (/apps/1/build) to {:controller =>
'builds', :action => 'test'} ?.  Use rake:routes to see.  

2) You're posting to your own app.  In development mode you're probably
running one Mongrel.  That mongrel is tied up in the 'create' method
waiting for your POST to get a response.  It cannot process the request
in your 'test' method because it's stuck waiting, in the 'create'
method, until it receives the response to that request.

HTH,
Bill


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



[Rails] Re: chained search

2009-03-10 Thread Pesho Petrov

Frederick Cheung wrote:

> setup the usual associations (if this makes no sense to you then have
> a look at http://guides.rubyonrails.org/association_basics.html)
> 
> and then
> m.membership.member.name

Thanks, Frederick! I got it working.
However, now I need to do a more complicated/weird query...

In my model:

Message (fields: membership_id, is_pending)
belongs_to Membership

Membership (fields: member_id, team_id, role_id)
belongs_to Member
belongs_to Group
belongs_to Role

all the reverse associations are has_many

I would like to find all pending Messages, which belong to Memberships, 
whose group_id is one of the group_id-s where a certain Member m has a 
Role "admin"

In other words, each Member is in a Group, and has a Role in this 
Group(the triples member-group-role are defined in the model 
Membership). On the other hand, each Message is associated to a 
Membership. If we look at the two sets:
   1. All Messages with is_pending=true
   2. All the Memberships where Member m has role "admin"
... then I need the messages from (1.), which belong to the Memberships 
from (2.)

I realize it's quite complicated, but if you can suggest me another way 
to achieve this, I'll be happy to change my approach.

Thanks!
Petar

-- 
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] finding out template's filename in application layout file code?

2009-03-10 Thread michael.hasenst...@googlemail.com

Hi,

I would like to access the filename of the (main) template used for a
request, and I would like to do so in the (main application) layout
template. I know about @template, but @template.template.filename
yields the filename of the application template file, not of the view
template file. On the other hand, the filename is in @template
somewhere - I can see it when I look at @template.inspect. I'm just
too stupid to find out where exactly...

And this is what I would like to accomplish, and by the way, I
consider this a very basic function of a web framework:

- I don't use any Javascript generated by Rails. I don't like
Prototype, and I sure don't like inline Javascript
- I believe in separation of HTML and JS.
- I load any JS files AT THE END of the HTML (bottom of application
layout file)
- I load jquery (or YUI, that's the two JS-libs I like - jquery for
smaller jobs, YUI for real applications rather than just some add-on
code for a page), and then I add some page specific code. I have NO
code inline, and I sure won't let Rails insert any inline code, so as
I said, I don't use rails JS helpers or .rjs files. Ever. JS code
remains 100% separate.

- For page specific code I would like to use a file with the exact
same name as the .html.erb view file, in the same directory. I don't
want to have the JS code inline in the view file. That's bad not just
because I want it all logically separated, but also because editors
have a very hard time handling mixed HTML/CSS/JS code. Especially if
it's more than a few lines of code that means trouble. It is much
better to have JS code in a separate file.

- I would like my application layout template to look for .js files
for the current view template file, and if present, insert them into
the page (at the very bottom into a script section). The issue I have
and ask about right here would be the same if I inserted a link to
that JS file instead, but in order to avoid an additional HTTP
download I prefer to insert the code. It is guarded by an onDOMReady
event fired by the jquery or YUI library, which is loaded before that
page specific code.

What still prevents me from doing this is that I don't know how to
generically find out the name of the currently used view template
inside the ruby code of the application template layout file, and I
sure don't want to have to set a variable in the controller for this
purpose - I'm sure Rails has that info _somewhere_. Please help me
locate it :-)

Thanks!

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] Re: 'unknow column error' when using include and associated table condition in find

2009-03-10 Thread boblu

So sorry for the big argue.

After digging the following
find --> find_every --> find_with_associations
--> select_all_rows  -->
construct_finder_sql_with_included_associations
--> column_aliases,

I suddenly found that in production environment,
Lexeme.column_names 's result and
Lexeme.columns.map{ |column| column.name } 's are having big
difference.

This is definitely wrong, and I realize this is definitely a bug in my
app, not in rails.

So, after re-examine, I found that I have changed Lexeme.column_names
in another models in validation process.
Everything goes well in development environment because in development
environment 'config.cache_classes' is set to false.
so every request will reload code, and Lexeme.column_names get the
right value every time.
But in production environment,  'config.cache_classes' is set to true,
my app coda get loaded only once,
so I did not notice that Lexeme.column_names has been changed in other
process.

Anyway, I had a better idea of find, include, joins and the whole find
action in finding this bug.
Fred, thanks for your advices.

On 3月10日, 午後11:23, boblu  wrote:
> I forgot to mention that these error only come out in production
> environment.
> Everything goes well in development environment.
>
> I don't understand why the action of find is different in production
> and development environment.
>
> I have read this 
> posthttp://www.spacevatican.org/2008/4/29/include-and-conditions,
> and I know there are old and new ways of eager loading in rails.
> And in my case, the old way is exactly what I want to do.
>
> the last example in this 
> posthttp://www.spacevatican.org/2008/6/22/the-difference-between-include-...,
> did the same thing I post here, and it seems everything went ok, just
> like mine in development environment.
>
> I'm wondering are there anyone try running the same find in production
> environment?
> And does it output the same error?
>
> On 3月10日, 午後6:22, boblu  wrote:
>
> > Fred, thanks for the quick reply.
> > I did ask the same problem 5 month ago.
> > I managed to use join instead of include like this
>
> > Lexeme.find(:all, :conditions=>'structures.id<10', :joins=>'left outer
> > join structures on structures.ref_id=lexemes.id and
> > structures.meta_id=0')
>
> > Since usually I need to specify conditions that have both lexemes
> > table and structures table's fields,
> > I used SQL instead of regular association in the above joins,
> > because the regular association joins does a inner join which will
> > give me nothing when I only want to find those lexemes without any
> > structures.
>
> > And now (5 month later), the reason I ask this question again are
> > 1. nobody gave me a reason why include goes wrong
> > 2. I really want a collection with eager loading instead of piles of
> > rows which joins gives.
>
> > Sorry for my foolness, but I don't quite understand what you said here
>
> > > the reason there's a difference
> > > when you don't have a  condition on the structures table is that in
> > > that case AR does the include in a completely different way.
>
> > Can you please explain this to me in details?
> > 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: High Priority Problem , when uploading image

2009-03-10 Thread Colin Law
The trace suggests an problem in advert_controller.rb line 201. Have you had
a look there?

2009/3/10 Hamid Raza 

>
> i m uploading an image and found following error , plz n e buddi help me
> out ,
> thxx in advace ,
> my rails version is 2.2.2
> and ruby version is 1.8.7
> and i m using attachment_fu + mini_magick
>
> the error is
>
>
>
> Processing AdvertController#picture (for 127.0.0.1 at 2009-03-10
> 18:12:04) [POST]
>  Session ID: 16244113122f7096dbfc3daf1b4cb25a
>  Parameters: {"commit"=>"upload image", "action"=>"picture",
> "count"=>"1", "controller"=>"advert",
> "picture"=>{"uploaded_data"=>#}}
>
>
> NoMethodError (undefined method `[]' for
> #):
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/string/access.rb:43:in
> `first'
>
>  
> /home/hamid/rails/arabibay/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:70:in
> `has_attachment'
>/home/hamid/rails/arabibay/app/models/picture.rb:6
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in
> `load_without_new_constant_marking'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in
> `load_file'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in
> `new_constants_in'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:202:in
> `load_file'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:94:in
> `require_or_load'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:248:in
> `load_missing_constant'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in
> `const_missing'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:464:in
> `const_missing'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:470:in
> `send'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:470:in
> `const_missing'
>/home/hamid/rails/arabibay/app/controllers/advert_controller.rb:201:in
> `picture'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:1101:in
> `send'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:1101:in
> `perform_action_without_filters'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:696:in
> `call_filters'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:688:in
> `perform_action_without_benchmark'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/benchmarking.rb:66:in
> `perform_action_without_rescue'
>/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/benchmarking.rb:66:in
> `perform_action_without_rescue'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/rescue.rb:83:in
> `perform_action'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:435:in
> `send'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:435:in
> `process_without_filters'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:684:in
> `process_without_session_management_support'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/session_management.rb:114:in
> `process'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:334:in
> `process'
>/usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/dispatcher.rb:41:in
> `dispatch'
>
>  /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in
> `process'
>
>  /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
> `synchronize'
>
>  /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
> `process'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in
> `process_client'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
> `each'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
> `process_client'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
> `run'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
> `initialize'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
> `new'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
> `run'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
> `initialize'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
> `new'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
> `run'
>
>  /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in
> `run'
>
>  /usr/lib/ruby/gems/1.8/g

[Rails] Re: any body please help me

2009-03-10 Thread CFC
Downgrade your Ruby to Ruby 1.8.6

On Tue, Mar 10, 2009 at 11:59 PM, Hamid Raza <
rails-mailing-l...@andreas-s.net> wrote:

>
>  High Priority Problem , when uploading image
> Posted by Hamid Raza (hamidraza)
> on 10.03.2009 15:55
>
> i m uploading an image and found following error , plz n e buddi help me
> out ,
> thxx in advace ,
> my rails version is 2.2.2
> and ruby version is 1.8.7
> and i m using attachment_fu + mini_magick
>
> the error is
>
>
>
> Processing AdvertController#picture (for 127.0.0.1 at 2009-03-10
> 18:12:04) [POST]
>  Session ID: 16244113122f7096dbfc3daf1b4cb25a
>  Parameters: {"commit"=>"upload image", "action"=>"picture",
> "count"=>"1", "controller"=>"advert",
> "picture"=>{"uploaded_data"=>#}}
>
>
> NoMethodError (undefined method `[]' for
> #):
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/string/access.rb:43:in
> `first'
>
>  
> /home/hamid/rails/arabibay/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:70:in
> `has_attachment'
>/home/hamid/rails/arabibay/app/models/picture.rb:6
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in
> `load_without_new_constant_marking'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in
> `load_file'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in
> `new_constants_in'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:202:in
> `load_file'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:94:in
> `require_or_load'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:248:in
> `load_missing_constant'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in
> `const_missing'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:464:in
> `const_missing'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:470:in
> `send'
>
>  
> /usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:470:in
> `const_missing'
>/home/hamid/rails/arabibay/app/controllers/advert_controller.rb:201:in
> `picture'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:1101:in
> `send'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:1101:in
> `perform_action_without_filters'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:696:in
> `call_filters'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:688:in
> `perform_action_without_benchmark'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/benchmarking.rb:66:in
> `perform_action_without_rescue'
>/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/benchmarking.rb:66:in
> `perform_action_without_rescue'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/rescue.rb:83:in
> `perform_action'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:435:in
> `send'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:435:in
> `process_without_filters'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:684:in
> `process_without_session_management_support'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/session_management.rb:114:in
> `process'
>
>  
> /usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:334:in
> `process'
>/usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/dispatcher.rb:41:in
> `dispatch'
>
>  /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in
> `process'
>
>  /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
> `synchronize'
>
>  /usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
> `process'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in
> `process_client'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
> `each'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
> `process_client'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
> `run'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
> `initialize'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
> `new'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
> `run'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
> `initialize'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
> `new'
>/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
> `run'
>
>

[Rails] any body please help me

2009-03-10 Thread Hamid Raza

 High Priority Problem , when uploading image
Posted by Hamid Raza (hamidraza)
on 10.03.2009 15:55

i m uploading an image and found following error , plz n e buddi help me
out ,
thxx in advace ,
my rails version is 2.2.2
and ruby version is 1.8.7
and i m using attachment_fu + mini_magick

the error is



Processing AdvertController#picture (for 127.0.0.1 at 2009-03-10
18:12:04) [POST]
  Session ID: 16244113122f7096dbfc3daf1b4cb25a
  Parameters: {"commit"=>"upload image", "action"=>"picture",
"count"=>"1", "controller"=>"advert",
"picture"=>{"uploaded_data"=>#}}


NoMethodError (undefined method `[]' for
#):

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/string/access.rb:43:in
`first'

/home/hamid/rails/arabibay/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:70:in
`has_attachment'
/home/hamid/rails/arabibay/app/models/picture.rb:6

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in
`load_without_new_constant_marking'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in
`load_file'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in
`new_constants_in'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:202:in
`load_file'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:94:in
`require_or_load'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:248:in
`load_missing_constant'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in
`const_missing'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:464:in
`const_missing'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:470:in
`send'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:470:in
`const_missing'
/home/hamid/rails/arabibay/app/controllers/advert_controller.rb:201:in
`picture'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:1101:in
`send'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:1101:in
`perform_action_without_filters'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:696:in
`call_filters'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:688:in
`perform_action_without_benchmark'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/benchmarking.rb:66:in
`perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/benchmarking.rb:66:in
`perform_action_without_rescue'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/rescue.rb:83:in
`perform_action'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:435:in
`send'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:435:in
`process_without_filters'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:684:in
`process_without_session_management_support'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/session_management.rb:114:in
`process'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:334:in
`process'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/dispatcher.rb:41:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in
`process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
`synchronize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
`process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in
`process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
`each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
`process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
`initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
`new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
`initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
`new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in
`each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in
`ru

[Rails] Re: adzap-AR_Mailer sending email error

2009-03-10 Thread Sean McGilvray
Borja Martín:  If I am on a shared hosting how do I use 1.8.6 instead of
1.8.7?


Sean


On Mon, Mar 9, 2009 at 7:31 PM, Borja Martín  wrote:

> I guess you have installed Ruby 1.8.7
> if so, install 1.8.6 and try it again
>
> Regards
>
> On Mon, Mar 9, 2009 at 8:03 PM, Sean McGilvray wrote:
>
>>
>> I am getting the following error when I try to send an email using the
>> ar_mailer:
>>
>> Unhandled exception wrong number of arguments (7 for 6)
>> (ArgumentError):
>>
>> I found an article that stated the following
>>
>> "My problem is the number of arguments passed for mail account
>> configuration in environment.rb does not match the number of arguments
>> that ar_sendmail required (6 for 7 as you see in the error message).
>>
>> The solution is: make them match either by providing the all required
>> arguments or delete those unavailable arguments (for you) in the
>> ar_sendmail function."
>>
>> I am new to RoR and need a little help with what I should do to fix
>> this problem.
>>
>> Thank you,
>>
>> Sean McGIlvray
>>
>>
>
>
> --
> /**
> * dagi3d v4 | http://dagi3d.net
> */
>
> >
>

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



[Rails] Re: Implementing a dashboard-style controller, (think iGoogle)

2009-03-10 Thread Starr Horne

On Tue, 10 Mar 2009 04:46:22 -0700 (PDT)
Lasertoast  wrote:

> 
> I'm a relatively new Rails developer, but I think I have a good grasp
> on the paradigm and I'm trying my best to adhere to RESTful standards.
> 
> First, let me describe the basic structure of my Rails app (only the
> pieces relevant to my problem of course):
> 
> I have a User_Layouts controller.  Each User contains multiple
> User_Layouts.  Each User_Layout entry describes a Module that the user
> is subscribing to (and thus will be displayed on his dashboard -
> essentially a collection of User_Layouts).  Thus, the
> User_Layouts#index should display a dashboard containing all Modules
> the User is subscribed to (very similar to iGoogle). I want to be able
> to create these Modules easily (perhaps using a tailored generate
> script) - each module having its own model, view, and controller.
> 
> My question is, what is the proper way to structure this?  When
> User_Layouts#index is invoked, how to I tell Rails to render each
> Module's view and place it in the proper div on the User_Layouts#index
> view?  I've toyed with rendering partials, and render :update to
> replace the innerHTML, but none of these seem elegant enough to be
> standard practice.

I would probably just create partials for each type of module. Then you can use 
render :partial => @module, which will render the correct partial for the 
object type.

SH
-- 
Starr Horne
My blog: http://starrhorne.com
Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: finding and deleting in activerecord array

2009-03-10 Thread Davi Vidal

On 03/10/2009 09:54 AM, Tarscher wrote:
> I know how to access the users but  I don't know how to search in the
> array (not the database) and then delete a user if a match is found.
>

So, provide examples and don't do top-posting.

group: 1
user: 1

group = Group.find(1)
user = group.users.find(1)
user.delete

HTH,

davi

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: crypto in Rails 2.x?

2009-03-10 Thread Charles Johnson
On Tue, Mar 10, 2009 at 10:15 AM, Jeff Pritchard <
rails-mailing-l...@andreas-s.net> wrote:

>
> MaD wrote:
> > depends on what you are looking for. if want to have a one-way
> > function (for passwords and such) just try it like this:
> >
> >   encrypted_item = Digest::SHA256.hexdigest(�string_to_encrypt�)
> >
> > you could also use SHA1, SHA384, SHA512 depending on your need of
> > security.
>
> Thanks, but I need to decrypt it also.  It is "for your eyes only" user
> data.
>
> thanks,
> jp
>
There is a ruby-aes-normal gem. I have never used it. Have you looked at?

Cheers--

Charles

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Post request from controller

2009-03-10 Thread bbtosurf

I am sorry here it is again:

I have tried posting to test method and it doesn't do anything. The
browser stays on waiting for response...and after a couple of minutes
I get this:

Timeout::Error in BuildsController#create execution
expired

def create
  require 'net/http'
  require 'uri'
  @build = Build.new(params[:build])
  if @build.save
res = Net::HTTP.post_form(URI.parse('http://localhost:3000/apps/1/
build'),  {'q'=>'ruby', 'max'=>'50'})
  end
end

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



[Rails] How do I organize my model code?

2009-03-10 Thread David Dennis

I have a basic question.  I've been working with Rails for a couple
months now, and I've read the O'Reilly book on it, but once I started
making a basic sized application, it seems like my main model "List" has
waaay too much code, and I want to break it down into classes and
subclasses.

Most of the code in "List" is for HTML parsing, so as a first step, I
would want to make a class "Parser" that is accessible to "List."

But I have so many questions about how to create this new class:

Where do I put "Parser"?
 - In "List" as another class?
Is OOP in Rails only centered around database objects?
 - Would I have to make a "Parser" model?
- Even if there's no DB table for "Parser"?
Is there any guide to Rails best programming practices?

Thanks,
David
-- 
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: Post request from controller

2009-03-10 Thread bbtosurf

I have tried posting to test method and it doesn't do anything. The
browser stays on waiting for response...and after a couple of minutes
I get this: Timeout::Error in BuildsController#create execution
expired def create require 'net/http' require 'uri' @build = Build.new
(params[:build]) if @build.save res = Net::HTTP.post_form(URI.parse
('http://localhost:3000/apps/1/build'),  {'q'=>'ruby', 'max'=>'50'})
end end def test puts params[:q] puts params[:max] end



sin la parte del delicioso
On Mar 9, 7:12 pm, bill walton  wrote:
> On Mon, 2009-03-09 at 16:42 -0700, bbtosurf wrote:
> > Can anyone give me any ideas on how to do this multipart
> > post in my controller?
>
> See the documentation on Ruby's Net::HTTP 
> libraryhttp://www.ruby-doc.org/stdlib/libdoc/net/http/rdoc/index.html
>
> In your controller you'll have something like...
>
> Class MyController < ActionController
>   require 'net/http'
>
>   def make_contact
>     my_connection = Net::HTTP.new('www.target.com', 80)
>     reponse = my_connection.post(path_within_url, data)
>     #do something with response if you want
>   end
>
> end
>
> IIRC you'll need to set a Content-Type prior to the post. Can't remember
> the setting syntax for the off the top of my head.
>
> HTH,
> Bill
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: crypto in Rails 2.x?

2009-03-10 Thread Jeff Pritchard

MaD wrote:
> depends on what you are looking for. if want to have a one-way
> function (for passwords and such) just try it like this:
> 
>   encrypted_item = Digest::SHA256.hexdigest(�string_to_encrypt�)
> 
> you could also use SHA1, SHA384, SHA512 depending on your need of
> security.

Thanks, but I need to decrypt it also.  It is "for your eyes only" user 
data.

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

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



[Rails] Re: Annoying pop up window with restful_authentication

2009-03-10 Thread Youyou Semsem

Starr Horne wrote:
>> Thanks rubyguy. It's expected that the user isn't logged in. Let me 
>> summarize my problem. When the user clicks on a link_to (html) the 
>> redirection to the login page works fine. But when the user clicks on 
>> link_to_remote (js) the popup comes into play. Ideally i want the last 
>> case to redirect to the login page similar to html.
> 
> The way to do this is to have your authentication code return a json 
> response code like {status: 'not logged in'}. Then your client side JS 
> parses that and redirects if required.
> 
> I may be wrong but I don't know of an automatic way to do this. It would 
> require a little work.
> 
> SH
> --
> Starr Horne
> My blog: http://starrhorne.com
> Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/

Thanks Starr. Can you please tell me how to do the json status? Is it 
something, that I put in the access_denied method? Should I just add 
this: {status: 'not logged in'}?


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

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



[Rails] Implementing a dashboard-style controller, (think iGoogle)

2009-03-10 Thread Lasertoast

I'm a relatively new Rails developer, but I think I have a good grasp
on the paradigm and I'm trying my best to adhere to RESTful standards.

First, let me describe the basic structure of my Rails app (only the
pieces relevant to my problem of course):

I have a User_Layouts controller.  Each User contains multiple
User_Layouts.  Each User_Layout entry describes a Module that the user
is subscribing to (and thus will be displayed on his dashboard -
essentially a collection of User_Layouts).  Thus, the
User_Layouts#index should display a dashboard containing all Modules
the User is subscribed to (very similar to iGoogle). I want to be able
to create these Modules easily (perhaps using a tailored generate
script) - each module having its own model, view, and controller.

My question is, what is the proper way to structure this?  When
User_Layouts#index is invoked, how to I tell Rails to render each
Module's view and place it in the proper div on the User_Layouts#index
view?  I've toyed with rendering partials, and render :update to
replace the innerHTML, but none of these seem elegant enough to be
standard practice.

Any ideas from the Rails experts out there?

Any help is greatly appreciated!

Jarad D.

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



[Rails] Validations on parent and accepts_nested_attributes_for don't comply?

2009-03-10 Thread Ronald Wind

Hello,

I've got two models:

class ProductGroup < ActiveRecord::Base
   has_many :fields, :dependent => :destroy
   accepts_nested_attributes_for :fields
end

class Field < ActiveRecord::Base
   belongs_to :product_group
   validates_presence_of :product_group
end


Now when I try something like this:
ProductGroup.create(:title => "foo", :fields_attributes => {"new_1" => 
{:title => "bar"}})
it'll fail because of the validates_presence_of :product_group 
validation. Since the field is being build by the 
product_group.fields.build function (in 
assign_nested_attributes_for_collection_association of the 
NestedAttributes module) the product reference of field is not set 
because the ProductGroup instance is not saved yet, and hence the 
validation fails.

Now if I remove the validation all goes well and both objects are saved 
as they should.

Is there a better / other way to make sure a Field can only be saved 
when it has a reference to a ProductGroup while still being able to use 
the nested attributes functionality?

Thanks,

Ronald

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Annoying pop up window with restful_authentication

2009-03-10 Thread Starr Horne

> Thanks rubyguy. It's expected that the user isn't logged in. Let me 
> summarize my problem. When the user clicks on a link_to (html) the 
> redirection to the login page works fine. But when the user clicks on 
> link_to_remote (js) the popup comes into play. Ideally i want the last 
> case to redirect to the login page similar to html.

The way to do this is to have your authentication code return a json response 
code like {status: 'not logged in'}. Then your client side JS parses that and 
redirects if required. 

I may be wrong but I don't know of an automatic way to do this. It would 
require a little work.

SH
-- 
Starr Horne
My blog: http://starrhorne.com
Check out my Helpdesk RailsKit: http://railskits.com/helpdesk/


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



[Rails] High Priority Problem , when uploading image

2009-03-10 Thread Hamid Raza

i m uploading an image and found following error , plz n e buddi help me
out ,
thxx in advace ,
my rails version is 2.2.2
and ruby version is 1.8.7
and i m using attachment_fu + mini_magick

the error is



Processing AdvertController#picture (for 127.0.0.1 at 2009-03-10
18:12:04) [POST]
  Session ID: 16244113122f7096dbfc3daf1b4cb25a
  Parameters: {"commit"=>"upload image", "action"=>"picture",
"count"=>"1", "controller"=>"advert",
"picture"=>{"uploaded_data"=>#}}


NoMethodError (undefined method `[]' for
#):

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/core_ext/string/access.rb:43:in
`first'

/home/hamid/rails/arabibay/vendor/plugins/attachment_fu/lib/technoweenie/attachment_fu.rb:70:in
`has_attachment'
/home/hamid/rails/arabibay/app/models/picture.rb:6

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in
`load_without_new_constant_marking'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:203:in
`load_file'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:342:in
`new_constants_in'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:202:in
`load_file'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:94:in
`require_or_load'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:248:in
`load_missing_constant'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:452:in
`const_missing'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:464:in
`const_missing'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:470:in
`send'

/usr/lib/ruby/gems/1.8/gems/activesupport-1.4.4/lib/active_support/dependencies.rb:470:in
`const_missing'
/home/hamid/rails/arabibay/app/controllers/advert_controller.rb:201:in
`picture'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:1101:in
`send'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:1101:in
`perform_action_without_filters'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:696:in
`call_filters'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:688:in
`perform_action_without_benchmark'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/benchmarking.rb:66:in
`perform_action_without_rescue'
/usr/lib/ruby/1.8/benchmark.rb:293:in `measure'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/benchmarking.rb:66:in
`perform_action_without_rescue'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/rescue.rb:83:in
`perform_action'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:435:in
`send'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:435:in
`process_without_filters'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/filters.rb:684:in
`process_without_session_management_support'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/session_management.rb:114:in
`process'

/usr/lib/ruby/gems/1.8/gems/actionpack-1.13.6/lib/action_controller/base.rb:334:in
`process'
/usr/lib/ruby/gems/1.8/gems/rails-1.2.6/lib/dispatcher.rb:41:in
`dispatch'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:76:in
`process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
`synchronize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/rails.rb:74:in
`process'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:159:in
`process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
`each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:158:in
`process_client'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
`initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
`new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:285:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
`initialize'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
`new'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel.rb:268:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:282:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in
`each'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/configurator.rb:281:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/mongrel_rails:128:in
`run'
/usr/lib/ruby/gems/1.8/gems/mongrel-1.1.5/lib/mongrel/command.rb:212:in
`run'
/usr/lib/ru

[Rails] Re: nested content_tag link, span, image

2009-03-10 Thread Jeremy Weiskotten

Michael Delaney wrote:
> hi,
> 
> i'm trying to render this html:
> 
> 
> clear cart !
> 
> 
> 
> 
> 
> the best i can do is:
> 
> <%= link_to content_tag(:span, image_tag("img/clear.png", :alt =>
> 'arrow')), clear_cart_path, :class => "big_button", :title => "clear"
> -%>
> 
> 
> any ideas???
> 
> cheers.

First, I'd move the content_tag code into a helper.

def clear_cart_button
content_tag(:span, 'clear cart !' + image_tag("img/clear.png", :alt 
=> 'arrow'))
end

Then in your view...

<%= link_to clear_cart_button, clear_cart_path, :class => "big_button", 
:title => "clear" %>


Assuming you've added the clear_cart named route, that should work.
-- 
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: If else not working?

2009-03-10 Thread Jeremy Weiskotten

Chris Gunnels wrote:

> def index
> @oLogin = User.find_by_login(params[:l])
> if @oLogin.login
>   @sLoggedInName = @oLogin.login + ", you've logged in successfully"
> else
>   render :controller => 'sessions'
> end
>   end

Aesthetically, I'd change @oLogin to @user, since User.find... will 
return a User instance. I'd also avoid Hungarian notation and camelCase 
variable names.

I think the actual problem is that your call to render is wrong. I'm 
guessing you want a redirect. You might also want to read up on flash 
for messaging to the user. I'd probably write this method something like 
this:


def index
  @user = User.find_by_login(params[:l])
  if @user
flash[:notice] = "#...@user.login}, you've logged in successfully"
  else
redirect_to :controller => 'sessions', :action => 'new'
  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] Re: 'unknow column error' when using include and associated table condition in find

2009-03-10 Thread boblu

I forgot to mention that these error only come out in production
environment.
Everything goes well in development environment.

I don't understand why the action of find is different in production
and development environment.

I have read this post 
http://www.spacevatican.org/2008/4/29/include-and-conditions,
and I know there are old and new ways of eager loading in rails.
And in my case, the old way is exactly what I want to do.

the last example in this post 
http://www.spacevatican.org/2008/6/22/the-difference-between-include-and-joins,
did the same thing I post here, and it seems everything went ok, just
like mine in development environment.

I'm wondering are there anyone try running the same find in production
environment?
And does it output the same error?

On 3月10日, 午後6:22, boblu  wrote:
> Fred, thanks for the quick reply.
> I did ask the same problem 5 month ago.
> I managed to use join instead of include like this
>
> Lexeme.find(:all, :conditions=>'structures.id<10', :joins=>'left outer
> join structures on structures.ref_id=lexemes.id and
> structures.meta_id=0')
>
> Since usually I need to specify conditions that have both lexemes
> table and structures table's fields,
> I used SQL instead of regular association in the above joins,
> because the regular association joins does a inner join which will
> give me nothing when I only want to find those lexemes without any
> structures.
>
> And now (5 month later), the reason I ask this question again are
> 1. nobody gave me a reason why include goes wrong
> 2. I really want a collection with eager loading instead of piles of
> rows which joins gives.
>
> Sorry for my foolness, but I don't quite understand what you said here
>
> > the reason there's a difference
> > when you don't have a  condition on the structures table is that in
> > that case AR does the include in a completely different way.
>
> Can you please explain this to me in details?
> 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: RoR on Bluehost

2009-03-10 Thread Paul Reitz

Uhm yeah. To specify, when I said I copied and pasted the user name and 
password and stuff, I meant that I copied it from cpanel on the second 
account, to make sure that the user name, password, and database name 
were correct. Also, I'm not trying to access mysql as root, that's the 
point. That's why the error makes no sense. I don't know why it's trying 
to access the database as root, it shouldn't be.

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

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



[Rails] Multiple Active Record Connection

2009-03-10 Thread Valentino Lun

Dear all

My ActiveRecord::Base is connected to server_a (local server), has a
Server model contains about 100 server records (remote server).

I use the following block to retrieve the server infomation. It works
fine.

Server.find_all_by_server_type("sybase_t").each do |s|

if s.server_name =~ /^LIS_..._ST1[0-2]/ and s.is_active?
  class Order < ActiveRecord::Base
set_table_name = "orders"
  end
  Order.establish_connection s.connection_hash

  begin
puts "#{s.server_name} has #{Order.count} orders"
  rescue
puts "#{s.server_name} is down"
  end

end
end


I want to create another model OrderDetail in the remote server (see
below code). It does not work. It said "TypeError: superclass mismatch
for class OrderDetail".

Server.find_all_by_server_type("sybase_t").each do |s|
if s.server_name =~ /^LIS_..._ST1[0-2]/ and s.is_active?
  class Order < ActiveRecord::Base
set_table_name = "orders"
  end
  Order.establish_connection s.connection_hash
  class OrderDetail < ActiveRecord::Base
set_table_name = "order_detail"
  end
  OrderDetail.establish_connection s.connection_hash
  begin
puts "#{s.server_name} has #{Order.count} orders and
#{OrderDetail.count} order_detail"
  rescue
puts "#{s.server_name} is down"
  end
end
end


I used google and find that the error will happen if the code like this
http://railsforum.com/viewtopic.php?id=10993

   1. class Cool
   2. end
   3.
   4. class SpecialCool < Cool
   5. end
   6.
   7. class SpecialCool # this line will raise an error
   8. end

How can I change my code so that I can have more than 1 models in the
remote server?

Thank you very much
Valentino
-- 
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: RoR on Bluehost

2009-03-10 Thread Geekyra

at least create ur own MySQL account from ur cpanel
U can't access the database as root.

On Mar 10, 7:44 pm, Paul Reitz 
wrote:
> Hi all. I'm having problems getting a RoR app to run on bluehost. Here's
> the rundown. First I'm frustrated because I have two accounts, I've
> gotten an app to run on one account, and I can't get one running on the
> other. And I'm pretty sure I did everything the same.
>
> On the one that isn't working, I keep getting the error page. When I
> launch the console and try something like;
> user = User.new
> I get this error:
> Mysql::Error: Access denied for user 'root'@'localhost' (using password:
> YES)
>
> Here's what I have in database.yml
> production:
>   adapter: mysql
>   database: ***
>   user: **
>   password: **
>   host: localhost
>   socket: /var/lib/mysql/mysql.sock
>   timeout: 5000
>
> I copied and pasted the database name, user name and password (database
> name and user name are prepended with my account name)
>
> I've checked the permissions on the public folder and on dispatch.*
> I need to get this site running asap, anyone have any ideas?
> --
> 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: Annoying pop up window with restful_authentication

2009-03-10 Thread Youyou Semsem

ruby...@ymail.com wrote:
> On 10 Mar., 14:21, Youyou Semsem 
> wrote:
>> ruby...@ymail.com wrote:
>> > The #request_http_basic_authentication method prompts the user for a
>> > password. Maybe that is the "popup" you're talking about.
>>
>> Yes I confirm that it is. When I remove it. Nothing happens when you
>> click on a link_to_remote (js)
> 
> Then I guess it's because the user is not authenticated. The method is
> called #access_denied, you know. Maybe you're having problems with
> sessions or something similar. Do you have a #logged_in? method, and
> if yes, what does it return?

Thanks rubyguy. It's expected that the user isn't logged in. Let me 
summarize my problem. When the user clicks on a link_to (html) the 
redirection to the login page works fine. But when the user clicks on 
link_to_remote (js) the popup comes into play. Ideally i want the last 
case to redirect to the login page similar to html.

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

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



[Rails] Re: How to test for a Null or empty object?

2009-03-10 Thread Phlip

>> Also, nobody around here uses HN like oLogin. We know it's an 'o'bject 
>> already!
> 
> good point...I come from a PHP background so not everything is an 
> object, I just have to get used to that.

Ruby offers very flexible syntax, with many different alternatives for each 
statement, so we generally try to select the sequence that...

 ...most closely resembles English...

...or whatever your favorite human language is.


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



[Rails] Re: ActiveRecord with **some** columns mapped to database?

2009-03-10 Thread Kretch Kretchmer

Frederick Cheung wrote:
> On Mar 10, 5:15�am, Kretch Kretchmer  s.net> wrote:
>> create OA objects through Ruby, store them in OA etc.
>>
>> I would like to combine the two - i.e. have �n "activerecord"-like
>> object, where some columns are stored directly in an *SQL table, but
>> other columns are mapped to OA objects. That way I can use the Rails
>> framework while utilizing the compact OA database.
>>
> 
> store the OA data as a blob column on the corresponding activerecord
> or store as a text column whatever info you need to get the info out
> of OA ?
> 
> Fred

The issue is that for a given object there might be a huge amount of 
data stored in OA (up to many millions of objects), so translating it to 
text and storing in activerecord will require lots of space and take a 
lot of time. I'm looking to combine the superior storage of OA with the 
great infrastructure you get for activerecord

Kretch
-- 
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: Annoying pop up window with restful_authentication

2009-03-10 Thread ruby...@ymail.com

On 10 Mar., 14:21, Youyou Semsem 
wrote:
> ruby...@ymail.com wrote:
> > The #request_http_basic_authentication method prompts the user for a
> > password. Maybe that is the "popup" you're talking about.
>
> Yes I confirm that it is. When I remove it. Nothing happens when you
> click on a link_to_remote (js)

Then I guess it's because the user is not authenticated. The method is
called #access_denied, you know. Maybe you're having problems with
sessions or something similar. Do you have a #logged_in? method, and
if yes, what does it return?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Annoying pop up window with restful_authentication

2009-03-10 Thread Youyou Semsem

ruby...@ymail.com wrote:
> On 10 Mar., 05:41, Youyou Semsem 
> wrote:
>> Hi,
>> I have this annoying popup window for Web Password whenever a click on a
>> javascript action which require authentication. I have the problem for
>> FF, IE and Chrome. The problem isn't seen for non javascript action
>> where the user gets redirected to the html login page. Ideally, I want
>> even js to redirect there. Here is my access_denied. By the way, I tried
>> removing the format.any(:xml,:js) completely and the page just don't
>> react when I click on JS.
>>
>> def access_denied
> 
>> � � � � � request_http_basic_authentication 'Web Password'
> 
>> � � end
> 
> The #request_http_basic_authentication method prompts the user for a
> password. Maybe that is the "popup" you're talking about.

Yes I confirm that it is. When I remove it. Nothing happens when you 
click on a link_to_remote (js)
-- 
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: RoR on Bluehost

2009-03-10 Thread Sean McGilvray

Wouldn't you database name and user name be different for the  
different account?  If you just copied them then your trying to access  
the database name under the other account. If I am not mistaken you  
can not do this with shared hosting on bluehost.

Sean McGilvray

Sent from my iPhone

On Mar 10, 2009, at 5:44 AM, Paul Reitz  wrote:

>
> Hi all. I'm having problems getting a RoR app to run on bluehost.  
> Here's
> the rundown. First I'm frustrated because I have two accounts, I've
> gotten an app to run on one account, and I can't get one running on  
> the
> other. And I'm pretty sure I did everything the same.
>
> On the one that isn't working, I keep getting the error page. When I
> launch the console and try something like;
> user = User.new
> I get this error:
> Mysql::Error: Access denied for user 'root'@'localhost' (using  
> password:
> YES)
>
> Here's what I have in database.yml
> production:
>  adapter: mysql
>  database: ***
>  user: **
>  password: **
>  host: localhost
>  socket: /var/lib/mysql/mysql.sock
>  timeout: 5000
>
> I copied and pasted the database name, user name and password  
> (database
> name and user name are prepended with my account name)
>
> I've checked the permissions on the public folder and on dispatch.*
> I need to get this site running asap, anyone have any ideas?
> -- 
> Posted via http://www.ruby-forum.com/.
>
> >

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



[Rails] Re: How to test for a Null or empty object?

2009-03-10 Thread Chris Gunnels

Colin Law wrote:
> I think it is @oLogin that you need to test for nil before accessing
> @oLogin.login. This is to check whether the find returned anything.
> 
> 2009/3/10 Chris Gunnels 

Thx...

> Also, nobody around here uses HN like oLogin. We know it's an 'o'bject 
> already!

good point...I come from a PHP background so not everything is an 
object, I just have to get used to 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
-~--~~~~--~~--~--~---



  1   2   >