[Rails] Re: German letter ä, ö, ü in rfpdf

2009-04-14 Thread Salil Gaikwad

Hi all,
 anyone found any solution for  German letter ä, ö, ü in rf pdf
i'm facing same problem and i must have tto use PDF::Writer on linux.

Regards,

Salil

-- 
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: CSS issue...

2009-04-14 Thread Svetlana Vt

Abhishek shukla wrote:
> How can i call a stylesheet other then from /public/stylesheets/ 
> folder..

<%= stylesheet_link_tag "/themes/style" %>
must be 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: CSS issue...

2009-04-14 Thread Abhishek shukla

How can i call a stylesheet other then from /public/stylesheets/ folder..



On 4/14/09, Shandy Nantz  wrote:
>
> Abhishek shukla wrote:
>> Hello friends
>> I am calling css file from following folder
>> "<%= stylesheet_path("#{RAILS_ROOT}/public/themes/style.css") %>"
>> And getting the following error any idea?
>> ActionController::RoutingError (No route matches
>> "/home/user/test/testapp/public/themes/style.css" with {:method=>:get}):
>>
>> Regards
>> Abhi
>
> Is this code in between your head tags? Can't you use:
> <%= stylesheet_link_tag "style" %>
> --
> 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: Passenger caching in development mode, wtf?

2009-04-14 Thread Petr Janda

This makes no difference. The problem is with mongrel is that I need the 
devel applications to be accessible even when im not developing, ie. 
client review. And id need to make a start up script in case i reboot 
the server to make all the mongrels start up. Its just hassle. 
dispatch.cgi/fcgi was ideal for simple setup in development mode where 
speed usually doesnt matter.


PP Junty wrote:
> perhaps here:
> 
> http://www.modrails.com/documentation/Users%20guide.html#RailsSpawnMethod
> 
> but can't you use mongrel for development and passenger for production?
> 
> Petr Janda wrote:
>> I just tested with Ruby 1.8 and its the same behaviour.
>> 
>> An clues people?

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

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



[Rails] Re: About haml and ruby on rail

2009-04-14 Thread Nilesh Kulkarni

Marnen Laibow-Koser wrote:
> Nilesh Kulkarni wrote:
> 
> So you probably have a missing parenthesis or something like that.  But 
> we can't tell for sure without seeing the Haml file.
> 
> Best,
> --
> Marnen Laibow-Koser
> http://www.marnen.org
> mar...@marnen.org

code of show.html.erb and show.html.haml is in "haml_and_html_file.txt"
attachment whth first post..
-- 
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] Plugin or just a zip file...

2009-04-14 Thread Sudhi Kulkarni

Hi ,

I am thinking of having a plugin to provide the updates to a set of
around 20 ruby file I ship with my rails application. I plan to place
the files in vendor/plugins/test folder...

Should I make test as a plugin or just provide updates in a zip file?

What is the rails suggested way. These files are only used as include
files for a few operations, they in no way are required to alter
Model/View or Controller.

Thanks,
Sudhindra
-- 
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: Passenger caching in development mode, wtf?

2009-04-14 Thread PP Junty

perhaps here:

http://www.modrails.com/documentation/Users%20guide.html#RailsSpawnMethod

but can't you use mongrel for development and passenger for production?

Petr Janda wrote:
> I just tested with Ruby 1.8 and its the same behaviour.
> 
> An clues people?

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

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



[Rails] Re: Rating Model and DB Relationships

2009-04-14 Thread Marnen Laibow-Koser

Srdjan Pejic wrote:
[...]
> The unique
> constraint in the db schema can be viewed as a backup.
> 
> I'll answer your main question shortly.

A philosophical quibble: in my opinion, it is the unique constraint in 
the DB that should be considered primary.  The validation in the 
application layer is only there to prevent the DB from throwing 
duplicate key errors.  Application-level validation cannot replace a 
properly constructed database schema.

I'll get off my soapbox now...I just want to make it clear that the 
database layer is the *only* place where it is possible to have airtight 
integrity checking.

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

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



[Rails] Re: Passenger caching in development mode, wtf?

2009-04-14 Thread Petr Janda

I just tested with Ruby 1.8 and its the same behaviour.

An clues people?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Text_area scroll to bottom

2009-04-14 Thread Sudhi Kulkarni

Robert Walker wrote:
> Sudhi Kulkarni wrote:
>> I have a text_area that fills in the text from a controller and I am
>> using RJS to update the text area content. I want to set the scroll bar
>> to bottom so that the user need not scroll to bottom to get the updated
>> value, how do I do that I tried
>> 
>> page["status"].scrollTop = page["status"].scrollHeight
> 
> Event.observe(window, "load", function() {
>   $('input_area').scrollTop = $('input_area').scrollHeight;
> });
> 
> This worked in my quick test in Safari 4.0 beta and Firefox 3.0.8, so it 
> looks like the the JavaScript part of what you're doing is fine. My 
> guess is that you might have a timing issue of some sort. Notice that 
> the above code waits for the page to fully load before scrolling the 
> text area for example.

Hi,
Thanks for the input...

The problem I see is that the textarea content is filled later on and 
not onload. Does this update the scrollbar position even after the 
textarea content is updated?

Thanks,
Sudhi
-- 
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: URL Redirect and affect on Routes?

2009-04-14 Thread Andrew Timberlake

On Wed, Apr 15, 2009 at 4:43 AM, Jason  wrote:
>
> I still don't fully understand routes, so I apologize in advance.
>
> I have a single rails app, but multiple domains pointing to different
> directories for marketing reasons. I am looking for a way to have the
> secondary domain point to the primarydomain.com/directory.
>
> It'd want any links to primarydomain.com/directory to 301 redirect to
> the secondary domain. Essentially, to the user everything should look
> like secondarydomain.com/whatever but be primarydomain.com/directory/
> whatever on the server.
>
> How can I handle this without affecting routes?
>
> Thanks,
> Jason

I would handle this in the upline webserver like Apache or Nginx with
url rewriting

The primary domain can catch all calls to the directory and 301 them
to the subdomain without passing the call through to Rails
Rewrite the subdomain/whatever and pass it to RAILS/directory/whatever

This way Rails only has to deal with the call to the directory and can
safely ignore the primary domain handling (and avoid changing routes)

Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain

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



[Rails] Re: Routing

2009-04-14 Thread srj

Thank you for the help, Max  -  I am making progress, but still have
an issue I cannot figure out.

The reason I was hard coding the form is because when I used the
form_for, I was getting unexpected results and errors (I cannot
remember now what they were).  But now that I go back to using
form_for,  I get an error like this:

 Unknown action

 No action responded to 3. Actions: create, edit, index, new, and
update

(In this case, 3 is the id of my Customer.  If I select a different
customer, I get that id in the error message.)

Any ideas on that error?

Thanks again,

Steve

On Apr 14, 1:03 pm, Max Williams 
wrote:
> Usually the 'edit' action is the one that creates the page with the
> form, and the form calls the 'update' action.  Usually there is no
> update view, the update action will usually redirect to the show page
> for that object or the index page for all objects of that type, or will
> re-render the edit page if the object couldn't be saved (because it
> fails validations, most commonly).
>
> So, your links should go to the 'edit' action, not to 'update'.
>
> The reason the form doesn't work is you're putting attributes in that it
> doesn't know about, like controller: form tags just take an 'action'
> attribute, which is the url to submit the form to.  However, hard coding
> forms is bad.  Use form_for to make your form, which should look like
> this:
>
> <%= form_for @your_object do |f|%>
>   <% f.text_field :name %>
>   ..etc
> <% end %>
>
> This will submit to the update action automatically
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Can I get multiple applications with different rails versions running on one machine?(can't act

2009-04-14 Thread hei

Got it!
<1> cp /PATH/TO/ACTIVERECORD2.0.2//oci_adapter.rb  /PATH/TO/
ACTIVERECORD2.3.2/./oci_apapter.rb
<2>cp /PATH/TO/ACTIVERECORD2.0.2//oci_adapter.rb  /PATH/TO/VENDER/
ACTIVERECORD2.3.2/./oci_apapter.rb
And all works well~~~


On Apr 15, 10:24 am, hei  wrote:
> OLD just run well.
> I think it's because the oci adapter, I install it with activerecord
> 2.0.2.
> I will try to install a new one with activerecord 2.3.2, hope both of
> them can coexist.
> Thanks~
>
> On Apr 15, 1:03 am, Marnen Laibow-Koser 
> s.net> wrote:
> > hei wrote:
>
> > [...]
>
> > > Notice: I can't run gem cleanup, and I don't want change any of OLD
> > >              (including rake rails:freeze:edge RELEASE=2.0.2)
> > >            so I just freeze New, but still get errors.
> > > Can anyone help me ? Thanks a lot!
>
> > Does the environment.rb file on OLD contain the correct
> > RAILS_GEM_VERSION?
>
> > Best,
> > --
> > Marnen Laibow-Koserhttp://www.marnen.org
> > mar...@marnen.org
> > --
> > 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] URL Redirect and affect on Routes?

2009-04-14 Thread Jason

I still don't fully understand routes, so I apologize in advance.

I have a single rails app, but multiple domains pointing to different
directories for marketing reasons. I am looking for a way to have the
secondary domain point to the primarydomain.com/directory.

It'd want any links to primarydomain.com/directory to 301 redirect to
the secondary domain. Essentially, to the user everything should look
like secondarydomain.com/whatever but be primarydomain.com/directory/
whatever on the server.

How can I handle this without affecting routes?

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



[Rails] [JOB] Vodpod.com needs a Rails Developer

2009-04-14 Thread Spencer Miles

I'm one of the engineers Vodpod.com, a community powered video site
based in San Francisco.  We're currently a small team of 4, and are
looking to add a 5th.  Although we are located in SF, working remotely
can be arranged, as long as
you can spend a few days in SF every couple of months.

We're looking for smart, motivated, "jack of all trades" types who are
just as comfortable with slinging RoR code as they are with fixing up
a nasty MySQL query that's "using filesort; using temporary" and
pinning the DB.  We work in a fast paced environment where priorities
are frequently changing, and the ability to juggle multiple tasks at
once while also handling user supports requests is crucial.  We
currently reach about 6mm unique visitors a month on about 20mm
pageviews, so if you like dealing with scaling and performance and
seeing your code get used by millions, then I think you'd love working
with us.

Strong opinions on what constitutes a good user experience is
important, as is a good eye for design (you needn't be a designer, but
if you think drudgereport.com is a good looking site, then this
probably isn't for you!).

We're backed by True Ventures, the folks behind Wordpress and Meebo,
and have a couple of years cash in the bank.

If you're interested, check out http://vodpod.com and http://vodpod.com/jobs
and shoot us an email (and mention this group).

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

2009-04-14 Thread Jason

Thanks for the initial response. I look forward to the main answer.

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



[Rails] Re: Can I get multiple applications with different rails versions running on one machine?(can't act

2009-04-14 Thread hei

OLD just run well.
I think it's because the oci adapter, I install it with activerecord
2.0.2.
I will try to install a new one with activerecord 2.3.2, hope both of
them can coexist.
Thanks~

On Apr 15, 1:03 am, Marnen Laibow-Koser  wrote:
> hei wrote:
>
> [...]
>
> > Notice: I can't run gem cleanup, and I don't want change any of OLD
> >              (including rake rails:freeze:edge RELEASE=2.0.2)
> >            so I just freeze New, but still get errors.
> > Can anyone help me ? Thanks a lot!
>
> Does the environment.rb file on OLD contain the correct
> RAILS_GEM_VERSION?
>
> Best,
> --
> Marnen Laibow-Koserhttp://www.marnen.org
> mar...@marnen.org
> --
> 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] Passenger caching in development mode, wtf?

2009-04-14 Thread Petr Janda

Hi all,
I updated an application to Rails 2.3.2(and ruby 1.9.1) and installed
Passenger, after learning that it turns production mode on by default, i
changed that to development mode. Logs are correctly being saved to
development.log so i should definately be in development mode, right?

Well NO! Any change to my code has to be followed by a restart of the
application due to some caching that I dont want.

Now that they are removing CGI support too, just how the hell am I
supposed to be making a website in development mode without having to
restart 500 times a day


Thanks
Petr
-- 
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: a client and a contractor are both users, share some attrib but not others, how to implement as users

2009-04-14 Thread Nik

Thank you vERY much, Chris! -- One often has moments where he/she
notices something that may or may not be a real worry, but is too
doubtful to speak of it. I have each of your described considerations
pulsing through my head each time I think of the future of how these
models will be in case of modification or deletion, but it was too
vague as I had no substance to fill even a hypothetical example. But
your spelling them out certainly relieved me a little.

Having been thinking of these (potential) problems, it compelled me to
think whether there's a kind of tutorial I can read up on some rules
of thumb of deciding if table or no table and so on. I thought, a few
days, ago, that in the worst case, if I made each column its own
table, a Phone Model, a Gender Model, an Areacode Model, etc,
basically every thing would have its own model, though unrealistically
complex, it'd work ( sort of conveying that the more orthogonal bases
you have, the better; in Linear Algebra). So building up a network of
tables each holding exactly one column, I was thinking that, some
empirical/theory-based rules for combining these hypothetical single
column tables. And your Socratic method (I hope I am using this phrase
right) isn't bad, at all.

I will discuss with my supervisor for possible scenarios that call for
minor/major table alterations, then I will begin to ask these
questions myself :)

Thanks again!
Thank you, everyone!

On Apr 14, 11:16 am, Chris Bird  wrote:
> This is a specific case of a more general problem - how to manage
> inheritance in these kinds of models. There are several things to
> think about here. However they break down fairly easily. I'll use your
> specific example, but some of the observations might not make a whole
> lot of sense. So I will pose some questions and then give some guiding
> thinking. This will not be RAILS specific thinking, but bringing
> experience from enterprise class systems where we have things like
> this all the time. You can generalize the thinking questioning when
> the structures are even deeper.
>
> Which attributes are common between Clients/Contractors?
> - If there are a lot of attributes in common you might get away with a
> single table, and a type field in the table.
>
> Are there relationships identified that both Clients and Contractors
> can have?
> - If for example you had a security tag table and it needed to have
> the associated "person", and it doesn't matter if the person is a
> client or a contractor, then it might be worth managing that
> relationship via a separate table (a Person table).
>
> Do you expect to add new kinds of things?
> - Are Clients and Contractors the only types of Persons? Will you need
> to add something else in the future - e.g. Overseas Contractor which
> is like a Contractor but has a bunch more fields, its own processes,
> screens, etc. If so you may want to break into multiple tables.
>
> Do you expect to have a role concept that cuts across Clients/
> Contractors?
> - Similar to relationships above, but let's imagine you also have
> roles like administrator, user, ... If those roles are independent of
> the Client/Contractor status, then again you might want separate
> tables.
>
> Do you have to worry about history/transition?
> - If a Client can become a Contractor (or vice versa) - and you need
> to manage the history (for example if all the timesheets haven't been
> cleared yet), then you will have to have something a bit more complex.
> Now you have to manage the temporal element when the Person can be
> both. There are lots of ways of doing that, none of them ideal!
>
> If you do decide to break into multiple tables, then make sure you
> manage the relationship handling among the tables inside the Model. Do
> not be tempted to put this into the Controller(s). Then you can treat
> the join of the Person with the Client or the Person with the
> Contractor as if they were individual Active Records. There will be
> performance penalties, but performance while important is not the only
> consideration.
>
> Hope this helps
>
> Chris
>
> On Apr 10, 5:42 pm, Nik  wrote:
>
> > Hello All,
>
> > I have a User Model at the moment that has only username, password,
> > and roles. As you might guess, I can add to the User Model a phone
> > column which our clients have and our contractors also have. Many
> > other attributes may be share by both actually. But then only a client
> > can have a "rate" column, and a company association and other things.
> > And only a contractor can have, say, an internal FTP login/password
> > pair.
>
> > I don't quite know the nature of rules on deciding just how I should
> > do about these un-shared attributes, I know that I use the "roles"
> > column to differentiate a client and a contractor (learned from Raile
> > Recipes); should I pool all attribute into User Model anyway and then
> > find a mechanism to permit/forbid a client to see the contractor only
> > attrib and vice versa? or two other tabl

[Rails] Re: can I do a "named_scope" for this scenario???

2009-04-14 Thread Matt Jones

You could try:

named_scope :all_relations_for, lambda { |o| { :conditions =>
["node_id = :o_id OR dependant_node_id = :o_id", { :o_id =>
o.id }] } }

That will let you do:

Node.all_relations_for(Node.find(1)) etc.

Not quite as snazzy as what you're looking for, but close...

--Matt Jones

On Apr 13, 6:26 pm, Greg Hauptmann 
wrote:
> PS.  To further clarify my question note that:
>
> ---
> class Node < ActiveRecord::Base
>   has_many :relationships_as_child, :class_name => 'Relationship',
> :foreign_key => :dependant_node_id
>   has_many :relationships_as_parent, :class_name => 'Relationship',
> :foreign_key => :node_id
>
>   def all_relations
>     Relationship.find(:all, :conditions => ["node_id = ? OR
> dependant_node_id = ?", self.id, self.id])
>   end
> ---
>
> I can get the first two "has_many" working, but I can't work out how to
> effectively combine these two into one "has_many".   I can create a "
> all_relations" method however that does provide the full flexibility of a "
> has_many" or a "named_scope" version (which I'm after) as I can't then do
> further things like:
>
>    Node.find(1).all_relations.find(1)   # fails
>
> So in other words I want the output of the "all_relations" function, but in
> the form of a "has_many" or a "named_scope".
>
> Any help welcomed  :)
>
> 2009/4/13 Greg Hauptmann 
>
>
>

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



[Rails] has_many :through question

2009-04-14 Thread Me

I have 3 models

Circuit
has_many :alarms
has_many :dacsports, :through => :alarms

Alarm
belongs_to :circuit
belongs_to :dacsport


Dacsport
has_many :alarms
has_many :circuits, :through => :alarms

I have the circuit -> dacsport relationship going.

How do I correlate the alarm data to either the circuit or the
dacsport?

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

2009-04-14 Thread mvargo

Dear Chris,

Thank you for reponding.  I tried that.  I get the same error from a
different stack.  It finds the new sqlserver.rb from the gem you
suggested.  But it still barfs in DBI because it can't find the ODBC
driver.  I wonder if it's some kind of path thing for finding the dbd-
odbc thing.  It's beyond my rails capabilities to figure out how the
gems find each other.  I'm sure it's some lame thing (it always is!).

Any other advice would be greatly appreciated.

Mike

>> subscriber = Subscriber.find(1)
DBI::InterfaceError: Unable to load driver 'ODBC'
from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:286:in
`load_driver'
from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:236:in
`load_driver'
from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:154:in
`_get_full_driver'
from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:139:in
`connect'
from /home/mvargo/.gem/ruby/1.8/gems/rails-sqlserver-2000-2005-
adapter-2.2.15/lib/active_record/connection_adapters/
sqlserver_adapter.rb:26:in `sqlserver_connection'


On Apr 14, 11:22 am, Chris Johnson  wrote:
> Try this gem out, works for me I think your on the right 
> path...http://github.com/rails-sqlserver/2000-2005-adapter/tree/master
>
> On Tue, Apr 14, 2009 at 12:29 PM, mvargo  wrote:
>
> > I have followed the cookbook on
> >http://wiki.rubyonrails.org/database-support/ms-sql
> > but am having problems with the rails part.  I can connect to the
> > database using sqsh so I think all the freetds plumbing is good.  When
> > I try to connect to the db with a rake db:migrate or just using script/
> > console I get this error:
>
> > >> Client.find(:first)
> > DBI::InterfaceError: Unable to load driver 'ODBC'
> >        from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:286:in
> > `load_driver'
> >        from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
> >        from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:236:in
> > `load_driver'
> >        from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:154:in
> > `_get_full_driver'
> >        from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:139:in
> > `connect'
> >        from /usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-
> > adapter-1.0.0.9250/lib/active_record/connection_adapters/
> > sqlserver_adapter.rb:47:in `sqlserver_connection'
> >        from
> > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> > connection_adapters/abstract/connection_pool.rb:223:in `send'
> >        from
> > /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> > connection_adapters/abstract/connection_pool.rb:223:in
> > `new_connection'
>
> > database.yml  is:
>
> > development:
> >    adapter: sqlserver
> >    mode: ODBC
> >    dsn: CONTENT_STORE
> >    username: joebob
> >    password: secret
>
> > So I looked into dbi.rb and I see where it throws the exception.  It
> > can't seem to get the Driver called ODBC.  I do have dbd-odbc-0.2.4
> > installed.  Seems like the dbi part is not connecting to the odbc
> > part.
>
> > Rails is running on ubuntu 8.1.
>
> > Any pointers would be very welcome.
>
> > Sincerely,
>
> > Mike Vargo
>
> > *** LOCAL GEMS ***
>
> > actionmailer (2.3.2)
> > actionpack (2.3.2)
> > activerecord (2.3.2)
> > activerecord-sqlserver-adapter (1.0.0.9250)
> > activeresource (2.3.2)
> > activesupport (2.3.2)
> > capistrano (2.5.5)
> > cgi_multipart_eof_fix (2.5.0)
> > daemons (1.0.10)
> > dbd-odbc (0.2.4)
> > dbi (0.4.0)
> > deprecated (2.0.1)
> > fastthread (1.0.7)
> > gem_plugin (0.2.3)
> > highline (1.5.0)
> > linecache (0.43)
> > mongrel (1.1.5)
> > net-scp (1.0.2)
> > net-sftp (2.0.2)
> > net-ssh (2.0.11)
> > net-ssh-gateway (1.0.1)
> > rails (2.3.2)
> > rake (0.8.4)
> > ruby-debug-base (0.10.3)
> > ruby-debug-ide (0.4.5)
> > rubygems-update (1.3.1)
> > sqlite3-ruby (1.2.4)
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Request Resubmitted

2009-04-14 Thread Rob Biedenharn

On Apr 14, 2009, at 4:45 PM, Dave wrote:

>
> I am using Ruby 1.8.6 and Rails 1.2.6.  The application is deployed to
> Apache 2.2 using mod_proxy_balancer to a cluster of Mongrel 1.1
> servers.
>
> I have been struggling with a problem that only manifests on the
> production server.  If a request takes longer than 60 seconds, then
> the request is being resubmitted.  I have used snoop on the Solaris
> server to see the HTTP headers, and there is no XHR header.  So, it
> appears that it is not an AJAX request.  I can run snoop on the client
> side and see the resubmitted request.  So, it appears that the
> resubmit is happening from the browser.

I have a similar issue, but it is nginx rather than Apache.

If a request has an error or times out, it is submitted to another  
mongrel. We've tried to adjust the nginx config so that certain URLs  
that are admin functions (that often take 2-3 minutes) are not subject  
to timeouts.

Perhaps that's the crux of your problem, too?

(it happens to be a Rails 1.2.2 app, but it's really nginx's behavior  
that is the problem)

>
>
> I created an action that just sleeps for 90 seconds, and am able to
> reproduce the problem.
>
> Can anybody think of any reason why this might be happening?  Or, do
> you have any debugging suggestions?  Unfortunately, the production
> server is remote so I have to interface using Telnet.  I cannot
> reproduce the problem on my development machine which is Windows XP
> using InstantRails.
>
> I know that long running processes should be pushed off of Rails.
> However, I inherited the app and am stuck with the current design
> until it can be re-engineered in the next few months.
>
> Thanks.


You're welcome,
-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: R6034 error - RMagick

2009-04-14 Thread Tim Hunter

Stephen Fagan wrote:
> Hi all,
> 
> I am using RMagick in an application to upload photos. I have installed
> ImageMagick and RMagick gem ok. But when I try to upload a photo, I get
> the following error (pop-up):
> 
> Runtime Error!
> Program: c:\ruby\bin\ruby.exe
> 
> R6034
> 
> An application has made an attempt to load the C runtime library
> incorrectly.
> 
> I am running this on Vista. Is there any known bugs with Vista and
> RMagick?
> 
> Thanks in advance
> 
> Steve.

See the answer in this thread in the RMagick forum on RubyForge: 
http://rubyforge.org/forum/forum.php?thread_id=31255&forum_id=33.
-- 
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: Netbiens

2009-04-14 Thread gisat

thank you for the advice, it works

On 14 Dub, 23:30, Greg Donald  wrote:
> On Tue, Apr 14, 2009 at 4:27 PM, gisat  wrote:
>
> > I have downloaded it. But if i write a project, and I want to try it
> > so I will not show my result. But there is just a warning about the
> > error,  i tried to program a web page and there was an error message,
> > I have installed on my computer apache too, it may be that?
> > Thank you in advance for any advice
>
> You right click on the project and choose "run" to start a server.
> The default is webrick but it will run mongrel if you have it
> installed.  When it runs (it takes a few seconds to start) it will
> open your browser tohttp://localhost:3000/.
>
> --
> Greg Donaldhttp://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: Netbiens

2009-04-14 Thread Greg Donald

On Tue, Apr 14, 2009 at 4:27 PM, gisat  wrote:
>
> I have downloaded it. But if i write a project, and I want to try it
> so I will not show my result. But there is just a warning about the
> error,  i tried to program a web page and there was an error message,
> I have installed on my computer apache too, it may be that?
> Thank you in advance for any advice

You right click on the project and choose "run" to start a server.
The default is webrick but it will run mongrel if you have it
installed.  When it runs (it takes a few seconds to start) it will
open your browser to http://localhost:3000/.


-- 
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: Netbiens

2009-04-14 Thread gisat

I have downloaded it. But if i write a project, and I want to try it
so I will not show my result. But there is just a warning about the
error,  i tried to program a web page and there was an error message,
I have installed on my computer apache too, it may be that?
Thank you in advance for any advice
-

On 14 Dub, 23:04, Greg Donald  wrote:
> On Tue, Apr 14, 2009 at 3:33 PM, gisat  wrote:
>
> > hello would you please advise anyone to set Ruby on rails in netbiens?
>
> Just download the one that has it included already, pick the one that
> has "Ruby":
>
> http://www.netbeans.org/downloads/index.html
>
> --
> Greg Donaldhttp://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: how to implement a status table

2009-04-14 Thread Me

OK, cool. thanks, looking now.

On Apr 14, 4:05 pm, Robert Walker 
wrote:
> Marnen Laibow-Koser wrote:
> > Chris Habgood wrote:
> >> I have a from that will have a status, "approved", "in
> >> process",denied"... and such.
>
> >> What is the best approach?
>
> > If a record can only have one status at a time, then it only needs one
> > status field.
>
> > Consider using aasm -- it's meant for exactly this purpose.
>
> This is what Marnen suggested, which I 
> concur:http://github.com/rubyist/aasm/tree/master
> --
> 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: how to implement a status table

2009-04-14 Thread Robert Walker

Marnen Laibow-Koser wrote:
> Chris Habgood wrote:
>> I have a from that will have a status, "approved", "in
>> process",denied"... and such.
>> 
>> What is the best approach?
> 
> If a record can only have one status at a time, then it only needs one 
> status field.
> 
> Consider using aasm -- it's meant for exactly this purpose.

This is what Marnen suggested, which I concur:
http://github.com/rubyist/aasm/tree/master
-- 
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: Netbiens

2009-04-14 Thread Greg Donald

On Tue, Apr 14, 2009 at 3:33 PM, gisat  wrote:
>
> hello would you please advise anyone to set Ruby on rails in netbiens?

Just download the one that has it included already, pick the one that
has "Ruby":

http://www.netbeans.org/downloads/index.html


-- 
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] Apache2 install problem: apt-get can not find/fetch libpq5 pkg from http://us.archive.ubuntu.com

2009-04-14 Thread DT

Hello.
While i had not hand any problem installing RoR on my Dell Ub 8.10 box
previously, when I tried to do the same on my HP Pavilion Ub 8.10 box
today (4/14), during the installation of Apache2 (via apt-get or
Synaptic pkg manager) I got the following error msgs:

After this operation, 6263kB of additional disk space will be used.
Do you want to continue [Y/n]? Y
Err http://us.archive.ubuntu.com intrepid-updates/main libpq5
8.3.6-0ubuntu8.10
  404 Not Found [IP: 91.189.88.31 80]
Failed to fetch 
http://us.archive.ubuntu.com/ubuntu/pool/main/p/postgresql-8.3/libpq5_8.3.6-0ubuntu8.10_amd64.deb
404 Not Found [IP: 91.189.88.31 80]
E: Unable to fetch some archives, maybe run apt-get update or try with
--fix-missing?

Any idea why the above lib is missing?

Thanks
DT

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



[Rails] Request Resubmitted

2009-04-14 Thread Dave

I am using Ruby 1.8.6 and Rails 1.2.6.  The application is deployed to
Apache 2.2 using mod_proxy_balancer to a cluster of Mongrel 1.1
servers.

I have been struggling with a problem that only manifests on the
production server.  If a request takes longer than 60 seconds, then
the request is being resubmitted.  I have used snoop on the Solaris
server to see the HTTP headers, and there is no XHR header.  So, it
appears that it is not an AJAX request.  I can run snoop on the client
side and see the resubmitted request.  So, it appears that the
resubmit is happening from the browser.

I created an action that just sleeps for 90 seconds, and am able to
reproduce the problem.

Can anybody think of any reason why this might be happening?  Or, do
you have any debugging suggestions?  Unfortunately, the production
server is remote so I have to interface using Telnet.  I cannot
reproduce the problem on my development machine which is Windows XP
using InstantRails.

I know that long running processes should be pushed off of Rails.
However, I inherited the app and am stuck with the current design
until it can be re-engineered in the next few months.

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] Netbiens

2009-04-14 Thread gisat

hello would you please advise anyone to set Ruby on rails in netbiens?

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: invalid byte sequence utf-8 OR best option to sanitize content brought in with net::http? single non-utf character causes rails to crash

2009-04-14 Thread Hector Gomez

Sorry for the late response.
I took a dive in the Net:HTTP code and I have some bad news.

It uses a BufferedIO over the socket of the connection. And when it
reads from the socket it uses IO#sysread that is the lowest read you
can use
in ruby. This methods always returns a ASCII-8BIT string. So
you have to transcode or force_encoding the responses from Net:HTTP
explicitly.

Hector

On Apr 13, 5:57 pm, buddycat  wrote:
> also, my particular case is with asp content; but i am sure that the
> problem can be reproduced with any web stack or even a static text
> file with these characters.
>
> On Apr 13, 6:52 pm, buddycat  wrote:
>
> > so i use lib/asp.rb module to get legacy asp content from internal
> > win2k/iis5/asp (classic not .net) servers as a mixin and require it in
> > my application_controller.rb as i have many asp pages. i do it this
> > way because it gives me a smooth incremental upgrade path to rails
> > from asp by replacing page for page as we write a better rails
> > replacement. this way my routes are all rails and i just call
> > asp_get_content when i have an asp page to wrap.
>
> > controller:
> > def my_legacy_page
> >   asp_get_content
> > end
>
> > lib/asp.rb
> > module asp
> >   def asp_get_content
>
> >   �...@asp_response = Net::HTTP.start(host, port) {|x|
> >       x.read_timeout = 1200
> >       x.send_request(method, path, data, headers)
> >     }
>
> >     # return false on redirects so we can use custom renders like so:
> >     # render :foo => :bar if asp_get_content while still allowing just
> >     # asp_get_content without anything else for standard stuff
> >     case @asp_response
> >     when Net::HTTPRedirection
> >         redirect_to "#...@asp_response['location']}"
> >         false
> >     else
> >        true
> >     end
> > end
>
> > view:
> > <%= @asp_response.body %>
>
> > to reproduce the issue, just add
>
> > <%= chr(150) %> to the asp page. rails will choke with invalid byte
> > sequence utf-8 as soon as the response.rb tries to parse
> > @asp_response.body. see the above comments for the stack trace.
>
> > this is just my particular situation. i suspect you can add any high,
> > non-standard ascii code that windows likes like ascii 128-159. my test
> > case is ascii 150 that will reliably reproduce the issue. my point is
> > not with encoding per se, i just think that rails should be a bit more
> > fault tolerant around encodings as interop makes it almost a certainty
> > that we will pull incontent with bad encodings just as we pull in
> > malformed html. we cope with the latter well but now need to do so
> > with the former. imho.
>
> > thanks...gg
>
> > On Apr 13, 5:05 am, Conrad Taylor  wrote:
>
> > > 2009/4/13 buddycat 
>
> > > > hector,
>
> > > > further update:
>
> > > > i was able to set both my internal and external encoding thanks to
> > > > hongli lai at phusion passenger. he helped me with a wrapper for my
> > > > local ruby that uses the encoding option. not suggesting that this is
> > > > his preferred method though, but you don't seem to be able to pass
> > > > ruby options any other way that i'm aware of in passenger's apache
> > > > config.
>
> > > > /usr/local/ruby1.9/bin/ruby_wrapper:
> > > > #!/bin/bash
> > > > exec /usr/local/ruby1.9/bin/ruby -E utf-8:utf-8 "$@"
>
> > > > then in apache2.conf:
> > > > PassengerRuby /usr/local/ruby1.9/bin/ruby_wrapper
>
> > > > restart apache.
>
> > > > in a controller:
> > > > raise "#{Encoding.default_internal} #{Encoding.default_internal}"
>
> > > > results in:
> > > > utf-8 utf-8
>
> > > > so all is good. for my app anyway. irb and script/console is a pain.
>
> > > > unfortunately, after all this, my asp pages still get ascii encoded
> > > > when brought in by net::http (after adding all the asp settings i can
> > > > to convince it to use utf). also, more unfortunately, your assertion
> > > > that if i have the default encodings set right (particularly
> > > > default_internal which i do now), that it will silently and fautlessly
> > > > convert my ascii page without error. no joy. got same utf encoding
> > > > error that i started with.
>
> > > > so...guess i am back to doing explicit encoding like you suggested or
> > > > going back to iconv.
>
> > > > all in all i have to say that ruby1.9 and rails2.3 and encoding and
> > > > irb and compiling your own ruby and... are still very rough.
>
> > > > ...gg
>
> > > Do you have a test case that I can reproduce the issue that you're seeing?
>
> > > Thanks,
>
> > > -Conrad
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to implement a status table

2009-04-14 Thread Marnen Laibow-Koser

Chris Habgood wrote:
> I have a from that will have a status, "approved", "in
> process",denied"... and such.
> 
> What is the best approach?

If a record can only have one status at a time, then it only needs one 
status field.

Consider using aasm -- it's meant for exactly this purpose.

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

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



[Rails] Re: Routing question

2009-04-14 Thread Tim

map.resources :jobs, :as => :alias

Hope that helps!
Tm

On Apr 14, 6:59 am, DanC  wrote:
> I have a resource for jobs on my application and I am familiar with
> RESTful routes etc. I am also happy adding some custom routes to my
> controller.
>
> My question is, can I create an alias controller, i.e. instead 
> ofwww.mysite.com/jobscan I usewww.mysite.com/alias as the 'jobs'
> isn't very intuitive for what the app is doing.
>
> Can I do this in routes.rb so I don't have to create any files?
>
> Better still would be to set up a sub-domain type route that worked
> like alias.mysite.com = mysite.com/jobs
>
> Again I am unsure on whether this is possible.
>
> Any advice or quality links to good resources would be appreciated
>
> Regards,
>
> Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 implement a status table

2009-04-14 Thread Me

I have a from that will have a status, "approved", "in
process",denied"... and such.

What is the best approach?
Status table,
One row with each column status type?
The form will have only one status so I will have to manage making
sure all columns that are not "true" will be false.

If I set it up so I populate the table with each row being a status
type then it will be easier to implement.
I could have a drop down to change status dynamically..

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

2009-04-14 Thread Robert Walker

Sudhi Kulkarni wrote:
> I have a text_area that fills in the text from a controller and I am
> using RJS to update the text area content. I want to set the scroll bar
> to bottom so that the user need not scroll to bottom to get the updated
> value, how do I do that I tried
> 
> page["status"].scrollTop = page["status"].scrollHeight

Event.observe(window, "load", function() {
  $('input_area').scrollTop = $('input_area').scrollHeight;
});

This worked in my quick test in Safari 4.0 beta and Firefox 3.0.8, so it 
looks like the the JavaScript part of what you're doing is fine. My 
guess is that you might have a timing issue of some sort. Notice that 
the above code waits for the page to fully load before scrolling the 
text area for example.
-- 
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] Oracle oci8 => OCIError: OCI Library Initialization Error

2009-04-14 Thread Rob Redmon

I'm trying to get ActiveRecord working with an Oracle DB over the
instant client.

On a 32bit machine, I can require 'oci8':
Linux xxx.xxx.xxx.xxx 2.6.9-78.0.17.ELsmp #1 SMP Thu Mar 5 04:52:17 EST
2009 i686 i686 i386 GNU/Linux
irb(main):001:0> require 'oci8'
=> true

However, on a 64bit machine:
Linux xxx.xxx.xxx.xxx 2.6.18-128.1.6.el5 #1 SMP Tue Mar 24 12:05:57 EDT
2009 x86_64 x86_64 x86_64 GNU/Linux

I have this problem:
irb(main):001:0> require 'oci8'
OCIError: OCI Library Initialization Error
  from env.c:90:in oci8lib.so
  from /home/iono/lib/ruby/rubygems/custom_require.rb:31:in `require'
  from /home/iono/packages/gems/gems/ruby-oci8-2.0.1/lib/oci8.rb:25
  from /home/iono/lib/ruby/rubygems/custom_require.rb:36:in
`gem_original_require'
  from /home/iono/lib/ruby/rubygems/custom_require.rb:36:in `require'
  from (irb):1


Any clues?
-- 
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: Loop and instance variable problem

2009-04-14 Thread Rob Biedenharn

On Apr 14, 2009, at 10:55 AM, Andrew Timberlake wrote:
> On Tue, Apr 14, 2009 at 4:33 PM, Nick Hoyle
>  wrote:
>>
>> I have a loop for parsing each rss feed
>>
>> @address.each do |address|
>> @feed = SimpleRSS.parse open(address.feed)
>>   end
>>
>> the problem is my my instance variable @feed just gets overwritten so
>> basically it displays the last parsed feed
>>
>>
>> how can i store each feed without it been overwrited so i can  
>> display it
>> in my view?
>>
>> regards
>>
>> nick
>
> @feeds = []
> @address.each do |address|
>  @feeds << SimpleRSS.parse open(address.feed)
> end

Or more simply:

@feeds = @address.map {|address| SimpleRSS.parse(open(address.feed)) }

>
>
> In your view
> @feeds.each do |fee|
>  ...
> end
>
> Andrew Timberlake
> http://ramblingsonrails.com
> http://www.linkedin.com/in/andrewtimberlake
>
> "I have never let my schooling interfere with my education" - Mark  
> Twain


-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: SQL Server via DBI/ODBC configuration

2009-04-14 Thread Chris Johnson
Try this gem out, works for me I think your on the right path...
http://github.com/rails-sqlserver/2000-2005-adapter/tree/master

On Tue, Apr 14, 2009 at 12:29 PM, mvargo  wrote:

>
> I have followed the cookbook on
> http://wiki.rubyonrails.org/database-support/ms-sql
> but am having problems with the rails part.  I can connect to the
> database using sqsh so I think all the freetds plumbing is good.  When
> I try to connect to the db with a rake db:migrate or just using script/
> console I get this error:
>
> >> Client.find(:first)
> DBI::InterfaceError: Unable to load driver 'ODBC'
>from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:286:in
> `load_driver'
>from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
>from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:236:in
> `load_driver'
>from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:154:in
> `_get_full_driver'
>from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:139:in
> `connect'
>from /usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-
> adapter-1.0.0.9250/lib/active_record/connection_adapters/
> sqlserver_adapter.rb:47:in `sqlserver_connection'
>from
> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> connection_adapters/abstract/connection_pool.rb:223:in `send'
>from
> /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
> connection_adapters/abstract/connection_pool.rb:223:in
> `new_connection'
>
> database.yml  is:
>
> development:
>adapter: sqlserver
>mode: ODBC
>dsn: CONTENT_STORE
>username: joebob
>password: secret
>
> So I looked into dbi.rb and I see where it throws the exception.  It
> can't seem to get the Driver called ODBC.  I do have dbd-odbc-0.2.4
> installed.  Seems like the dbi part is not connecting to the odbc
> part.
>
> Rails is running on ubuntu 8.1.
>
> Any pointers would be very welcome.
>
> Sincerely,
>
> Mike Vargo
>
> *** LOCAL GEMS ***
>
> actionmailer (2.3.2)
> actionpack (2.3.2)
> activerecord (2.3.2)
> activerecord-sqlserver-adapter (1.0.0.9250)
> activeresource (2.3.2)
> activesupport (2.3.2)
> capistrano (2.5.5)
> cgi_multipart_eof_fix (2.5.0)
> daemons (1.0.10)
> dbd-odbc (0.2.4)
> dbi (0.4.0)
> deprecated (2.0.1)
> fastthread (1.0.7)
> gem_plugin (0.2.3)
> highline (1.5.0)
> linecache (0.43)
> mongrel (1.1.5)
> net-scp (1.0.2)
> net-sftp (2.0.2)
> net-ssh (2.0.11)
> net-ssh-gateway (1.0.1)
> rails (2.3.2)
> rake (0.8.4)
> ruby-debug-base (0.10.3)
> ruby-debug-ide (0.4.5)
> rubygems-update (1.3.1)
> sqlite3-ruby (1.2.4)
>
> >
>

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



[Rails] Re: a client and a contractor are both users, share some attrib but not others, how to implement as users

2009-04-14 Thread Chris Bird

This is a specific case of a more general problem - how to manage
inheritance in these kinds of models. There are several things to
think about here. However they break down fairly easily. I'll use your
specific example, but some of the observations might not make a whole
lot of sense. So I will pose some questions and then give some guiding
thinking. This will not be RAILS specific thinking, but bringing
experience from enterprise class systems where we have things like
this all the time. You can generalize the thinking questioning when
the structures are even deeper.

Which attributes are common between Clients/Contractors?
- If there are a lot of attributes in common you might get away with a
single table, and a type field in the table.

Are there relationships identified that both Clients and Contractors
can have?
- If for example you had a security tag table and it needed to have
the associated "person", and it doesn't matter if the person is a
client or a contractor, then it might be worth managing that
relationship via a separate table (a Person table).


Do you expect to add new kinds of things?
- Are Clients and Contractors the only types of Persons? Will you need
to add something else in the future - e.g. Overseas Contractor which
is like a Contractor but has a bunch more fields, its own processes,
screens, etc. If so you may want to break into multiple tables.

Do you expect to have a role concept that cuts across Clients/
Contractors?
- Similar to relationships above, but let's imagine you also have
roles like administrator, user, ... If those roles are independent of
the Client/Contractor status, then again you might want separate
tables.

Do you have to worry about history/transition?
- If a Client can become a Contractor (or vice versa) - and you need
to manage the history (for example if all the timesheets haven't been
cleared yet), then you will have to have something a bit more complex.
Now you have to manage the temporal element when the Person can be
both. There are lots of ways of doing that, none of them ideal!

If you do decide to break into multiple tables, then make sure you
manage the relationship handling among the tables inside the Model. Do
not be tempted to put this into the Controller(s). Then you can treat
the join of the Person with the Client or the Person with the
Contractor as if they were individual Active Records. There will be
performance penalties, but performance while important is not the only
consideration.

Hope this helps

Chris

On Apr 10, 5:42 pm, Nik  wrote:
> Hello All,
>
> I have a User Model at the moment that has only username, password,
> and roles. As you might guess, I can add to the User Model a phone
> column which our clients have and our contractors also have. Many
> other attributes may be share by both actually. But then only a client
> can have a "rate" column, and a company association and other things.
> And only a contractor can have, say, an internal FTP login/password
> pair.
>
> I don't quite know the nature of rules on deciding just how I should
> do about these un-shared attributes, I know that I use the "roles"
> column to differentiate a client and a contractor (learned from Raile
> Recipes); should I pool all attribute into User Model anyway and then
> find a mechanism to permit/forbid a client to see the contractor only
> attrib and vice versa? or two other tables one being
> contractor_only_properties and the other client_only_properties? I
> feel that having to build a table for each role seems a bit, I am very
> unlikely to be right, inflexible or at least un-easily-extensible
> (sorry for making words like this).
>
> Your (any) opinion is very valuable to me and I thank you for spending
> your time reading my problem
>
> All my best,
> Nik

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

2009-04-14 Thread slava

thanks,
I ended up doing this.

  format.json  { render :json => @product_locations.to_json
(:include => :product_location_mappings)}
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 performance for milions pageviews/month

2009-04-14 Thread Philip Hallstrom

> Julian Leviston wrote:
>> Twitter has more than this, therefore its possible.
>
> That's a horrible example.  Twitter is notorious for poor performance
> and frequent outages.
>
> However, GitHub and Lighthouse are good examples of high-traffic Rails
> apps with good performance.  So is Backpack, I think.  So it certainly
> is possible.

cardplayer.com and spadeclub.com also run Rails.  There's a ton of  
stuff going on much of which isn't cacheable (at least for  
cardplayer.com).  3 years ago cardplayer did about 8 mil views a day  
for a couple of weeks (during the WSOP).  There's some hardware behind  
it, but we'd have done that with any other platform as well.

also, doesn't penny-arcade run rails?  they do a ton of traffic.

-philip

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



[Rails] Re: background process fork - generating zip files

2009-04-14 Thread Jeff Lewis

One way you could do it:

  # in your model meth:
  def generate_archive
was_success = false
...
fname = "#{dir}/#{title}.zip"
...
prev_fsize = 0
10.times do # or some reasonable(?) max num times.
  sleep 0.5
  begin fsize = File.size(fname); rescue; fsize = 0; end
  if prev_fsize > 0 and prev_fsize == fsize
was_success = true
break
  end
  prev_fsize = fsize
end
return was_success
  end

  # and in your controller meth:
...
if @topic.generate_archive
  send_file path, :type => 'application/zip'
else
  # show some err msg ...
end
...

Note that the above assumes that the archiving process time (and
request volume) is short-enough from a user's wait-time perspective
(and app handle-ability).  However if that process takes too long (and/
or req volume is too high), then you'll probably not want to continue
to test/wait for archiving process to complete before responding, but
instead return/redirect to a screen where the user (either app-driven
or the user-selected) tests/waits for the archiving process to
complete.

Jeff

On Apr 13, 4:13 pm, Carlos Santana 
wrote:
> Any help please?
>
> Thanks,
> CS.
>
>
>
> Carlos Santana wrote:
> > - How do I know when it is complete? Ideally, I would like to send zip
> > file once the process is complete rather than giving arbitrary sleep
> > time.
> > - Is it possible to get an estimate of this?
>
> > -
> > Thanks,
> > CS.
>
> > Frederick Cheung wrote:
> >> On 12 Apr 2009, at 05:26, Carlos Santana wrote:
> >>> thought above method wouldn't return until background jobs are  
> >>> complete.
>
> >> If you want to wait for a process to complete you should be using
> >> Process.wait. Though if you're blocking on it like that what's the
> >> point of using fork ?
>
> >> Fred
>
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: ROR performance for milions pageviews/month

2009-04-14 Thread Marnen Laibow-Koser

Julian Leviston wrote:
> Twitter has more than this, therefore its possible.

That's a horrible example.  Twitter is notorious for poor performance 
and frequent outages.

However, GitHub and Lighthouse are good examples of high-traffic Rails 
apps with good performance.  So is Backpack, I think.  So it certainly 
is possible.

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

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



[Rails] Re: ROR performance for milions pageviews/month

2009-04-14 Thread Philip Hallstrom

>  I`ll rewrite a 10 years old site, written in asp/mysql
> (www.motonline.com.br). Now it has one milion page views a month, and
> we can hope it grows after rewrite. Well, I know several ror sites,
> but have no idea about its access stats. I already use ror for smaller
> projects and only need to confirm if ror can satisfy the performance
> demands for this.
>  Can you comment about the ror performance for such a page view scale
> and/or point to some cases or statistics from existing sites?

Rails can scale to support that.  The problems you'll run into after a  
certain point aren't really Rails specific, but will apply to any site  
serving that amount of traffic.

Also keep in mind that 1mil views/month spread out evenly is only .38  
views a second.  Which isn't much.  Of course traffic is never spread  
evenly, but you get my point.

You might want to check out http://railslab.newrelic.com/scaling-rails  
to help guide your decisions.

-philip

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



[Rails] Re: ROR performance for milions pageviews/month

2009-04-14 Thread Julian Leviston

Twitter has more than this, therefore its possible.

Blog: http://random8.zenunit.com/
Learn rails: http://sensei.zenunit.com/

On 15/04/2009, at 3:26 AM, Tom Lobato  wrote:

>
>
>  Hi all!
>
>  I`ll rewrite a 10 years old site, written in asp/mysql
> (www.motonline.com.br). Now it has one milion page views a month, and
> we can hope it grows after rewrite. Well, I know several ror sites,
> but have no idea about its access stats. I already use ror for smaller
> projects and only need to confirm if ror can satisfy the performance
> demands for this.
>  Can you comment about the ror performance for such a page view scale
> and/or point to some cases or statistics from existing sites?
>
>
> Thank you,
> Tom Lobato
>
> >

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

2009-04-14 Thread Marnen Laibow-Koser

SpringFlowers AutumnMoon wrote:
[...]
> 
> then the code generated is
> 
> 
> 
> 
>   var s = "Bill Gates's dog said \"whoof whoof\" and \n 
> ran away.";
> 
>   var t = "Bill Gates's dog said "whoof whoof" and \n ran 
> away.";
> 
> 

Sorry, I misunderstood what you were trying to do.  If you are putting 
dynamically generated JavaScript in an HTML file, wrap the script in a 
CDATA section and don't HTML-escape it

However, putting JS in HTML files is a bad idea for lots of reasons, and 
you should never need to do so.  Better to use an external JS file that 
contains lines like
var s = document.getElementById('s').innerHTML

and then have your view contain

<%=h my_string%>

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

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



[Rails] Re: Newbie Question about script/generate

2009-04-14 Thread Rick

Glad I could help.

On Apr 14, 5:24 am, khagimoto  wrote:
> Thanks very much for this clarification.  You're right, I'm usually
> coding things myself and not used to the concept of having things
> generated for me.  I do have git, so I was able to back out.  It
> sounds like the best way for me is to learn what a lot of plugins do
> when generated, and combine those myself without using the generate.
> Just what you suggested.. :-)  Thanks!!
>
> On Apr 14, 3:01 am,Rick wrote:
>
> > 1)  It is definitely not necessary to use "script/generate" but it can
> > be very helpful when you're just starting out.  The variants on
> > generate (run "script/generate --help" and check out the installed
> > generators) can give you a good idea on how the different MVC
> > components hang together.
>
> > 2) Yes, well there seems to be a growing dissatisfaction with plugins
> > that rely on generate to build your app.  My guess is that your
> > experience is part of the reason.  Configuration management (svn or
> > git) can be invaluable here.  You really want to be able to back out
> > the recent damage on occasion.
>
> > As far as running multiple generates you need to understand what's
> > going on with the different generators, i.e.:
>
> > generate model User name:string profile:text
> > generate scaffold User name:string profile:text
>
> > both create a user.rb model and migration but scaffold also builds the
> > controller and views as well as adding routes.
>
> > You need to understand what is created when you issue the generate
> > command and the best way I've found is to run it and study the
> > results.
>
> > On Apr 13, 8:42 am, khagimoto  wrote:
>
> > > Hello,
> > > I just started learning RoR myself, and I have a few newbie questions.
>
> > > (1)  Is it always necessary to use the "script/generate" to start an
> > > app?  Can it be created from scratch if one wanted to?  (Not that I
> > > would, but I'm trying to understand...)
>
> > > (2)  I followed the rails getting started guide to create a blog
> > > successfully.  Then I thought of adding a login/authentication
> > > mechanism, and proceeded to run the "script/generate login"  (after
> > > getting login_generator.zip) on the same rail app.  It messed up the
> > > original blog, because it had file name conflicts (I think).  How
> > > would I run multiple "script/generate" on an app without messing up
> > > the app?
>
> > > Thanks!
> > > Kumi
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] ROR performance for milions pageviews/month

2009-04-14 Thread Tom Lobato


  Hi all!

  I`ll rewrite a 10 years old site, written in asp/mysql
(www.motonline.com.br). Now it has one milion page views a month, and
we can hope it grows after rewrite. Well, I know several ror sites,
but have no idea about its access stats. I already use ror for smaller
projects and only need to confirm if ror can satisfy the performance
demands for this.
  Can you comment about the ror performance for such a page view scale
and/or point to some cases or statistics from existing sites?


 Thank you,
 Tom Lobato

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



[Rails] SQL Server via DBI/ODBC configuration

2009-04-14 Thread mvargo

I have followed the cookbook on 
http://wiki.rubyonrails.org/database-support/ms-sql
but am having problems with the rails part.  I can connect to the
database using sqsh so I think all the freetds plumbing is good.  When
I try to connect to the db with a rake db:migrate or just using script/
console I get this error:

>> Client.find(:first)
DBI::InterfaceError: Unable to load driver 'ODBC'
from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:286:in
`load_driver'
from /usr/lib/ruby/1.8/monitor.rb:242:in `synchronize'
from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:236:in
`load_driver'
from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:154:in
`_get_full_driver'
from /usr/lib/ruby/gems/1.8/gems/dbi-0.4.0/lib/dbi.rb:139:in
`connect'
from /usr/lib/ruby/gems/1.8/gems/activerecord-sqlserver-
adapter-1.0.0.9250/lib/active_record/connection_adapters/
sqlserver_adapter.rb:47:in `sqlserver_connection'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:223:in `send'
from /usr/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record/
connection_adapters/abstract/connection_pool.rb:223:in
`new_connection'

database.yml  is:

development:
adapter: sqlserver
mode: ODBC
dsn: CONTENT_STORE
username: joebob
password: secret

So I looked into dbi.rb and I see where it throws the exception.  It
can't seem to get the Driver called ODBC.  I do have dbd-odbc-0.2.4
installed.  Seems like the dbi part is not connecting to the odbc
part.

Rails is running on ubuntu 8.1.

Any pointers would be very welcome.

Sincerely,

Mike Vargo

*** LOCAL GEMS ***

actionmailer (2.3.2)
actionpack (2.3.2)
activerecord (2.3.2)
activerecord-sqlserver-adapter (1.0.0.9250)
activeresource (2.3.2)
activesupport (2.3.2)
capistrano (2.5.5)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
dbd-odbc (0.2.4)
dbi (0.4.0)
deprecated (2.0.1)
fastthread (1.0.7)
gem_plugin (0.2.3)
highline (1.5.0)
linecache (0.43)
mongrel (1.1.5)
net-scp (1.0.2)
net-sftp (2.0.2)
net-ssh (2.0.11)
net-ssh-gateway (1.0.1)
rails (2.3.2)
rake (0.8.4)
ruby-debug-base (0.10.3)
ruby-debug-ide (0.4.5)
rubygems-update (1.3.1)
sqlite3-ruby (1.2.4)

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



[Rails] Re: About haml and ruby on rail

2009-04-14 Thread Marnen Laibow-Koser

Nilesh Kulkarni wrote:
[...]
> 
> please help me I am not getting what exactly the error is?
> 
> compile error D:/aflatune/app/views/tracks/show.html.haml:33: 

That's the approximate location of the error.  What is in that file 
around line 33?

> syntax
> error, unexpected tCONSTANT, expecting ')'
[...]

So you probably have a missing parenthesis or something like that.  But 
we can't tell for sure without seeing the Haml file.

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

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



[Rails] Re: Can I get multiple applications with different rails versions running on one machine?(can't act

2009-04-14 Thread Marnen Laibow-Koser

hei wrote:
[...]
> Notice: I can't run gem cleanup, and I don't want change any of OLD
>  (including rake rails:freeze:edge RELEASE=2.0.2)
>so I just freeze New, but still get errors.
> Can anyone help me ? Thanks a lot!

Does the environment.rb file on OLD contain the correct 
RAILS_GEM_VERSION?

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

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



[Rails] Re: Routing

2009-04-14 Thread Max Williams

Usually the 'edit' action is the one that creates the page with the 
form, and the form calls the 'update' action.  Usually there is no 
update view, the update action will usually redirect to the show page 
for that object or the index page for all objects of that type, or will 
re-render the edit page if the object couldn't be saved (because it 
fails validations, most commonly).

So, your links should go to the 'edit' action, not to 'update'.

The reason the form doesn't work is you're putting attributes in that it 
doesn't know about, like controller: form tags just take an 'action' 
attribute, which is the url to submit the form to.  However, hard coding 
forms is bad.  Use form_for to make your form, which should look like 
this:

<%= form_for @your_object do |f|%>
  <% f.text_field :name %>
  ..etc
<% end %>

This will submit to the update action automatically




-- 
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] Routing

2009-04-14 Thread srj

I have an index page that shows each of my Customers, and each row in
the display has an Update link which routes to my update method.  That
simply does a find on the Customer id from the link and sets an
instance variable for the update view.

My update view renders a partial (same one used in the new/create) and
uses the following form:
 

I have code in the edit method to get all the updated fields and
persist the changes.  However, when I click on the submit button, the
update action is executed, not the edit action.

I thought it may be something to do with Rails automatic routing, so I
renamed the update and edit actions to something very unusual ("edit"
was renamed to "sally", and "update" was renamed to "frank") - same
results - I wanted sally, but got frank.

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



[Rails] Re: is it possible to render a modal dialog box from the server?

2009-04-14 Thread Marnen Laibow-Koser

yoram wrote:
[...]
> yes but - can i render that login page as an overlay modal box instead
> of  a full page? 
[...]

Sure, with appropriate JavaScript and a suitably constructed partial or 
other HTML file.  (But remember to make it accessible also to users who 
don't have JavaScript turned on.)

Also see if HTTP-Basic authentication is suitable for your needs.  With 
this model, the server tells the browser that it wants login 
credentials, and the browser presents a login dialog of some sort, so 
that the server doesn't have to provide an HTML login form.

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

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



[Rails] Mime::Type.register documentation needs example

2009-04-14 Thread Sudhir

# $RAILS_ROOT/config/mime_types.rb
Mime::Type.register "image/jpg", :jpg, ["image/jpeg", "image/pjpeg"]

Above example uses mime type synonyms. Each synonym is a alternative
string used to identify the same mime type and appears as an array
after the mime type symbol.

The class document does not explain the meaning of mime_type_synonyms
nor give an example. Someone should fix that.

Hope this post clarifies use of mime type synonyms.


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

2009-04-14 Thread Srdjan Pejic

To quickly answer your second question, you need both. The reason for
that is that validates_uniqueness_of does not guarantee fully unique
column values, since it's at the application level. The unique
constraint in the db schema can be viewed as a backup.

I'll answer your main question shortly.

On Apr 13, 2:10 pm, Jason  wrote:
> I am still learning Rails and the relationships are still a little
> confusion. So I apologize in advance for the repetition of this
> question.
>
> I am building a user rating system for words and quotes. If I wanted a
> user to be able to rate a word or quote only once, how can I set up
> the ratings table so it will have the appropriate relationships. Since
> the rating model is a bit polymorphic (rate words or quotes), I am not
> sure if I need a "bridge table". I want to be able to do things like
>
> word.rating.value
> quote.rating.value
> user.rating.value
>
> Any direction is greatly appreciated, and if you can throw in some
> comments behind the code, even better. Also, would you suggest putting
> the only one rating per user constraint in the db or as a
> validate_unique..
>
> Thanks,
> Jason
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 validate a form field sequentially

2009-04-14 Thread Luis Sánchez

Amazing! thanks Gianluca :DD!!

Luis

Gianluca Tessarolo wrote:
> Yes, validating format only when field has a value:
> 
> ex.
> 
> validates_format_of :field, :with => "", :allow_blank => true
> 
> :allow_nil - If set to true, skips this validation if the attribute is
> nil (default is false)
> :allow_blank - If set to true, skips this validation if the attribute is
> blank (default is false)
> 
> or
> validates_format_of :field, :with => "", :if => Proc.new{|record|
> !record.field.blank? }
> but the first one is better (allow_blank), with the last one u can make
> a validation based on more than one field...
> 
> Hope this helps...

-- 
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: Loop and instance variable problem

2009-04-14 Thread Nick Hoyle


i just tried this with the built in rails rss parser and seems to work
fine. must be an issue with simple rss im guessing.
-- 
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: is it possible to render a modal dialog box from the server?

2009-04-14 Thread yoram

so you have
> to either render a login page

yes but - can i render that login page as an overlay modal box instead
of  a full page? i suspect
that the answer is not...

thanks for your reply

On Apr 14, 7:47 am, Brendon  wrote:
> The server can only respond to client (browser) requests, so you have
> to either render a login page and then redirect to the original
> destination or you need to have some javascript to help with what you
> want.  In short, the server can't MAKE the browser do anything...
>
> On Apr 14, 6:33 am, "yber...@msn.com"  wrote:
>
> > I have a before filter that authorizes a user's credentials before
> > giving them access to any protected methods (pretty standard
> > practice). If they fail authorization, I want to direct them to a
> > chance to login or to create an account (also pretty standard
> > practice).
>
> > Here's the rub:
> > I want to offer them a login form in a small modal box overlayed on
> > their current screen. I know how to do this from the client side,
> > using javascript, but in this case, I want the server to render that
> > modal box (since it's the server that determines that the user's
> > credentials are missing).
>
> > Any ideas how to do this?
>
> > Thanks,
> > Yoram
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] ActiveRecord::HasManyThroughCantAssociateThroughHasManyReflection

2009-04-14 Thread Celio Motta

Hello,

I tried the following and got that error and can't figure out how to
fix it... I know I can do a long way to add Turmas To a Disciplina but
using like the following would be very convinient:

p = Periodo.find(:first)
d = p.disciplinas.find(13)
d.turmas.create!(:codigo => '23A', :horario => '2a e 4a -
15-17h', :descricao => 'Turma Regular')

ActiveRecord::HasManyThroughCantAssociateThroughHasManyReflection:
Cannot modify association 'Disciplina#turmas' because the source
reflection class 'Turma' is associated to 'DisciplinaPeriodo'
via :has_many.

My models are:

class Periodo < ActiveRecord::Base
has_many :disciplina_periodos, :dependent => :destroy
has_many :disciplinas, :through => :disciplina_periodos

validates_presence_of :periodo
validates_uniqueness_of :periodo
end

class Disciplina < ActiveRecord::Base
has_one :disciplina_periodo
has_one :periodo, :through => :disciplina_periodo

has_many :disciplina_periodos, :dependent => :destroy
has_many :turmas, :through => :disciplina_periodos

validates_presence_of :codigo, :nome
validates_uniqueness_of :codigo
validates_uniqueness_of :nome
end

class DisciplinaPeriodo < ActiveRecord::Base
has_many :turmas, :dependent => :destroy
belongs_to :periodo
belongs_to :disciplina

validates_presence_of :periodo_id, :disciplina_id
validates_uniqueness_of :disciplina_id, :scope => :periodo_id
validates_uniqueness_of :periodo_id, :scope => :disciplina_id
end

class Turma < ActiveRecord::Base
belongs_to :disciplina_periodo
belongs_to :disciplina
validates_uniqueness_of :codigo, :scope => :disciplina_periodo_id
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: how to user heywatch

2009-04-14 Thread daociyiyou

thanks

On 4月14日, 下午7时22分, Phlip  wrote:
> daociyiyou wrote:
> > anyone can help me?
>
> Post the code you are using to read this RSS feed. The code around this:
>
> >>>  url=item_array0
> >>>  Discover.create( :url => url,
> >>> :download => true,
> >>> :title => item_array0,
> >>> :automatic_encode => true,
> >>> :format_id => format_hash[:if_flv],
> >>>  :ftp_directive => "")
>
> And your question is not entirely about Rails itself. Please study other
> successful questions here...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Newbie Question about script/generate

2009-04-14 Thread khagimoto

Thanks very much for this clarification.  You're right, I'm usually
coding things myself and not used to the concept of having things
generated for me.  I do have git, so I was able to back out.  It
sounds like the best way for me is to learn what a lot of plugins do
when generated, and combine those myself without using the generate.
Just what you suggested.. :-)  Thanks!!

On Apr 14, 3:01 am, Rick  wrote:
> 1)  It is definitely not necessary to use "script/generate" but it can
> be very helpful when you're just starting out.  The variants on
> generate (run "script/generate --help" and check out the installed
> generators) can give you a good idea on how the different MVC
> components hang together.
>
> 2) Yes, well there seems to be a growing dissatisfaction with plugins
> that rely on generate to build your app.  My guess is that your
> experience is part of the reason.  Configuration management (svn or
> git) can be invaluable here.  You really want to be able to back out
> the recent damage on occasion.
>
> As far as running multiple generates you need to understand what's
> going on with the different generators, i.e.:
>
> generate model User name:string profile:text
> generate scaffold User name:string profile:text
>
> both create a user.rb model and migration but scaffold also builds the
> controller and views as well as adding routes.
>
> You need to understand what is created when you issue the generate
> command and the best way I've found is to run it and study the
> results.
>
> On Apr 13, 8:42 am, khagimoto  wrote:
>
> > Hello,
> > I just started learning RoR myself, and I have a few newbie questions.
>
> > (1)  Is it always necessary to use the "script/generate" to start an
> > app?  Can it be created from scratch if one wanted to?  (Not that I
> > would, but I'm trying to understand...)
>
> > (2)  I followed the rails getting started guide to create a blog
> > successfully.  Then I thought of adding a login/authentication
> > mechanism, and proceeded to run the "script/generate login"  (after
> > getting login_generator.zip) on the same rail app.  It messed up the
> > original blog, because it had file name conflicts (I think).  How
> > would I run multiple "script/generate" on an app without messing up
> > the app?
>
> > Thanks!
> > Kumi
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 validate a form field sequentially

2009-04-14 Thread Gianluca Tessarolo
Yes, validating format only when field has a value:

ex.

validates_format_of :field, :with => "", :allow_blank => true

:allow_nil - If set to true, skips this validation if the attribute is 
nil (default is false)
:allow_blank - If set to true, skips this validation if the attribute is 
blank (default is false)

or
validates_format_of :field, :with => "", :if => Proc.new{|record| 
!record.field.blank? }
but the first one is better (allow_blank), with the last one u can make 
a validation based on more than one field...

Hope this helps...

> I've tought a solution, when it validates, it only takes the first error 
> message:
>
> if obj.errors.on(:email)
> errMsg << obj.errors.on(:email)[0]
> end
>
> Anybody knows a more elegant solution?
> greetings!
> Luis.
>
> Luis Sánchez wrote:
>   
>> First, sorry for my English :S ..
>>
>> Hi! I've searched about my problem into the forum but I didn't find any
>> post.
>> When I fill, for example, an email field my model validates the
>> presence, uniqueness, max-length (128) and format (a regular
>> expression).
>> If a user doesn't fill that field, the validation returns two messages:
>>   - The message about the field is blank (ye).
>>   - The message about the field haven't the correct format (b).
>> I only want to show the first message. Is there any way to do the
>> validation sequentially and stop when a validation doesn't be correct?
>> an example: first => presence, second => format, third => max-length,
>> fourth => uniqueness..
>>
>> Last, sorry for my English :S ..
>> Thanks!
>>
>> Luis
>> 
>
>   


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



[Rails] [ANN] Lone Star Ruby Conference 2009 - Now Accepting Talk & Training Submissions

2009-04-14 Thread jimfreeze


Lone Star Ruby Conference 2009
(Thu-Sat) August 27-29, 2009
Norris Conference Center
Austin, TX

Greetings

The third annual Lone Star Ruby Conference is getting
under way by opening the call for speakers.

This year the conference is going to be bigger and
better than ever! We have the whole conference center
this year, so there will be plenty of room to relax,
visit or create adhoc coding teams to unleash your
latest conference ware on the public.

The author of Ruby, Matz, will be keynoting this year.
Matz is expected to roll in on his Segway and treat
us all to the latest goodness in Ruby.

The ever entertaining Rich Kilmer will also be Keynoting.
Rich has been an advocate of Ruby from the very first
conference and can usually be found coding prototypes
that are three to four years before their time.

The popular hands-on training will be back this year.
There will be half-day and full-day training sessions
for you to sink your teeth into and take home valuable
Ruby knowledge.

We look forward to seeing you at the conference in August.
Please feel free to email us with your suggestions on
how we can make this your perfect conference.



Speakers:
We invite you to submit a proposal for a 45-minute or a
7-minute talk. The only requirement is that the topic be
Ruby related. (Note, although not finalized, expect
speaking time to be 35-minutes with 10-minutes of Q&A.)

Here are a few topics to give you some ideas:
 - Design and coding techniques
 - Testing tools and techniques
 - Developer productivity tips and tools
 - Patterns and best practices for developing Ruby code
 - MRI, Rubinius, JRuby, YARV
 - Rails, Rail3, Merb, Sinatra, Waves, Ramaze, etc
 - Ruby in the Enterprise
 - Ruby in Small Business
 - Ruby internals, meta programming
 - Data filtering, reporting, parsing

You name it. If it is Ruby related, we want to hear from you.

Please submit your proposal at:

  
http://spreadsheets.google.com/viewform?formkey=cFFLMDFLajgwYXRZSUx4RzY2TkxJT0E6MA..


Trainers:
Hands-on training is back this year. Courses can be
either 3hr (half-day) or 6hr (full-day). It is
recommended that full-day courses be team taught.
Also, remember that trainers are compensated. Last
year LSRC 2008 paid out over $15,000 to trainers.

When submitting a course curriculum outline, remember
that a training course is NOT an extended talk. 
Trainers should provide labs and hands on learning
experiences for the participants. Your course
submission should provide practical skills that
participants can take away and begin using immediately
to improve their coding.

Please submit your proposal at:

  
http://spreadsheets.google.com/viewform?formkey=cFFLMDFLajgwYXRZSUx4RzY2TkxJT0E6MA..

Proposals are due May 2, 2009.

Registration for LSRC 2009 will open in early May.

See you in Austin in August!

--
Jim Freeze
Lone Star Ruby Foundation, President

For sponsorship, media or promotional partner opportunities, 
contact Jim Freeze at lsrc2009 _at_ gmail _dot_ com.

P.S. Proposals are due by midnight May 2, 2009.

P.P.S. You can follow conference announcements on Twitter at 
http://twitter.com/lsrc




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

2009-04-14 Thread Nick Hoyle

Andrew Timberlake wrote:
> On Tue, Apr 14, 2009 at 4:33 PM, Nick Hoyle
>  wrote:
>>
>> how can i store each feed without it been overwrited so i can display it
>> in my view?
>>
>> regards
>>
>> nick
> 
> @feeds = []
> @address.each do |address|
>   @feeds << SimpleRSS.parse open(address.feed)
> end
> 
> In your view
> @feeds.each do |fee|
>   ...
> end
> 
> Andrew Timberlake
> http://ramblingsonrails.com
> http://www.linkedin.com/in/andrewtimberlake
> 
> "I have never let my schooling interfere with my education" - Mark Twain

Hi thanks for quick reply, i tried using << symbol before and it just 
gave me a syntax error indicating theres somethings wrong around parse. 
open
-- 
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: CSS issue...

2009-04-14 Thread Shandy Nantz

Abhishek shukla wrote:
> Hello friends
> I am calling css file from following folder
> "<%= stylesheet_path("#{RAILS_ROOT}/public/themes/style.css") %>"
> And getting the following error any idea?
> ActionController::RoutingError (No route matches
> "/home/user/test/testapp/public/themes/style.css" with {:method=>:get}):
> 
> Regards
> Abhi

Is this code in between your head tags? Can't you use:
<%= stylesheet_link_tag "style" %>
-- 
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: Loop and instance variable problem

2009-04-14 Thread Andrew Timberlake

On Tue, Apr 14, 2009 at 4:33 PM, Nick Hoyle
 wrote:
>
> I have a loop for parsing each rss feed
>
> @address.each do |address|
>         @feed = SimpleRSS.parse open(address.feed)
>       end
>
> the problem is my my instance variable @feed just gets overwritten so
> basically it displays the last parsed feed
>
>
> how can i store each feed without it been overwrited so i can display it
> in my view?
>
> regards
>
> nick

@feeds = []
@address.each do |address|
  @feeds << SimpleRSS.parse open(address.feed)
end

In your view
@feeds.each do |fee|
  ...
end

Andrew Timberlake
http://ramblingsonrails.com
http://www.linkedin.com/in/andrewtimberlake

"I have never let my schooling interfere with my education" - Mark Twain

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



[Rails] Re: is it possible to render a modal dialog box from the server?

2009-04-14 Thread Brendon

The server can only respond to client (browser) requests, so you have
to either render a login page and then redirect to the original
destination or you need to have some javascript to help with what you
want.  In short, the server can't MAKE the browser do anything...

On Apr 14, 6:33 am, "yber...@msn.com"  wrote:
> I have a before filter that authorizes a user's credentials before
> giving them access to any protected methods (pretty standard
> practice). If they fail authorization, I want to direct them to a
> chance to login or to create an account (also pretty standard
> practice).
>
> Here's the rub:
> I want to offer them a login form in a small modal box overlayed on
> their current screen. I know how to do this from the client side,
> using javascript, but in this case, I want the server to render that
> modal box (since it's the server that determines that the user's
> credentials are missing).
>
> Any ideas how to do this?
>
> Thanks,
> Yoram
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Can I get multiple applications with different rails versions running on one machine?(can't activate activerecord)

2009-04-14 Thread Brendon

Have you tried to freeze rails into the project?

On Apr 14, 2:26 am, hei  wrote:
> I did so, details below:
> original:
>   gem 1.2.0
>   rails 2.0.2
>   one application(call it OLD) running well
> now:
>   gem 1.3.1(for rails 2.3.2's needs)
>   rails 2.0.2, 2.3.2(both exists)
>   another application(just a test application, almost blank, call it
> NEW) meet errors:
>
>   /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:149:in `activate':
>  can't activate activerecord (= 2.0.2, runtime),
>   already activated activerecord-2.3.2 (Gem::Exception)
>
> Notice: I can't run gem cleanup, and I don't want change any of OLD
>              (including rake rails:freeze:edge RELEASE=2.0.2)
>            so I just freeze New, but still get errors.
> Can anyone help me ? Thanks a lot!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: My sql error: Lock wait timeout

2009-04-14 Thread Brendon

Do you have the correct indexes set on the tables?  It sounds like you
need to make the the delete operation far faster.

On Apr 14, 12:33 am, Sriram Varahan 
wrote:
> Hello,
>
> I have this application where there are 5 tables.
>
> I have the :dependent => :destroy clause  in such a way that if an entry
> in the first table is deleted all the "dependent" entries in the next 4
> tables are also destroyed.
>
> The issue is there are thousands of entries in the tables and this is
> taking a lot of time and I get a mysql error:
>
> Mysql::Error: Lock wait timeout exceeded; try restarting transaction
>
> Because of this I am not able to destroy an entry.
>
> I tried increasing the lock wait timeout time in the mysql configuration
> file. But still no improvement.
>
> Any help would be appreciated.
>
> 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] Loop and instance variable problem

2009-04-14 Thread Nick Hoyle

I have a loop for parsing each rss feed

@address.each do |address|
 @feed = SimpleRSS.parse open(address.feed)
   end

the problem is my my instance variable @feed just gets overwritten so
basically it displays the last parsed feed


how can i store each feed without it been overwrited so i can display it
in my view?

regards

nick
-- 
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 validate a form field sequentially

2009-04-14 Thread Luis Sánchez

I've tought a solution, when it validates, it only takes the first error 
message:

if obj.errors.on(:email)
errMsg << obj.errors.on(:email)[0]
end

Anybody knows a more elegant solution?
greetings!
Luis.

Luis Sánchez wrote:
> First, sorry for my English :S ..
> 
> Hi! I've searched about my problem into the forum but I didn't find any
> post.
> When I fill, for example, an email field my model validates the
> presence, uniqueness, max-length (128) and format (a regular
> expression).
> If a user doesn't fill that field, the validation returns two messages:
>   - The message about the field is blank (ye).
>   - The message about the field haven't the correct format (b).
> I only want to show the first message. Is there any way to do the
> validation sequentially and stop when a validation doesn't be correct?
> an example: first => presence, second => format, third => max-length,
> fourth => uniqueness..
> 
> Last, sorry for my English :S ..
> Thanks!
> 
> Luis

-- 
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] [SOLVED] Ruby 1.8.7 + Rails 2.3.2 + TLS

2009-04-14 Thread obiwan chinobi


> 
> # these options are only needed if you choose smtp delivery
> config.action_mailer.smtp_settings = {
>   :address=> 'smtp.gmail.com',
>   :enable_starttls_auto => true,
>   :port   => 587,
>   :domain => '...',
>   :authentication => :login,
>   :user_name  => '...',
>   :password   => 'secret'
> }

Correct configuration to get this working is:
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address=> 'smtp.gmail.com',
:port   => 587,
:domain => 'your.domain.com',
:authentication => :plain,
:user_name  => 'n...@your.domain.com',
:password   => 'password'
}
-- 
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: role_requirement question

2009-04-14 Thread elliottg

I had broken r_a#before_filter :login_required by tweaking the source
to make some tests pass. That change had also altered the way the
r_r#require_role was working.

I changed the code back, and now require_role "user"  & require_role
"admin" do as they should without having to use
before_filter :login_required as well.

Thanks for the help guys!


On Apr 14, 7:49 am, Bharat  wrote:
> Hello Elliott,
> Are you sure that:
>
> 1.  You have these roles defined in the roles table?  and;
> 2. There is an entry for row_id and user_id in your roles_users table?
>
> For example,
>
> If admin user has a user_id of 1 in users table and your roles table
> defines the "admin" role with a role_id = 1 then you must have a row
> in roles_users table corresponding to this combination:
>
> role_id = 1, user_id = 1
>
> Check if you have done this.
> Bharat
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 validate a form field sequentially

2009-04-14 Thread Luis Sánchez

First, sorry for my English :S ..

Hi! I've searched about my problem into the forum but I didn't find any
post.
When I fill, for example, an email field my model validates the
presence, uniqueness, max-length (128) and format (a regular
expression).
If a user doesn't fill that field, the validation returns two messages:
  - The message about the field is blank (ye).
  - The message about the field haven't the correct format (b).
I only want to show the first message. Is there any way to do the
validation sequentially and stop when a validation doesn't be correct?
an example: first => presence, second => format, third => max-length,
fourth => uniqueness..

Last, sorry for my English :S ..
Thanks!

Luis
-- 
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: saving mutliple objects to database

2009-04-14 Thread Wisccal Wisccal

Adam Akhtar wrote:
> If i create in memory a hundred or so instances of a model, how do i go
> about saving them to the database.
> 
> I have a Task Model
> 
> and say I have an array of Task obects
> 
> @tasks = [...]
> 
> how do i save them
> 
> do i
> 
> @tasks.each do |task|
> task.save
> end
> ?

What you can do is use the Model#create class method. You will have to 
instantiate hashes of properties instead of model objects, though. Like:

tasks = [{:name => 'Go shopping', :date => Time.now},{:name => 'Get a 
haircut' => 1.day.from_now}] #etc
Task.create(tasks)
-- 
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: deploying rails to apache with mongrel cluster

2009-04-14 Thread Charles Johnson
I agree. Dump mongrels and look at Phusion's Passenger instead (modrails.com
).
Cheers--

Charles

On Tue, Apr 14, 2009 at 8:39 AM, Leonardo Borges wrote:

>
> Honestly you'd be better off using apache with mod_rails.
>
> Mongrels are just a pain to manage
>
> It's not a matter of being worried with load only.. it's a matter of
> deployment simplicity.
>
> On Apr 14, 12:45 pm, srikanth  wrote:
> > Hi All,
> > Presently i have implemented an application using rails 2.2.2.
> > It has :
> > 1.mongrel 1.1.2
> > 2.apache 1.3
> > 3.rubygems 1.3.1
> > 4.ruby 1.8.6
> >
> > But i am not using apache so far because i am not worried about load.
> > Using single mongel i am running my application.
> >
> > Now i want to deploy it to apache with mongrelclustres.
> >
> > Can any one suggest how to implement this feature?
> >
> > Thanks
> > Srikanth
> >
>

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

2009-04-14 Thread Phlip

Abhishek shukla wrote:

> I am calling css file from following folder
> "<%= stylesheet_path("#{RAILS_ROOT}/public/themes/style.css") %>"

I think that should be stylesheet_tag.

Then take the RAILS_ROOT and public out. You are generating HTML for a web 
browser, and it can only hit your web browser (roughly speaking) from below the 
public folder.

<%= stylesheet_tag('themes/style.css') %>



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



[Rails] Routing question

2009-04-14 Thread DanC

I have a resource for jobs on my application and I am familiar with
RESTful routes etc. I am also happy adding some custom routes to my
controller.

My question is, can I create an alias controller, i.e. instead of
www.mysite.com/jobs can I use www.mysite.com/alias  as the 'jobs'
isn't very intuitive for what the app is doing.

Can I do this in routes.rb so I don't have to create any files?

Better still would be to set up a sub-domain type route that worked
like alias.mysite.com = mysite.com/jobs

Again I am unsure on whether this is possible.

Any advice or quality links to good resources would be appreciated

Regards,

Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Memcached 1.6.5 (Rails 2.3) 10x slower

2009-04-14 Thread whatcould


> Simple answer, turn off socket timeouts in order to dramatically speed
> up memcache-client but realize you might be woken up at 3am when
> production melts down, as I was.

Better answer -- split the difference: install mike's memcache-
client-1.7.2 (from github) and the SystemTimer gem, which speeds up
1.6.5 substantially without turning off the timeouts.

My problem is that I added fragment caching thinking .03ms fetch times
were normal, and now when it takes 3-4ms (with the timeouts) to get
each fragment... stuff gets really slow. So until i refactor, timeouts
are off.

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] CSS issue...

2009-04-14 Thread Abhishek shukla
Hello friends
I am calling css file from following folder
"<%= stylesheet_path("#{RAILS_ROOT}/public/themes/style.css") %>"
And getting the following error any idea?
ActionController::RoutingError (No route matches
"/home/user/test/testapp/public/themes/style.css" with {:method=>:get}):

Regards
Abhi

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



[Rails] CSS issue...

2009-04-14 Thread Abhishek shukla
Hello friends
I am calling css file from following folder
"<%= stylesheet_path("#{RAILS_ROOT}/public/themes/style.css") %>"
And getting the following error any idea?
ActionController::RoutingError (No route matches
"/home/user/test/testapp/public/themes/style.css" with {:method=>:get}):

Regards
Abhi

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

2009-04-14 Thread Freddy Andersen

map.resources :accounts, :member => { :select_photo => :get } ???

On Apr 14, 5:47 am, MaD  wrote:
> you should read-up on REST.
>
> still (without knowing your code) you can just use routes the old
> fashioned style like you used to have them in rails < 2.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: deploying rails to apache with mongrel cluster

2009-04-14 Thread Leonardo Borges

Honestly you'd be better off using apache with mod_rails.

Mongrels are just a pain to manage

It's not a matter of being worried with load only.. it's a matter of
deployment simplicity.

On Apr 14, 12:45 pm, srikanth  wrote:
> Hi All,
> Presently i have implemented an application using rails 2.2.2.
> It has :
> 1.mongrel 1.1.2
> 2.apache 1.3
> 3.rubygems 1.3.1
> 4.ruby 1.8.6
>
> But i am not using apache so far because i am not worried about load.
> Using single mongel i am running my application.
>
> Now i want to deploy it to apache with mongrelclustres.
>
> Can any one suggest how to implement this feature?
>
> Thanks
> Srikanth
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] is it possible to render a modal dialog box from the server?

2009-04-14 Thread yber...@msn.com

I have a before filter that authorizes a user's credentials before
giving them access to any protected methods (pretty standard
practice). If they fail authorization, I want to direct them to a
chance to login or to create an account (also pretty standard
practice).

Here's the rub:
I want to offer them a login form in a small modal box overlayed on
their current screen. I know how to do this from the client side,
using javascript, but in this case, I want the server to render that
modal box (since it's the server that determines that the user's
credentials are missing).

Any ideas how to do this?

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



[Rails] [ANN] The "Ruby Best Practices" Collaborative Blog

2009-04-14 Thread Gregory Brown

Hi folks,

This is a one-time announcement about yet another blog project of
mine...

== What ==

A couple weeks ago I put out a call for volunteers to run a
collaborative blog with me focused on best practices in Ruby.   It is
now live at:

http://blog.rubybestpractices.com/

== Who ==

For starters, I went with an 8 person core group, which aside from
myself includes:

James Britt, Kirk Haines, Robert Klemme, Jeremy McAnally, Sean
O’Halpin, Magnus Holm and Lakshan Perera

== Why ==

You can read more about the details of the blog and each of these
folks at:

http://blog.rubybestpractices.com/about/

But the general idea is that we want to provide great content that
helps folks get better at Ruby while still keeping the focus on real
world problems.   We also want to have a lot of fun, too!

Please enjoy the new blog, and get involved in the conversations that
crop up as we continue to write new content.  We will also begin
accepting articles from casual contributors, so keep an eye out for an
announcement about how that will work.

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



[Rails] Unable to start rails after upgrade to 2.3.2

2009-04-14 Thread mve

Error:
/usr/local/bin/rails:19:in `load': no such file to load -- rails
(LoadError) from /usr/local/bin/rails:19

Problem:
Am unable to run the rails framework.  Probable victim of a, self
inflicted, GEM update run with insufficient privileges. Failure occurs
when I attempt to run any rails commands.  Rails says that it can't
find itself, yet my machine seems to have several rails executables.

Context:
Mac OS X 10.5.6
Ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.6.0]
Gem 1.3.1
Rails install was an attempt at 2.3.2
Which ruby shows:  /usr/local/bin/ruby
Which gem shows:  /usr/local/bin/gem
Which rails shows:  /usr/local/bin/rails

.profile file sets path as follows:
export PATH="/usr/local/bin:/usr/local/sbin:/usr/local/mysql/bin:
$PATH"

Have not found a .bash_profile or .bash_login file, so I believe
(assume) that the only path statement is the one in the .profile file.

Have found the following rails folders:
1) /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/
Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/rails-1.2.3/
lib
2) Library/Ruby/Gems/1.8/gems/rails-2.2.2/bin/rails
3) Library/Ruby/Gems/1.8/gems/rails-2.3.2/bin/rails
4) usr/bin/rails
5) usr/local/bin/rails

Does anyone have any suggestions on where I should look to solve this
puzzle?


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



[Rails] Beginner/ Filtering logged users

2009-04-14 Thread fa00026


I just had an idea of banning the user from posting a new message
unless logged in, how to use the filter in that case, below is where I
want to put the filter (it is part of my posts controller) I have
tried to put the filter inside it but it is not working. apologies for
my question as I am a beginner in Ruby and Rails.

def new

@post = Post.new

respond_to do |format|
  format.html # new.html.erb
  format.xml  { render :xml => @post }
end

  end

Which is a part of the controller, called posts

class PostsController < ApplicationController

# GET /posts
# GET /posts.xml
def index
@posts = Post.find(:all)

respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @posts }
end
end

# GET /posts/1
# GET /posts/1.xml
def show
@post = Post.find(params[:id])
@post_comments = @post.comments.collect
flash[:post_id] =...@post.id
end

# GET /posts/new
# GET /posts/new.xml
def new

@post = Post.new

respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @post }
end
end

# GET /posts/1/edit
def edit
@post = Post.find(params[:id])
end

# POST /posts
# POST /posts.xml
def create

@post = Post.new(params[:post])

respond_to do |format|
if @post.save
flash[:notice] = 'Post was successfully created.'
format.html { redirect_to(@post) }
format.xml { render :xml => @post, :status => :created, :location =>
@post }
else
format.html { render :action => "new" }
format.xml { render :xml => @post.errors, :status
=> :unprocessable_entity }
end
end
end

# PUT /posts/1
# PUT /posts/1.xml
def update
@post = Post.find(params[:id])

respond_to do |format|
if @post.update_attributes(params[:post])
flash[:notice] = 'Post was successfully updated.'
format.html { redirect_to(@post) }
format.xml { head Surprisedk }
else
format.html { render :action => "edit" }
format.xml { render :xml => @post.errors, :status
=> :unprocessable_entity }
end
end
end

# DELETE /posts/1
# DELETE /posts/1.xml
def destroy
@post = Post.find(params[:id])
@post.destroy

respond_to do |format|
format.html { redirect_to(posts_url) }
format.xml { head Surprisedk }
end
end

# Adding a comment
def post_comment
@comment = Comment.new(
"post_id" => flash[:post_id],
"created_at" => Time.now,
"comment" => params[:comment]['comment']
)
flash[:notice] = 'Comment was successfully added.' if @comment.save
redirect_to :action => 'show', :id => flash[:post_id]
end
end

I have been trying to modify this code which I got from the book agile
Web Development with rails (the latest edition) as it has excatly the
same concept because it also filters adminstrators users from any
other users

Before_filter :authorize, :except => :login

And this one also

protected
def authorize
unless User.find_by_id(session[:user_id])
session[:original_uri] = request.request_uri
flash[:notice] = "Please log in"
redirect_to :controller => 'admin', :action => 'login'
end
end
end


Ah, of course I have developed the login in the admin controller
Appreciate your help

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



[Rails] Re: assert_valid in unit tests after upgrade to rails 2.3 doesn't work

2009-04-14 Thread Mohamed Aslam

Having the same problem here. But still didn't find any solution.



On Apr 7, 11:34 am, Constantin Gavrilescu
 wrote:
>   def test_valid
>     assert_valid State.first
>   end
>
>  Error:
> test_valid(StateTest):
> NoMethodError: undefined method `assert_valid' for # 0x7f0d60750318>
>
> I see that test_valid is now in
> ActionController::Assertions::ModelAssertions. Does this mean that
> test_valid is designed to be used i ActionController tests only?
>
> I can change my assert_valid(State.first) into assert
> (State.first.valid?) but assert_valid prints meaninful failure
> messages, unlike assert which just tells me "nil is not true". How can
> I use assert_valid in my unit tests? My test classes declared
> something like this: class StateTest < ActiveSupport::TestCase

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



[Rails] routing method problem

2009-04-14 Thread jack.yang

I have two named routes:
map.edit_setting 'setting/:key', :controller => 'settings', :action =>
'edit', :method => :get
map.update_setting 'setting/:key', :controller => 'settings', :action
=>
'update',
:method => :put

And I have to link_to_remote links:
link_to_remote "Edit", :url => edit_setting_path
(@setting.key), :method
=> :get
link_to_remote "Save", :url => update_setting_path(@setting.key),
:method => :put

But both link will trigger the :edit action. It seems Rails ignores
the
:method parameter when routing.

How can I map the same url with different method to different actions?
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: Ruby On Rails with Webrick on a Vista System

2009-04-14 Thread Mohamed Aslam

Hi, It's very simple.

In Rails 2.2.2, if there is any problem with configuration, it was
clearly notify in the browser. For an example,
if you didn't have a proper database, or password for access database
and so on. But from Rails 2.3 this feature
is missing. It's just showing the message “We're sorry, but something
went
wrong.  We've been notified about this issue and we'll take a look at
it shortly”. I don't know why. Rails team should consider this.

First you need to check the database.yml file under the config folder.
By reading the first commented line you can
identify what is the database that you are using. Most probably it
should be SQLite3, if you didn't specify otherwise.
If so, you won't require the username and the password for the
database. You need to install some SQLite3 libraries using
gem package manager.

If you are using "Instant Rails" - single click installer then the
libraries already with in the package.

If your database.yml file configuration shows that you have set up a
MySQL database, then you need to specify the proper
username and password. Then before you run the application you need to
create the database. You can use the rake utility for that.

rake db:create

Then run the application. If you still have problems. Let me know.
I'll help. According to my point of view Windows in not a suitable
and enjoyable development environment for Rails. Try Rails with
Ubunutu or any other Linux distribution. If you need a guild to
install
Ruby on Rails on Ubuntu you can read my latest blog post here.

http://mohamedaslam.com/

Finally, please check the version of the book that you are learning.
Of course, it's a perfect book. But 1st and 2nd versions are now
outdated.
You can't use many functions described in those edition. Most of them
are now deprecated. Latest 3rd edition is now released.

Regards,
Mohamed Aslam



On Apr 10, 7:03 am, SnLStark  wrote:
> Does this work.  I am trying to learn ROR on my home system (Vista)
> using the Agile Web Development with Rails and can not get past the
> first program.
>
> I need some help I am currently learning Ruby on Rails and found a
> great book – Agile Web Development With Rails.  It has many good
> examples and does an excellence job of presenting the information.
> The problem that I am having is when I attempt to create and run the
> programs on my Vista system using WEBrick.  After starting WEBrick I
> can enter '//localhost:3000' and the Welcome Aboard screen. But from
> there it goes down hill.
>
> Continuing with the example I add the controllers and views for 'Say'
> with a hello method as it instructs and attempt to load them.  But I
> keep getting the following message: “We're sorry, but something went
> wrong.  We've been notified about this issue and we'll take a look at
> it shortly”.  Who are 'we' and how are they doing to help me with this
> problem.
>
> Can any of you help me?  The book gives not suggestions nor where to
> go for help. I would appreciate any guidance that any one can give me.

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

2009-04-14 Thread MaD

you should read-up on REST.

still (without knowing your code) you can just use routes the old
fashioned style like you used to have them in rails < 2.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] "map.resources " problem

2009-04-14 Thread Tushar Gandhi

Hi,

I am new in rails 2.0 and above. I am using rails 2.2.
I have a mapping "map.resources :accounts" in my routes.rb

I am facing the following problem:
I have following code in my erb file
Photo 1

Whenever I am clicking on this link I am redirecting to the accounts
show method.
I already added "select_photo"  method in my account controller.
Anyone can help urgent. I stuck due to this.
Also, I am very curious about this issue.
Anyone can explain why it has happened?
Please give me solution for the same.

Thanks,
Tushar
-- 
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] About haml and ruby on rail

2009-04-14 Thread Nilesh Kulkarni



hi all,

   I am converting my view into HAML format i have done it with
"Html2Haml" command, then I removed all the "- end" from haml code and
my indentation is also correct,but now  it shows following errors
 I have kept code of show.html.erb and show.html.haml in attachment.

please help me I am not getting what exactly the error is?

compile error D:/aflatune/app/views/tracks/show.html.haml:33: syntax
error, unexpected tCONSTANT, expecting ')' _hamlout.open_tag("a", false,
false, false, false, {"class"=>"ActionLink"}, false, false, nil, nil,
:href => "#", :onclick => "if(confirm("Are you sure you want to delete
this track and associated media file?"))
showPane(parseLocation("#{track_path}"),true,false,true,"delete");return
false;" );
^ D:/aflatune/app/views/tracks/show.html.haml:53: syntax error,
unexpected kELSIF, expecting kEND  elsif @content_type == :youtube;
^ D:/aflatune/app/views/tracks/show.html.haml:91: syntax error,
unexpected kELSIF, expecting kEND  elsif;   ^
D:/aflatune/app/views/tracks/show.html.haml:107: syntax error,
unexpected kENSURE, expecting kEND
D:/aflatune/app/views/tracks/show.html.haml:109: syntax error,
unexpected $end, expecting kEND

Attachments:
http://www.ruby-forum.com/attachment/3575/html_and_haml_file.txt

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

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



[Rails] Re: ActiveRecord and :include

2009-04-14 Thread Phlip

slava wrote:

> here is my model
> 
> class ProductLocation < ActiveRecord::Base
>   belongs_to :property
>   has_many :product_location_mappings

Tip: Model names shouldn't be redundant with their navigation. Just call it 
Mappings. An even better name would reveal the intent of the model...

> end
> 
> 
> I want to load product_locations along with
> referenced :product_location_mappings and return a deep model.
> 
> @product_locations = ProductLocation.find_all_by_property_id
> (property_id, :include => [:property, :product_location_mappings])
> 
> however result does not include :product_location_mappings...
> I am using rails 2.3.2, not sure what to do..

Show a unit test that includes all your models linked together, per their yml 
fixture files. Then show that find() statement locating your target record.

If the code still does not work, gem install assert2 assert_efficient_sql, 
require 'assert_efficient_sql', and wrap this around your test:

   inspect_sql :verbose => true do
 product_locations = ProductLocation.find_all_by_property_id
(property_id, :include => [:property, :product_location_mappings])
   end

BTW you might also have read your log/test.log, but inspecting your code is 
what 
tests are for...

You will get a big blob of JOIN statements. Inspect them to see if they make 
sense, and run them in your database directly to see what they do.

But, in general, your code looks like the :include directives I have written, 
so 
I don't see any specific problem with it. That's why the shotgun of 
recommendations.

-- 
   Phlip


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



[Rails] Re: role_requirement question

2009-04-14 Thread Bharat

Hello Elliott,
Are you sure that:

1.  You have these roles defined in the roles table?  and;
2. There is an entry for row_id and user_id in your roles_users table?

For example,

If admin user has a user_id of 1 in users table and your roles table
defines the "admin" role with a role_id = 1 then you must have a row
in roles_users table corresponding to this combination:

role_id = 1, user_id = 1

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

2009-04-14 Thread Phlip

daociyiyou wrote:

> anyone can help me?

Post the code you are using to read this RSS feed. The code around this:

>>>  url=item_array0
>>>  Discover.create( :url => url,
>>> :download => true,
>>> :title => item_array0,
>>> :automatic_encode => true,
>>> :format_id => format_hash[:if_flv],
>>>  :ftp_directive => "")

And your question is not entirely about Rails itself. Please study other
successful questions here...


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



  1   2   >