[Rails] Re: Project Server not starting. No Errors.

2009-10-19 Thread Peter Warrick

Peter Warrick wrote:
> Sijo k g wrote:
>> Hi Peter Warrick
>> 
>>Have you properly setup database? Seems like you have not given 
>> username and/or password in database.yml
>> 
>> 
>> Sijo
> 
> Sijo,
> 
> Thanks for the reply. The DB is working properly. It was working earlier 
> today no problem. As I stated above, I copied over my project to my 
> laptop with the hostname of the db set to the IP of my original machine. 
> Everything works just fine.
> 
> It does seem likes it's waiting to do something but is stuck. I hit 
> CTRL-C and it then says it's started up the server. But its not actually 
> running since nothing shows up in netstat and when I try to connect to 
> it via a browser it of course doesn't work.
> 
> I'm baffled by this one.
> 
> Peter

Ok this was a tough one. But I have FIXED it.

Turns out this is a bug in mongrel. Normally I would not have believed
this as this was working just fine before and then suddenly stopped.
Admittedly I can't remember what little I did to mess it up but I'm
thinking a gem got messed up or a bad one got installed.

Here's the website that helped me out..

http://mongrel.rubyforge.org/ticket/37

There's a bunch of weird links are you go through the comments about
n1ke (had to put in a 1 there since ruby-forum thought I was spamming) 
shoes and stuff.. Ignore that. In fact don't bother reading past
the attachments section. Click on it or go to this link which is the
patch file. I didn't bother grabbing the patch I just fixed it
manually.. Link is here..

http://mongrel.rubyforge.org/attachment/ticket/37/37-fix-infinite-loop-error-in-gem-require.patch

You'll noticed that they replaced the "retry" with "Kernel.require
library". I guess Mongrel can go into an infinite loop if it see a gem
installed but the file inside it doesn't exist (at least that's what I
read).

Anyway I edited the bad file and it works great now.

On my mac the file existed here and use sudo vi to edit it (here's the
entire commandline command)...

sudo vi
/opt/local/lib/ruby/gems/1.8/gems/mongrel-1.1.5/bin/../lib/mongrel/gems.rb

You'll notice it goes back a directory between bin and lib. This was a
copy paste I grabbed. I guess you could just cut out the bin/../ and
just shove in the rest starting at lib. :)

Anyway, I'm fairly new to ruby and rails and am just trying to learn.
This was a baffling mystery to me and I thought it was all in my code. I
re-installed ruby, rails, mongrel, postgres, etc.. many times without
success.. I hope this helps someone else who runs into this in the
future. It was frustrating. It's not often the error is not in your own
code. :) (Although granted I must've screwed up a gem somehow for this
bug to surface only on this one computer. :) )

Thanks for the prior responses as well.

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

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



[Rails] Re: Simple system for asynchronous SQL queries

2009-10-19 Thread Hassan Schroeder

On Mon, Oct 19, 2009 at 7:26 PM, Robert Matei wrote:
>
> Should note that I already have delayed_job running, but it seems a bit
> silly to create a job (in the database) that just executes a SQL query,
> even if the SQL query is running take significantly longer than creating
> the job.

And it would be somehow less "silly" to do file IO to "dump them to some
text file and then read them in a daemon and " open a DB connection to
" send them to MySQL?

>> What would be the simplest way of implementing this?

I'd say you just identified the "simplest", since it's already in place.
YMMV  :-)

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

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



[Rails] Re: Handling missing associations

2009-10-19 Thread Sijo k g

Hi Elias Orozco

  So do you want all messages be deleted when its user deleted?If so 
in user model you can add like  (Assuming your association is user 
has_many messages)

user.rb

has_many :messages,:dependent => :destroy

 Now when you delete a user all the dependent messages will also get 
deleted



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

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



[Rails] Re: Simple system for asynchronous SQL queries

2009-10-19 Thread Sijo k g

Hi Robert Matei

   Can't you use a rake task and make a cron to execute this task at a 
specified time or time interval ?


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

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



[Rails] Annoying problem with file_field and paperclip

2009-10-19 Thread James West

Hi all,
I have a really really annoying problem that's driving me nuts with
file_field and paperclip and having to upload images everytime a form is
edited even though the user is quite happy with the currently uploaded
image or loose the previously uploaded image.

This seems to be caused by the rails file_field helper not storing the
data that has been read in from the db in the same way that other field
helpers do and therfore unless an image is uploaded everytime the form
is updated the data for the current image does not get sent back to the
controller in the params hash.
This in turn causes the model to believe that the data has been deleted.

This is obviously a problem with the rails helper as it should work the
same way as all the other field helpers do and retain the data somehow
but right now I need a work around.

Javascript is not an option as the site is a W3C AAA compliant site and
creating a seperate form is just plain wrong as the user has enough to
do without adding more button clicks.

Any ideas would be greatly appreciated.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Associations are not found with STI using Rails 2.3

2009-10-19 Thread Shahzad Bhatti

Matt Jones wrote:
> On Oct 18, 3:03�pm, Shahzad Bhatti 
> wrote:
>> I have recently upgraded my Rails app to 2.3. I am using STI where I
>> have class called BaseProfile that is extended by IndividualProfile. I
>> have some assocations that are defined in BaseProfile but I have been
>> getting errors when views reference those relationships, e.g.
>>
>> undefined method `primary_user?' for #
>> RAILS_ROOT: /home2/plexobje/rails/linktank
> [snip]
>> The primary_user? is defined in parent class. This code used to work
>> with older version of Rails. Is there a fix for this?
>> Thanks.
> 
> You weren't kidding about the "older version" part, were you? :) That
> method was deprecated back in 0.9.5(!!) (January 2005) and went away
> several versions later. Even the deprecation warning is gone now.
> 
> The now-long-gone deprecation message recommended that you use ==
> instead; you'll need to check if you were passing the second argument
> (force_reload) or not.
> 
> --Matt Jones



As I said, primary_user? was defined in my class and I wasn't using 
deprecated method. However, it looks like Rails filters that method so I 
renamed it and it works now.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Simple system for asynchronous SQL queries

2009-10-19 Thread Robert Matei

Should note that I already have delayed_job running, but it seems a bit 
silly to create a job (in the database) that just executes a SQL query, 
even if the SQL query is running take significantly longer than creating 
the job.

Robert Matei wrote:
> There has to be something like this... I have some tracking related SQL
> queries that are slow and don't need to happen in the request cycle. Is
> it possible to dump them to some text file and then read them in a
> daemon and send them to MySQL?
> 
> What would be the simplest way of implementing this?

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

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



[Rails] Simple system for asynchronous SQL queries

2009-10-19 Thread Robert Matei

There has to be something like this... I have some tracking related SQL
queries that are slow and don't need to happen in the request cycle. Is
it possible to dump them to some text file and then read them in a
daemon and send them to MySQL?

What would be the simplest way of implementing this?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] From 3 fields :date input from forms to 1 field

2009-10-19 Thread Francesco Belladonna

Hi Rails community, here is my newbie problem (I'm migrating from PHP to
ruby due to framework and ruby syntax, but I'm having some problems with
"freedom" that a single php page offers):

I'm using the scaffolding technique (yea, I love it) to create a
webpage, but if I specify that a field type is :date, Rails auto
generate a form where the field of type :date is created through 3
fields: day, month and year.

I would like to use only one field (always) (will be something that I'll
use for all :date field-type), a text field, where the date will be
written in dd/mm/YY format, how can I do this without writing something
in javascript that "set some hidden fields" (month and year) when you
write in the text field?

Are there a "general" way (as I've said, I'll use this always instead of
normal way of setting dates)?

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

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



[Rails] Re: Can (should) each :user have his own table?

2009-10-19 Thread AlwaysCharging

> One thing the article made clear was that the design of having a users
> table makes sense in a *lot* of situations, just not all. The soution
> they outline is very specific to twitter.
>
> Alto bear this in mind, their system breaks down a little when you
> decide to follow another user, you then have to find all (all of the
> historical, just the last day? just the last 100? what?) their posts,
> and insert them into your private post stream, which could get quite
> intensive. Granted it doesn't happen as often as searching, or posting,
> but it could have a big impact.

My thought would be that you'd just be following then from that point
forward (so no need for past data).  However, that user's past data
could still be availabe on their profile if you cared to look through
it, but you'd only be subscribing to their new posts.


> To answer your question though. You would probably have a users table,
> and that would have a one to many relation to entries in a
> _stream table. The logic that creates the user in the database
> would first create the _stream table, and then create the
> actual user. You would need a fair bit of reflection on the ruby side to
> get that to work, as their wouldn't be anything in the DB to directly
> connect the two tables.

This is what I was afraid of.

> Which sounds a bit fishy to me. Although I guess you could have
> _stream as the table name, which is a little less ambiguous.

Yeah that doesn't seem so bad.  So instead of having to query a giant
table of everyone's posts, you'd only be querying the _stream
tables of all the users you're following.  This makes sense in my
hypothetical mind, but the way to implement it I wasn't sure.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 (should) each :user have his own table?

2009-10-19 Thread AlwaysCharging

@Frederick Cheung:  Yeah, I just meant that article got me thinking
about my database setup for my users and not that I was trying to
mirror it.


On Oct 19, 9:22 am, Marnen Laibow-Koser  wrote:
> AlwaysCharging wrote:
> > I was reading this article a while back
> >http://www.sitepoint.com/blogs/2008/06/06/did-rails-sink-twitter/
> > and it got me thinking.  If I wanted to set up my app so that each
> > user has his/her own table, how would I go about doing that?
>
> You wouldn't.  It's a horrible idea, and whoever wrote the article
> doesn't appear to understand good database design.  There are other ways
> to achieve good performance.

Umm... and examples of that would be ... ?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: find, using a link instead of a form

2009-10-19 Thread SNelson

Thanks again.
> That seems pretty minimalist :-)
I like minimalist.
Will head in that direction and shout if I fall down any holes along
the way.
Which is likely.

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



[Rails] Render collection of partials: in batches of 30?

2009-10-19 Thread Jeffrey L. Taylor

My app is rendering a partial with a collection of 180 ActiveRecords.  I
noticed that while most are in the 3-8ms range, every 30th record is over
100ms.  Any ideas what is causing that and if there is a way around it?

TIA,
  Jeffrey

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



[Rails] RESTful Routing - Difference between new, collection, member

2009-10-19 Thread Phoenix Rising

I'm re-working an application from scratch to make use of REST-based
resource routing for the first time.  In doing some reading, I found
the Rails guide (http://guides.rubyonrails.org/routing.html) to be
really helpful, but I don't quite understand the difference between
"new", "collection" and "member" when defining additional routes on a
resource.  Could somebody clear that up a little - preferably with
some "real world" examples?  The examples in the rails guide seemed
pretty ambiguous.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Check if association cached without hitting db?

2009-10-19 Thread Raymond O'Connor

Is there a way to tell if an association on an object is cached without
hitting the db?

For example, let's say I have order has_many line_items, is there a way
for me to tell if order.line_items is already populated?
-- 
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] Handling missing associations

2009-10-19 Thread elioncho

Hello,

I have a message model which belongs to a user. Users can be deleted,
but messages cannot. What can I do to reference a user that created a
message when it no longer exists?:

1) Create a dummy user. When a user is deleted, assign the dummy user
id to all of its messages.
2) Have a condition to check if the user exists, if not, don't show
the user info.
3) Don't really delete the user, just flag it or change its state to
inactive.

These 3 occured to me. Any other options I should have in
consideration? Which one should I follow?

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: prevent duplicate words in array

2009-10-19 Thread Jeffrey L. Taylor

Quoting First Bat :
> 
> hello,
> 
> how do i prevent someone to enter duplicate word
> 
> for example,
> 
> 
> 
> eat = ""
> data = []
> 
> print "what did you eat for dinner?: "
> eat = gets.chomp
> 
> data << eat
> 
> so let say if they enter a food twice, it would print something like
> 
> " #{eat} you already entered that"
> 
> i was told to use Array#index, but i have no idea how to use it
> 

eat = ""
data = {}
print "what did you eat for dinner?: "
eat = gets.chomp

if data[eat]
  puts " #{eat} you already entered that"
else
  data[eat] = true
end

HTH,
  Jeffrey

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



[Rails] prevent duplicate words in array

2009-10-19 Thread First Bat

hello,

how do i prevent someone to enter duplicate word

for example,



eat = ""
data = []

print "what did you eat for dinner?: "
eat = gets.chomp

data << eat

so let say if they enter a food twice, it would print something like

" #{eat} you already entered that"

i was told to use Array#index, but i have no idea how to use it

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

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



[Rails] Re: find, using a link instead of a form

2009-10-19 Thread Hassan Schroeder

On Mon, Oct 19, 2009 at 1:57 PM, SNelson  wrote:

>> Uh, why not just create an appropriate controller method, something
>> like  'pending', and use that as the link, e.g. '/assignments/pending' ?

> I'll give that a try. I'm probably over-thinking things - was trying
> named_scopes and other new (to me) stuff - but probably basic is
> better here?

You could use a named_scope in your model --  I would -- and then
combine that with a custom route/controller method to invoke it.

That seems pretty minimalist :-)

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

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

2009-10-19 Thread JeffV

I tried the composite_primary_keys (2.3.2) plugin, with the same
overall result: I cannot insert a row (via Postgres) into a table
without a PK. My model now has this line:
   set_primary_keys :doc_id, :user_id, :view_date, :view_time  #
legacy tbl, include all cols

My insert error is thus:
Mcolumn "doc_id,user_id,view_date,view_time" does not exist
P170
Fparse_expr.c
L421
RtransformColumnRef: INSERT INTO "document_ref_access" ("doc_id",
"user_id",
 "view_date", "view_time") VALUES (1, E'W:5:a_name', '2009-10-19',
'2009-10-1
9 14:52:11.605227') RETURNING "doc_id,user_id,view_date,view_time")

The RETURNING clause seems to be causing the problem.  If I set the PK
to, say, :doc_id (mind you this col is NOT a PK for this table) the
insert works but the doc_id col is set to NULL. Any other suggestions?

Thanks,
Jeff

On Oct 16, 12:32 pm, Marnen Laibow-Koser  wrote:
> JeffV wrote:
> > We have 30-40 tables in a legacy db with no PKs. These tables hold
> > various logging events and may be searched by a given day, a given
> > user id, a given event, etc., but not by a particular row id. So there
> > are reasonable reasons to not have PKs on all tables.
>
> I think you're confusing the concept of a *surrogate* PK with a PK in
> general.  Sure, in the case of your logging tables, it's probably
> reasonable not to have a separate Rails-style id field (surrogate PK).
> But it is advisable -- I'd even say essential -- to find some existing
> field or combination of fields that can be guaranteed unique for each
> record, and to declare them as a (perhaps composite) PK.
>
> > Unfortunately,
> > AR really like PKs...
>
> And so it should.  If you don't want a surrogate PK, then declare some
> other field the PK.  The composite_primary_keys plugin may help here. I
> maintain -- and I believe big-name DB gurus would say likewise -- that a
> table without *some* sort of PK is virtually always a Bad Thing, with or
> without Rails. .
>
> > If I set_primary_key nil I can't do a create (I get an interning empty
> > string error). If I set the PK to an arbitrary integer column then
> > that column is set to NULL (on an insert), despite its value being
> > passed in the attributes hash... I don't yet have a solution.
>
> See what composite_primary_keys will do for you.
>
>
>
> > Jeff
>
> > On Sep 16, 6:48 pm, Marnen Laibow-Koser 
> 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] Re: Combobox population by means of JQuery and Ajax.

2009-10-19 Thread Ale Ds

Solved :D

I forgot escape_javascript:

$('#event_municipality_id').html("<%= escape_javascript(opts) %>");

bye,
Alessandro
-- 
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] Combobox population by means of JQuery and Ajax.

2009-10-19 Thread Ale Ds

This is the view municipalities.js.erb I have:

<% list_opt = options_from_collection_for_select(@municipalities, :id,
:name) %>
<% puts list_opt  %> #ok! list_opt contains the options
$('#municipality_id').html('<%= list_opt %>');

and this is the combobox in the view:
...
Comune 
...

if instead of '<%= list_opt %>' I manually assign the string

'Alagna
Albano
AliceCastello
Arborio
...'
into list_opt then the combo municipality_id correctly works,
if I use options_from_collection_for_select doesn't works (empy
combobox)
but that string is the same of options_from_collection_for_select

then why doesn't work ? :(

Thank you,
Alessandro
-- 
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: Calendar icon for date selection functionality

2009-10-19 Thread Francesco Belladonna

Ram wrote:
> this is the plugin u need code.google.com/p/calendardateselect/

Well, sorry to "resurrect" this post but I'm not sure on what should I 
do: if I won't use that plugin (I would like to use the javascript 
datepicker from jquery UI), I would like to understand the way on how 
the plugin "parse" the information for the database. By default, rails 
receive input of a date from separated fields: how can I do the 
same?Because I will send informations from a single text field and not 
through 3 as rails normally do
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: find, using a link instead of a form

2009-10-19 Thread SNelson

Thanks;
> Uh, why not just create an appropriate controller method, something
> like  'pending', and use that as the link, e.g. '/assignments/pending' ?
I'll give that a try. I'm probably over-thinking things - was trying
named_scopes and other new (to me) stuff - but probably basic is
better here?
Steve
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 abstract_class and model inheritance

2009-10-19 Thread Michael Rigart

Hi everybody,

I'm having problems on a testcase that I'm working on. I hope that I can
explain the problem properly and that some of you can help me out
becouse I'm realy stuck on this one.

Ok, I have a Page model that needs to be multi lingual. Therefore I have
used a small but nice plugin: http://github.com/janne/model_translations
. Basically, I had to create a new model PageTranslation that conatains
the i18n attributes. Let me draw a small example:

Page

id
parent_id

PageTranslation
---
title

Now I want to use these object for the base of other objects. So I used
polymophisme on the page and page translation. Becouse of the
inheritance, I have created an abstract model for Page and
PageTranslation where other objects can inherit from. As an example
object, I'll use a new object StaticPage. This is what I have so far:

class Page < ActiveRecord::Base
  has_many :page_translations
  belongs_to :content, :polymorphic => true
  belongs_to :parent, :class_name => 'Page'
  has_many :children, :class_name => 'Page', :foreign_key => 'parent_id'
end

class PageTranslation < ActiveRecord::Base
  belongs_to :page
  belongs_to :content_translation, :polymorphic => true
end

class PageModel < ActiveRecord::Base

  self.abstract_class = true

  has_one :page, :as => :content, :dependent => :destroy

  validates_presence_of :page
  validates_associated :page

  after_save :save_page

  translates :locale, :slug, :keywords, :description, :title, :content

  Page.column_names.each do |attribute|
if attribute != "id"
  define_method "#{attribute}=".to_sym do |value|
init_page
self.page["#{attribute}"] = value
  end

  define_method "#{attribute}".to_sym do
self.page[attribute] if self.page
  end
end
  end

  def children
self.page.children if self.page
  end

  private

  def init_page
self.page = Page.new unless self.page
  end

  def save_page
self.page.save(false)
  end
end

class PageTranslationModel < ActiveRecord::Base
  self.abstract_class = true

  has_one :page_translation, :as => :content_translation, :dependent =>
:destroy

  validates_presence_of :page_translation
  validates_associated :page_translation

  after_save :save_page_translation

  PageTranslation.column_names.each do |attribute|
if attribute != "id"
  define_method "#{attribute}=".to_sym do |value|
init_page_translation
self.page_translation["#{attribute}"] = value
  end

  define_method "#{attribute}".to_sym do
self.page_translation[attribute] if self.page_translation
  end
end
  end



  private

  def init_page_translation
self.page_translation = PageTranslation.new unless
self.page_translation
  end

  def save_page_translation
self.page_translation.save(false)
  end
end

class StaticPage < PageModel
end

class StaticPageTranslation < PageTranslationModel
end


For testing, I've created a simple form like this:

<% form_for(@static_page, :url => static_pages_path , :html => { :id =>
"static-page-form" }) do |f| %>


<% end %>

This test works like a charm. The static page gets saved and the content
get synchronized with the page table. So that part works.

The part I can't get to work, is the part with the translations.
I have used the model translation plugin on a simpler test case and got
it to work by adding the following to a model:
  has_many :test_translations
  after_update :save_translations

  def new_translation_attributes=(translation_attributes)
translation_attributes.each do |attributes|
  test_translations.build(attributes)
end
  end

  def existing_translation_attributes=(translation_attributes)
test_translations.reject(&:new_record?).each do |translation|
  attributes = translation_attributes[translation.id.to_s]
  if attributes
test_translation.attributes = attributes
  else
test_translations.destroy(translation)
  end
end
  end

  def save_translations
test_translations.each do |translation|
  translation.save(false)
end
  end
And have my form fields like this:



But I don't seem to be able to implement this pattern in my abstract
PageModel.
It would be great if someone could help me out with this one, becouse I
don't think I would be able to solve this without any help.

Thank you in advance
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Domain status in Rails

2009-10-19 Thread Frederick Cheung



On Oct 19, 7:35 pm, jhaagmans  wrote:
> I'm not behind it right now, but would the following work?
>
> require 'net/http'
>
> url = URI.parse(params[:url])
> http = Net::HTTP.new(url.host, url.port)
> response = http.send_request('GET', '/')
> puts response.body
>

well it would check you can make a request to that domain (assuming no
dns tomfoolery), obviously doesn't check if there is any thing valid
at that url

Fred
> Thank you.
>
> On 19 okt, 20:18, Frederick Cheung  wrote:
>
>
>
> > On Oct 19, 6:59 pm, jhaagmans  wrote:> Hi,
>
> > > For an app I need users to put in the domain name their website is
> > > hosted on. It's important that this domain works, so I'd like my app
> > > to check this. I'd like to be able to process the response. If it
> > > returns a 404 error or maybe even a 500 error I'd like it to have the
> > > method return true, but also a message saying there's something the
> > > user needs to look into at their end. If the domain is unavailable (so
> > > there is no record in the zonefile) I'd like the method to return
> > > false and return an error message saying the domain is invalid. Of
> > > course, if it passes with a 200 message, I'd like it to return true
> > > and a success message.
>
> > > Is this possible and how?
>
> > Well you could use the ruby name resolving classes or make an http
> > request with Net::HTTP (although beware of DNS servers that lie when
> > the domain doesn't exist)
>
> > Fred
>
> > > Thank you very much!
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: find, using a link instead of a form

2009-10-19 Thread Hassan Schroeder

On Mon, Oct 19, 2009 at 10:12 AM, SNelson  wrote:

> I would like the user interface to have a link (something like
> "Pending Assignments") which, when clicked, would find and display all
> assignments for which starts_at is empty. Or starts_at.year, or
> starts_at.day or whatever.

Uh, why not just create an appropriate controller method, something
like  'pending', and use that as the link, e.g. '/assignments/pending' ?

FWIW,
-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

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

2009-10-19 Thread jhaagmans

I'm not behind it right now, but would the following work?

require 'net/http'

url = URI.parse(params[:url])
http = Net::HTTP.new(url.host, url.port)
response = http.send_request('GET', '/')
puts response.body

Thank you.


On 19 okt, 20:18, Frederick Cheung  wrote:
> On Oct 19, 6:59 pm, jhaagmans  wrote:> Hi,
>
> > For an app I need users to put in the domain name their website is
> > hosted on. It's important that this domain works, so I'd like my app
> > to check this. I'd like to be able to process the response. If it
> > returns a 404 error or maybe even a 500 error I'd like it to have the
> > method return true, but also a message saying there's something the
> > user needs to look into at their end. If the domain is unavailable (so
> > there is no record in the zonefile) I'd like the method to return
> > false and return an error message saying the domain is invalid. Of
> > course, if it passes with a 200 message, I'd like it to return true
> > and a success message.
>
> > Is this possible and how?
>
> Well you could use the ruby name resolving classes or make an http
> request with Net::HTTP (although beware of DNS servers that lie when
> the domain doesn't exist)
>
> Fred
>
> > Thank you very much!
>
>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 namespaced controllers

2009-10-19 Thread Conrad Taylor
On Mon, Oct 19, 2009 at 11:27 AM, Conrad Taylor  wrote:

> On Mon, Oct 19, 2009 at 11:16 AM, Sergio Aristizabal <
> rails-mailing-l...@andreas-s.net> wrote:
>
>>
>> Hi,
>>
>> I have one controller in the /app/controllers/animals_controller.rb
>> directory, and another in
>> /app/controllers/production/services_controller.rb. The thing is that
>> one Animal has many Services, and i'd like to access to them using
>> something like:
>>
>> http://localhost:3000/animals/1/production/services/1
>>
>> or at least with:
>>
>> http://localhost:3000/animals/1/services/1
>>
>> I tried the last one adding in routes.rb:
>>
>> map.resources :animals, :has_many => :services
>>
>> but it throws me an error: uninitialized constant ServicesController
>>
>> any idea?
>>
>> Thanks.
>>
>
> Your ServicesController is in a non-standard location.  Thus, what's the
> reasoning for having ServicesController within the production directory?
> In any case, you should be able to do the following:
>
> config.load_paths += %W( #{RAILS_ROOT}/app/controllers/production )
>

BTW, the above line goes into your environment.rb file within the
Rails::Initializer
block.

-Conrad


>
> The above adds the production directory to your load path.
>
> Good luck,
>
> -Conrad
>
>
>> --
>> 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 namespaced controllers

2009-10-19 Thread Conrad Taylor
On Mon, Oct 19, 2009 at 11:16 AM, Sergio Aristizabal <
rails-mailing-l...@andreas-s.net> wrote:

>
> Hi,
>
> I have one controller in the /app/controllers/animals_controller.rb
> directory, and another in
> /app/controllers/production/services_controller.rb. The thing is that
> one Animal has many Services, and i'd like to access to them using
> something like:
>
> http://localhost:3000/animals/1/production/services/1
>
> or at least with:
>
> http://localhost:3000/animals/1/services/1
>
> I tried the last one adding in routes.rb:
>
> map.resources :animals, :has_many => :services
>
> but it throws me an error: uninitialized constant ServicesController
>
> any idea?
>
> Thanks.
>

Your ServicesController is in a non-standard location.  Thus, what's the
reasoning for having ServicesController within the production directory?
In any case, you should be able to do the following:

config.load_paths += %W( #{RAILS_ROOT}/app/controllers/production )

The above adds the production directory to your load path.

Good luck,

-Conrad


> --
> 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] problems with calling javascript containing dynamic content in partial page

2009-10-19 Thread Lu Liu

Hi all,

I am trying to call some javascript function defined in partial page
"_results.html.erb". But it seemed that the js functions in the page
are unrecognizable, and I have no idea why.

In my app, I have an "index" action/view containing an form_remote_tag
sending the ajax request to a "process" action. After some calculation
in the "process" action, it passes a local variable to a result page
and renders it partially. Briefly, the index.html.erb looks like:

# index.html.erb
<% form_remote_tag :url => 'process',
  :id => 'inputs',
  :update => {:success => 'result_div', :failure =>
'document.write(request.responseText)'} do -%>
  # some input tags here
  <%= submit_tag "calculate" %>
<% end -%>


In controller#index, there is nothing. In controller#process, there is
the calculation code which will cost several seconds, after that it is
the render method:

def process
  # calculation code which will generate a result - @ruby_result -
which is an ruby object
  render :partial => 'results', :locals => {:ruby_result =>
@ruby_result}
end

And in _results.html.erb:

show result

  function showResult()
  {
 // code to show the result somewhere else on the index page
 // BUT I MUST use the <%=ruby_result%> variable here
  }


The update of the result_div is totally ok, but when I click on the
"show result", nothing happened. I tried putting the showResult()
function in the index.html.erb. Then it can be found by the
_results.html.erb. However the problem is that the ruby_result can
only be got after the process. As a result, it's not accessible in the
index view when it is initially loaded. How should I solve this
problem?

I am not sure if I have expressed my question clearly. Any reply or
comment is welcome.

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: Domain status in Rails

2009-10-19 Thread Frederick Cheung



On Oct 19, 6:59 pm, jhaagmans  wrote:
> Hi,
>
> For an app I need users to put in the domain name their website is
> hosted on. It's important that this domain works, so I'd like my app
> to check this. I'd like to be able to process the response. If it
> returns a 404 error or maybe even a 500 error I'd like it to have the
> method return true, but also a message saying there's something the
> user needs to look into at their end. If the domain is unavailable (so
> there is no record in the zonefile) I'd like the method to return
> false and return an error message saying the domain is invalid. Of
> course, if it passes with a 200 message, I'd like it to return true
> and a success message.
>
> Is this possible and how?
>
Well you could use the ruby name resolving classes or make an http
request with Net::HTTP (although beware of DNS servers that lie when
the domain doesn't exist)

Fred


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

2009-10-19 Thread Conrad Taylor
On Mon, Oct 19, 2009 at 10:51 AM, Aaron Broad  wrote:

>
> The argument for the gem is that any improvements in security/bug
> fixes will be automatically included in your application if you
> continue to update your gems.  The argument for the plugin is any
> changes in the gem won't break your code that was already working if
> you don't update your plugin.
>
>
This isn't 100% true because I can call-out the version to use within my
environment.rb file.  For example,

config.gem "sqlite3-ruby", :lib => "sqlite3", :version => "1.2.5"

Now, I can 'gem update' without causing issues for my application.  The
bundler gem will replace the above in Rails 3.  For now, this has worked
great in development and production.

-Conrad


> I would use the updating gem in development.  And a frozen plugin in
> deployed app.
>
> On Oct 18, 1:43 pm, Hassan Schroeder 
> wrote:
> > Trying out Authlogic for the first time -- somewhere, can't find it now
> > of course :-) I saw a recommendation to use the plugin form, but the
> > Ryan Bates railscast recommends the gem (without explanation).
> >
> > Comments or recommendations?
> >
> > TIA,
> > --
> > Hassan Schroeder  hassan.schroe...@gmail.com
> > twitter: @hassan
> >
>

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

2009-10-19 Thread Sergio Aristizabal

Hi,

I have one controller in the /app/controllers/animals_controller.rb
directory, and another in
/app/controllers/production/services_controller.rb. The thing is that
one Animal has many Services, and i'd like to access to them using
something like:

http://localhost:3000/animals/1/production/services/1

or at least with:

http://localhost:3000/animals/1/services/1

I tried the last one adding in routes.rb:

map.resources :animals, :has_many => :services

but it throws me an error: uninitialized constant ServicesController

any idea?

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

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



[Rails] Re: Authlogic -- gem or plugin?

2009-10-19 Thread sax

I've had projects break before when I've updated plugins (my own and
others'). It's a little more clear what version of a gem you have
installed versus a plugin, which may or may not be the most recent
revision.

On Oct 19, 10:54 am, Robert Walker 
wrote:
> Hassan Schroeder wrote:
> > Trying out Authlogic for the first time -- somewhere, can't find it now
> > of course :-) I saw a recommendation to use the plugin form, but the
> > Ryan Bates railscast recommends the gem (without explanation).
>
> > Comments or recommendations?
>
> I believe that Ryan tends to prefer using gem dependencies instead of
> plugins when possible. This is also my own preference. I would guess
> that there is no further explanation provided because it seems to depend
> upon personal preference.
>
> I tend to prefer managing shared libraries outside of my application. I
> feel it eases management of shared libraries and makes upgrading my
> applications to use the newer version easier. Plus it also reduces the
> amount of code that lives inside my project (and hence my version
> control system). I don't really see the necessity to version control
> shared library code.
>
> It is also my understanding that Rails 3 will contain some improvements
> to the way gem dependencies are currently handled.
> --
> 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: Rails Concurrent Requests

2009-10-19 Thread German

Ok Robert, you are right.

So, if I have calls to native C libraries, my threads will be locked
there. So the only way to have concurrency there is with more than one
application?

On Oct 19, 2:35 pm, Robert Walker 
wrote:
> German wrote:
> > On the other hand, Clustering or pooling are solutions for Reliability
> > not for performance.
>
> I disagree. Clustering is primarily for scalability not reliability
> (although provides that as well). Performance actually provides little
> in terms of scalability. Increasing performance has limited usefulness
> in the ability of an application to scale. Clustering can provide
> theoretically unlimited scaleability.
>
> > Clustering does not give better performance, in
> > fact, most of the times gives you less performance one of the reasons
> > is the load balancer.
>
> While there may be some small overhead introduced by the load balancer
> it certainly does not offset the scalability advantages they provide. If
> you add just one additional instance of the application though a load
> balancer, it would have to slow the requests down by one half to loose
> overall scaleability. I'm sure that they do not introduce that level of
> overhead. The overhead is more likely negligible.
> --
> 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] Domain status in Rails

2009-10-19 Thread jhaagmans

Hi,

For an app I need users to put in the domain name their website is
hosted on. It's important that this domain works, so I'd like my app
to check this. I'd like to be able to process the response. If it
returns a 404 error or maybe even a 500 error I'd like it to have the
method return true, but also a message saying there's something the
user needs to look into at their end. If the domain is unavailable (so
there is no record in the zonefile) I'd like the method to return
false and return an error message saying the domain is invalid. Of
course, if it passes with a 200 message, I'd like it to return true
and a success message.

Is this possible and how?

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

2009-10-19 Thread Robert Walker

Hassan Schroeder wrote:
> Trying out Authlogic for the first time -- somewhere, can't find it now
> of course :-) I saw a recommendation to use the plugin form, but the
> Ryan Bates railscast recommends the gem (without explanation).
> 
> Comments or recommendations?

I believe that Ryan tends to prefer using gem dependencies instead of 
plugins when possible. This is also my own preference. I would guess 
that there is no further explanation provided because it seems to depend 
upon personal preference.

I tend to prefer managing shared libraries outside of my application. I 
feel it eases management of shared libraries and makes upgrading my 
applications to use the newer version easier. Plus it also reduces the 
amount of code that lives inside my project (and hence my version 
control system). I don't really see the necessity to version control 
shared library code.

It is also my understanding that Rails 3 will contain some improvements 
to the way gem dependencies are currently handled.
-- 
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: Authlogic -- gem or plugin?

2009-10-19 Thread Aaron Broad

The argument for the gem is that any improvements in security/bug
fixes will be automatically included in your application if you
continue to update your gems.  The argument for the plugin is any
changes in the gem won't break your code that was already working if
you don't update your plugin.

I would use the updating gem in development.  And a frozen plugin in
deployed app.

On Oct 18, 1:43 pm, Hassan Schroeder 
wrote:
> Trying out Authlogic for the first time -- somewhere, can't find it now
> of course :-) I saw a recommendation to use the plugin form, but the
> Ryan Bates railscast recommends the gem (without explanation).
>
> Comments or recommendations?
>
> TIA,
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> twitter: @hassan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Authlogic -- gem or plugin?

2009-10-19 Thread Freddy Andersen

I'm using the gem without issues...

If you use the GEM you will get a gem version installed so that you
can stay consistent between environments (dev, test, pre-prod,
prod... )

Iif you want the latest and greatest you need to use the plugin..
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Authlogic -- gem or plugin?

2009-10-19 Thread Philip Hallstrom

> Trying out Authlogic for the first time -- somewhere, can't find it  
> now
> of course :-) I saw a recommendation to use the plugin form, but the
> Ryan Bates railscast recommends the gem (without explanation).

I'm using it as a plugin and it's working fine for 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: sybase in rails2?

2009-10-19 Thread Aldric Giacomoni

Jonathan Rochkind wrote:
> My new plan (not really related to this thread, but perhaps useful for 
> someone thinking about these things) is to write a web service in Java 
> (there is already plenty of java code to talk to this db) that provides 
> just the information needed by my ruby app (not actually the entirety of 
> the database, not even close, just a few pieces of info, almost entirely 
> read-only, for a few specific use cases) -- and just have the ruby app 
> consume the web service instead.

Good luck! Sorry you spent so much time on this. Maybe I -will- try to 
develop some kind of gem for this, but don't hold me to it.. It's low on 
my list of priorities, and I don't have the skills required to just put 
it all together.
-- 
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: Associations are not found with STI using Rails 2.3

2009-10-19 Thread Matt Jones



On Oct 18, 3:03 pm, Shahzad Bhatti 
wrote:
> I have recently upgraded my Rails app to 2.3. I am using STI where I
> have class called BaseProfile that is extended by IndividualProfile. I
> have some assocations that are defined in BaseProfile but I have been
> getting errors when views reference those relationships, e.g.
>
> undefined method `primary_user?' for #
> RAILS_ROOT: /home2/plexobje/rails/linktank
[snip]
> The primary_user? is defined in parent class. This code used to work
> with older version of Rails. Is there a fix for this?
> Thanks.

You weren't kidding about the "older version" part, were you? :) That
method was deprecated back in 0.9.5(!!) (January 2005) and went away
several versions later. Even the deprecation warning is gone now.

The now-long-gone deprecation message recommended that you use ==
instead; you'll need to check if you were passing the second argument
(force_reload) or not.

--Matt Jones


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



[Rails] find, using a link instead of a form

2009-10-19 Thread SNelson

Hello;
Here's the latest puzzle stumping me. Seems it should be simple but
I'm feeling like a moron. I would like to have a link that, when
clicked, returns the results of a pre-set find.

Here's the deal. I'm working on a contact management and scheduling
app for the photo studio I work for. I want our staff to be able to
create assignments (think of them as events). Most of the time when an
assignment is booked, a date and time are established. But sometimes
the date isn't certain. Other times we find that an assignment needs
to be rescheduled but the client doesn't yet know when.

In either of those cases, the database column "starts_at" (of type
datetime) will be empty.

I would like the user interface to have a link (something like
"Pending Assignments") which, when clicked, would find and display all
assignments for which starts_at is empty. Or starts_at.year, or
starts_at.day or whatever.

I want this to be a link rather than a form input because the find
criteria is always going to be the same.

I installed the Searchlogic gem but can't come up with how to get it
to do what I want.

I have an index action in the assignments_controller that basically
does an @assignments = Assignment.find(:all). Can I leverage that so
that it returns a select set if there is some criteria and all
Assignments if not? I guess the "some criteria" part is what eludes
me.

Thanks for any suggestions and pointers.

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

2009-10-19 Thread Jonathan Rochkind

Aldric Giacomoni wrote:

> You would most likely want to transfer all the data to a mySQL or 
> PostgreSQL database (possibly renaming the id fields to railsify the 
> whole thing) and then not touch the Sybase DB again.
> 
> Maybe get a Windows box or VM, just long enough to do what you want 
> (30-day trial for Windows) ?

Nice idea, but this is a legacy enterprise database used by other 
software, not so easy to abandon it.

My new plan (not really related to this thread, but perhaps useful for 
someone thinking about these things) is to write a web service in Java 
(there is already plenty of java code to talk to this db) that provides 
just the information needed by my ruby app (not actually the entirety of 
the database, not even close, just a few pieces of info, almost entirely 
read-only, for a few specific use cases) -- and just have the ruby app 
consume the web service instead.
-- 
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: sybase in rails2?

2009-10-19 Thread Aldric Giacomoni

Jonathan Rochkind wrote:
> Aldric Giacomoni wrote:
> 
>> Did you see how my original tutorial involves editing an SQL.ini file ? 
>> Can you try that?
> 
> Thanks, I believe that is indeed the key, and would work. But the 
> complexity of getting this working (Two different compiled packages, 
> confusing configuration, needing to configure connections outside of the 
> ruby app itself, etc) is making me re-think my whole approach to 
> accessing my legacy Sybase database.
> 
> Jonathan

You would most likely want to transfer all the data to a mySQL or 
PostgreSQL database (possibly renaming the id fields to railsify the 
whole thing) and then not touch the Sybase DB again.

Maybe get a Windows box or VM, just long enough to do what you want 
(30-day trial for Windows) ?
-- 
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: Using Initializers

2009-10-19 Thread Freddy Andersen

I have another example that I have used for a while...

/config/settings.yml
all: &all_environment_settings
  constant_for_all: somethinf

development: &non_production_settings
<<: *all_environment_settings
something_different_for_dev: dev stuff

Then you can load this file in a initializer:

/initializers/settings.rb
SETTINGS = YAML.load_file("#{RAILS_ROOT}/config/settings.yml")
[RAILS_ENV].symbolize_keys

Now you can call this through SETTINGS[:constant_for_all]

Both methods will work but if you have requirements for the constants
to change between environments then this would be better...
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails Concurrent Requests

2009-10-19 Thread Robert Walker

German wrote:
> On the other hand, Clustering or pooling are solutions for Reliability
> not for performance. 

I disagree. Clustering is primarily for scalability not reliability 
(although provides that as well). Performance actually provides little 
in terms of scalability. Increasing performance has limited usefulness 
in the ability of an application to scale. Clustering can provide 
theoretically unlimited scaleability.

> Clustering does not give better performance, in
> fact, most of the times gives you less performance one of the reasons
> is the load balancer.

While there may be some small overhead introduced by the load balancer 
it certainly does not offset the scalability advantages they provide. If 
you add just one additional instance of the application though a load 
balancer, it would have to slow the requests down by one half to loose 
overall scaleability. I'm sure that they do not introduce that level of 
overhead. The overhead is more likely negligible.
-- 
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: Calling a Oracle procedure inside ROR

2009-10-19 Thread Rafael Roque

anyone??

-- 
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: SQL query viewer plugin

2009-10-19 Thread Matt Jones

What you're describing sounds a lot like the Rails Footnotes plugin:

http://github.com/josevalim/rails-footnotes

May want to give that a try.

--Matt Jones

On Oct 18, 4:53 pm, Leonardo Mateo  wrote:
> Hello guys,
> I've used a plugin, a while ago, that shows on a absolute positioned
> div, links to the queries that were executed on that page, identifying
> by colors how much time they took.
> It was great for profiling, and now I can't remember the name, nor I
> can find any bookmark to the plugin's site.
>
> Does any one knows the plugin or uses something like that?
>
> Thanx a lot in advance.
>
> --
> Leonardo Mateo.
> There's no place like ~
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: sybase in rails2?

2009-10-19 Thread Jonathan Rochkind

Aldric Giacomoni wrote:

> Did you see how my original tutorial involves editing an SQL.ini file ? 
> Can you try that?

Thanks, I believe that is indeed the key, and would work. But the 
complexity of getting this working (Two different compiled packages, 
confusing configuration, needing to configure connections outside of the 
ruby app itself, etc) is making me re-think my whole approach to 
accessing my legacy Sybase database.

Jonathan
-- 
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: Using Initializers

2009-10-19 Thread doug

Interesting.  The procedure that you describe is much different than
what I expected.  So, I guess that I'm not surprised that what I did
failed to work.  Thanks.  I'll give it a try.

  ... doug

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

2009-10-19 Thread bill walton

Hello Jae Lee;

On Mon, 2009-10-19 at 16:54 +0200, Jae Lee wrote:
> Which way is mostly recommended?

I use submit_tag instead of f.submit when I want easy access to the
options provided by submit_tag.  The :confirm option is handy on
'Cancel', for example.

HTH,
Bill


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



[Rails] Calling a Oracle procedure inside ROR

2009-10-19 Thread Rafael Roque

Hi all,auppose I have the following procedure:
CREATE OR REPLACE Procedure Calc_All_Diarias(Pviagem In Number,
  Pcompl  In Varchar2)
I´m trying to call it this way:
 x = ActiveRecord::Base.connection.execute( "exec calc_all_diarias
(5107,0);")

If I put the statement directly into the PL/SQL Developer it runs just
fine,but in ROR I´m receiving a "Invalid SQL Statement"error.What am I
doing wrong?

Thanks,
Rafael Roque
-- 
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: [ANN] WiceGrid Plugin version 0.5

2009-10-19 Thread Gianluca Tessarolo
Wonderful Yuri,

keep up the good work !!!
>
> On Oct 19, 3:17 pm, Gianluca Tessarolo
>  wrote:
>   
>> Many thanks Yuri, I see the examples and they are very impressive !!!
>> 
>
> Thanks Gianluca!
>
>
>   
>> Congratulations !!!
>>
>> I have only a little question: why using prototype ? I think the most
>> rails projects are using jquery...
>> 
>
> As you can guess, it's because the projects out of which WiceGrid was
> extracted were
> Prototype based :), but you are right, I see no point why it cannot be
> done.
> Support for both jQuery and Prototype is planned for the next version
> 0.6,
> so bear with me :)
>
>
>   
>> Do you think is it possible to have a unique parameterized plugin
>> working with both prototype & jquery js library ?
>> 
>
> Absolutely.
>
> Best regards,
> Yuri Leikind
>
>   
>>
>> 
>>> Hello all,
>>>   
>>> WiceGrid plugin version 0.5 is released.
>>>   
>>> WiceGrid is a Rails grid plugin.
>>>   
>>> A list of changes:http://leikind.org/2009/10/18/wicegrid-version-0-5
>>> Examples online:http://grid.leikind.org/
>>> Homepage:http://leikind.org/pages/wicegrid
>>> Source code:http://github.com/leikind/wice_grid/tree/v0.5
>>>   
>>> Best regards,
>>> Yuri Leikind
>>>   
>
> Best regards,
> Yuri Leikind
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Problem with deployment of rails application using passenger and apache (Very Important)

2009-10-19 Thread Sulabh Jain

Yes I have set the two appropriate configuration lines in apache. I
was wondering if I need to enable any specific apache module for this.


On Oct 18, 4:33 pm, Leonardo Mateo  wrote:
> On Fri, Oct 16, 2009 at 10:00 PM, Sulabh Jain  wrote:
>
> > Hello All,
>
> > I have been facing a weird problem since long and sometimes the things
> > worked for me on one or the other server.
>
> > Again, I have build a new server and facing same problem. Could anyone
> > help me in finding the cause??
>
> > I have passenger modules loaded inside apache conf file and
> > DocumentRoot set to point to public directory.
>
> Have you also set the
>
> PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-2.x.x
> PassengerRuby /usr/bin/ruby
>
> sentences on Apachce conf?
> --
> Leonardo Mateo.
> There's no place like ~
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 + has_many + STI + :only

2009-10-19 Thread MartOn

Hello

I have product model that has a given workflow (given by
state_machine). Then I have 2-3 versions of product that have a
slightly different workflow. Since state_machine has a elegant way of
handling class inheritance (compared to aasm), I have 2-3 models that
inherit from Product. (ProductOne, ProductTwo, etc). The Product model
has_many transisions. this is a hm relationship that basically handles
all transisions/events RESTfully. I also get transision logging by
having this transision model.

My question is how this is implemented as DRY as possible in
routes.rb. this is how my routes.rb looks like today:

map.resources :products do |product|
  product.resources :transisions, :only => [ :index, :new, :create ]
end
map.resources :product_one, :as  => 'products', :controller =>
'products' do |product|
  product.resources :transisions, :only => [ :index, :new, :create ]
end
map.resources :product_two, :as  => 'products', :controller =>
'products' do |product|
  product.resources :transisions, :only => [ :index, :new, :create ]
end
map.resources :product_three, :as  => 'products', :controller =>
'products' do |product|
  product.resources :transisions, :only => [ :index, :new, :create ]
end

Is there a more elegant way to handle this. goal is to have only
"products" routes. I do not want separate routes for each variant of
product.

I tried this but it did not work :-):
map.resources :products, :has_many => [ :transisions => { :only =>
[:index, :new, :create] } ]

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



[Rails] Re: Rails Concurrent Requests

2009-10-19 Thread German

On the other hand, Clustering or pooling are solutions for Reliability
not for performance. Clustering does not give better performance, in
fact, most of the times gives you less performance one of the reasons
is the load balancer. It's true that every application has a limit of
request to handle, all the servers have that limit, and there is where
you need to do a pool or a cluster to "solve" the problem, but if my
limit is "one request", i should think i have another problem..

On Oct 19, 12:24 pm, German  wrote:
> Thanks, I have a passenger environment, with a pool of app's.. but
> this schema is eating my server.. what if i have 10.000 rq per
> second.. the solution is JRuby?
>
> On Oct 19, 11:29 am, Marnen Laibow-Koser 
>
>
> s.net> wrote:
> > German wrote:
> > > Is there a solution, for this issue?... i'm using postgres db. As far
> > > as i understand what you say, every access to a native library, will
> > > be locked and only one thread at a time will access.
>
> > Yes: use one of the pooled solutions like Passenger.  I know you may
> > think it silly, but at the moment, it's the best way if you're not using
> > JRuby.
>
> > > On Oct 18, 8:06 pm, Frederick Cheung 
>
> > 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] Re: [ANN] WiceGrid Plugin version 0.5

2009-10-19 Thread Yuri Leikind



On Oct 19, 3:17 pm, Gianluca Tessarolo
 wrote:
> Many thanks Yuri, I see the examples and they are very impressive !!!

Thanks Gianluca!


> Congratulations !!!
>
> I have only a little question: why using prototype ? I think the most
> rails projects are using jquery...

As you can guess, it's because the projects out of which WiceGrid was
extracted were
Prototype based :), but you are right, I see no point why it cannot be
done.
Support for both jQuery and Prototype is planned for the next version
0.6,
so bear with me :)


> Do you think is it possible to have a unique parameterized plugin
> working with both prototype & jquery js library ?

Absolutely.

Best regards,
Yuri Leikind

>
>
>
> > Hello all,
>
> > WiceGrid plugin version 0.5 is released.
>
> > WiceGrid is a Rails grid plugin.
>
> > A list of changes:http://leikind.org/2009/10/18/wicegrid-version-0-5
> > Examples online:http://grid.leikind.org/
> > Homepage:http://leikind.org/pages/wicegrid
> > Source code:http://github.com/leikind/wice_grid/tree/v0.5
>
> > Best regards,
> > Yuri Leikind

Best regards,
Yuri Leikind

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



[Rails] submit_tag or f.submit

2009-10-19 Thread Jae Lee

Hello all,

I am pretty much new here, trying to move to RoR from .net world.
I will appreciate if anyone clarifies this for me.

Most of books use "submit_tag" in new or edit views, but I see Rails API
web documents use "f.submit" instead.  I also see Agile Web Development
using RoR 3rd Edition use the same "f.submit" instead of "submit_tag."

Which way is mostly recommended?
I am using the latest version of rails, and I am still get confused how
Rails know if the post is "Create" or "Update" with this one single
"submit_tag."

I will appreciate it for your help in advance.

- risknet -
-- 
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: [ANN] WiceGrid Plugin version 0.5

2009-10-19 Thread Yuri Leikind

On Oct 19, 3:20 pm, bill walton  wrote:
> On Sun, 2009-10-18 at 12:01 -0700, Yuri Leikind wrote:
> > Hello all,
>
> > WiceGrid plugin version 0.5 is released.
>
> > WiceGrid is a Rails grid plugin.
>
> > A list of changes:http://leikind.org/2009/10/18/wicegrid-version-0-5
> > Examples online:http://grid.leikind.org/
> > Homepage:http://leikind.org/pages/wicegrid
> > Source code:http://github.com/leikind/wice_grid/tree/v0.5
>
> > Best regards,
> > Yuri Leikind
>
> This looks very nice.  The documentation and examples are as impressive
> as the demonstrated functionality.  Very well done!  

Thanks!

> If I understand correctly, I can put more than just a single attribute
> value in a column.  For example, assuming I have separate columns in the
> database for customer name, address, and phone number, I can put all of
> them in one display column.  Yes?

Yes

>
> Is it possible to do that AND to still have the ability to sort the grid
> based on that column?  

On just one column, yes.

What you have inside the column block technically doesn't have to do
anything with how you filter/order, etc, so you can
have the following:

g.column :attribute_name => 'firstname' do |person|
  person.firstname + '  '  + person.lastname + '  ' + person.telephone
end


> Is it possible to specify one of the elements I
> put in a column as the one to use for sorting?  So that I could put
> name, address, and phone in the column, but sort/filter on name only?

Yes. In the column clause you define the column you want to filter by,
and then you redefine which column you want to use for ordering using
:custom_order. see the example at http://grid.leikind.org/custom_ordering2,
controller code, or here http://grid.leikind.org/custom_filters2 .
Basically,
the key of the hash is the database column defined in your column
clause,
and the value is any other column you want to use for ordering, or any
valid sql expression (see here http://grid.leikind.org/custom_ordering,
controller code)

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

2009-10-19 Thread Frederick Cheung

On Oct 19, 3:17 pm, Avik  wrote:
>
> According to the code for 2.2.2 (and also the current version), the
> token is not inherently "user-specific"; it may remain the same even
> when other session fields change. Thus, the app _must_ use
> reset_session when a different user logs in to force a different token
> to be computed. (In particular, just clearing out the relevant fields,
> e.g., session[:user_id], is not enough, since session[:_csrf_token] or
> session[:csrf_id] remains set.) Otherwise, we may get the following
> scenario, for example.
>

Ah, with you know - thought you were saying that two completely
unrelated sessions might end up with the same auth token.

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



[Rails] Re: HTML table visual effect

2009-10-19 Thread Hassan Schroeder

On Mon, Oct 19, 2009 at 6:26 AM, Eduardo Bueno
 wrote:

> I have an HTML table with several rows. I want to change the row color
> when the user clicks it. This is quite simple to do with plain
> javascript, but I want to use rails.

You realize this is a client-side interaction, which means Javascript
no matter how it's packaged?  :-)

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: We're sorry, but something went wrong on Tomcat

2009-10-19 Thread Hassan Schroeder

On Mon, Oct 19, 2009 at 2:06 AM, rtacconi  wrote:
>
> The problem is that form that server I cannot connect to the MSql
> server, so the error is, no DB connection. Ii there a way to test the
> DB connection of a Rails application?

Are you saying you can't connect manually from the command line?
Then there's no way Rails is going to be able to :-)

And "can't connect" because? bad password? username? firewall
issue?

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
twitter: @hassan

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



[Rails] Re: Rails Concurrent Requests

2009-10-19 Thread German

Thanks, I have a passenger environment, with a pool of app's.. but
this schema is eating my server.. what if i have 10.000 rq per
second.. the solution is JRuby?

On Oct 19, 11:29 am, Marnen Laibow-Koser  wrote:
> German wrote:
> > Is there a solution, for this issue?... i'm using postgres db. As far
> > as i understand what you say, every access to a native library, will
> > be locked and only one thread at a time will access.
>
> Yes: use one of the pooled solutions like Passenger.  I know you may
> think it silly, but at the moment, it's the best way if you're not using
> JRuby.
>
>
>
> > On Oct 18, 8:06 pm, Frederick Cheung 
>
> 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] Re: Security problems with CookieStore and CSRF protection

2009-10-19 Thread Avik

Hi Fred,

>
> > 2. The CSRF protection, at least in Rails 2.2.2, seems too weak. Rails
> > comes close to implementing a fix, by embedding and checking hidden
> > tokens (for POST requests). But it is well-known that for such a fix
> > to work, the tokens should be session-specific. Unfortunately, we
> > found that the implementation in 2.2.2 can return the same token even
> > if, e.g., session[:user] is different. This is bad, since an attacker
> > may not be an outsider: it can reasonably have an account with the
> > server, and if it gets back a token which it can then embed in forms
> > used by other, honest users, then it can execute CSRF attacks!
>
> That's seems odd - glancing at the code it would seem that in 2.2.2
> the secret is a digest of the session_id and a secret (for non cookie
> stores) and in the case of a cookie store a digest of a random
> identifier and a secret. How were you able to get it to return the
> same token for 2 different sessions ?

According to the code for 2.2.2 (and also the current version), the
token is not inherently "user-specific"; it may remain the same even
when other session fields change. Thus, the app _must_ use
reset_session when a different user logs in to force a different token
to be computed. (In particular, just clearing out the relevant fields,
e.g., session[:user_id], is not enough, since session[:_csrf_token] or
session[:csrf_id] remains set.) Otherwise, we may get the following
scenario, for example.

1. Attacker logs into a public computer, gets CSRF token from a page
returned by the server, includes a form with that token on a popular
website he controls, and leaves without logging out.

2. Honest user logs into the same computer (and say reset_session is
not used, so the token field in the session remains set and doesn't
change). He opens the popular site on the side, and accidentally
causes the malicious form to be sent.

I discussed this issue with Michael Koziarski; he claims, perhaps
rightly so, that this is ultimately a session fixation attack, and the
doc already advises use of reset_session in that case. True, but I
believe that the doc is inadequate in this case; clearly this attack
uses CSRF, and the fact that protection in this case requires
protect_from_forgery as well as reset_session is not clarified enough.

Best,
-Avik.


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

2009-10-19 Thread Srinath A.

Hi,
Thanks for reply.

The same xml template will generate every time, but only some parts are 
customized .

The main motto is the total generation will go behind the scenes and 
write to a new xml file each time .
I should be able write some ruby code , there some parts where i need to 
do looping.
so I am expecting Ruby + xml file .
what about REXML ??

thanks
sri

Marnen Laibow-Koser wrote:
> Srinath A. wrote:
>> Hi,
>> 
>> I am having a xml template containing 5000  lines of code .
>> Now i need to generate the template dynamically in ruby on rails .
>> My requirement is every time a user clicks on GO , a  new xml template
>> will generate for every user like  "username.xml".
>> I am not showing the xml template on screen , it will generate and
>> create on backend .
>> The template contains almost 3000 lines of code as static and only some
>> lines will be customized.
>> How should i start? Do i need to write by hand all lines using xml
>> builder or
>> is there any alternative ??
> 
> You don't have to use Builder for XML.  ERb and (in most cases) Haml 
> would work just as well.
> 
> But if 3000 lines are going to be static, perhaps you can somehow give 
> the user just the non-static part?
> 
>> 
>> 
>> 
>> thanks,
>> sri...
> 
> 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: Huge XML Template

2009-10-19 Thread Marnen Laibow-Koser

Srinath A. wrote:
> Hi,
> 
> I am having a xml template containing 5000  lines of code .
> Now i need to generate the template dynamically in ruby on rails .
> My requirement is every time a user clicks on GO , a  new xml template
> will generate for every user like  "username.xml".
> I am not showing the xml template on screen , it will generate and
> create on backend .
> The template contains almost 3000 lines of code as static and only some
> lines will be customized.
> How should i start? Do i need to write by hand all lines using xml
> builder or
> is there any alternative ??

You don't have to use Builder for XML.  ERb and (in most cases) Haml 
would work just as well.

But if 3000 lines are going to be static, perhaps you can somehow give 
the user just the non-static part?

> 
> 
> 
> thanks,
> sri...

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] Huge XML Template

2009-10-19 Thread Srinath A.

Hi,

I am having a xml template containing 5000  lines of code .
Now i need to generate the template dynamically in ruby on rails .
My requirement is every time a user clicks on GO , a  new xml template
will generate for every user like  "username.xml".
I am not showing the xml template on screen , it will generate and
create on backend .
The template contains almost 3000 lines of code as static and only some
lines will be customized.
How should i start? Do i need to write by hand all lines using xml
builder or
is there any alternative ??



thanks,
sri...
-- 
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: Linked associations question please help

2009-10-19 Thread theambler

Users have many stories through userstorylinks...

has_many :userstorylinks
  has_many :stories, :through=>:userstorylinks

Stories are even more associated...

has_many :userstorylinks, :dependent=>:destroy
  has_many :users, :through=>:userstorylinks
  has_many :storyitemlinks
  has_many :items, :through=>:storyitemlinks
  has_many :storycontactlinks
  has_many :contacts, :through=>:storycontactlinks
  has_many :storycompanylinks
  has_many :companies, :through=>:storycompanylinks

Does this screw up your suggestion?


On Oct 19, 10:58 am, Sijo k g 
wrote:
> Hi
>
>    Have you anywhere specified the  HABTM relation?It not supported I
> think. Please check your relations like
>
> user.rb
> user has_many stories
> user has_many items through stories
>
> story.rb
> belongs_to user
> has_many items
>
> item.rb
> belongs_to story
>
> Sijo
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: why do we needs act_as_state_machine?

2009-10-19 Thread Robert Walker

Zhenning Guan wrote:
> -
> if state == yellow
>   state = red
>   catch_runner
> end
> -
> instead of it.
> so why do we needs act_as_state_machine? a wrapper ? make thing simple?

You are actually illustrating the point to state machines. Yes, in this 
simple example you can implement them using a series of conditionals, 
but not every state machine is this simple. You could end up with a lot 
of conditionals and the code could end up being difficult to follow.

Good design is not always about producing the fewest number of lines. 
Sometimes a more verbose and descriptive code can improve 
maintainability.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Rails Concurrent Requests

2009-10-19 Thread Marnen Laibow-Koser

German wrote:
> Is there a solution, for this issue?... i'm using postgres db. As far
> as i understand what you say, every access to a native library, will
> be locked and only one thread at a time will access.

Yes: use one of the pooled solutions like Passenger.  I know you may 
think it silly, but at the moment, it's the best way if you're not using 
JRuby.

> 
> On Oct 18, 8:06�pm, Frederick Cheung 

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] HTML table visual effect

2009-10-19 Thread Eduardo Bueno

Hello,

I have an HTML table with several rows. I want to change the row color
when the user clicks it. This is quite simple to do with plain
javascript, but I want to use rails. Is there any helper or something
that performs this task for me?

Thanks for your time.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Can (should) each :user have his own table?

2009-10-19 Thread Marnen Laibow-Koser

AlwaysCharging wrote:
> I was reading this article a while back
> http://www.sitepoint.com/blogs/2008/06/06/did-rails-sink-twitter/
> and it got me thinking.  If I wanted to set up my app so that each
> user has his/her own table, how would I go about doing that?

You wouldn't.  It's a horrible idea, and whoever wrote the article 
doesn't appear to understand good database design.  There are other ways 
to achieve good performance.

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: [ANN] WiceGrid Plugin version 0.5

2009-10-19 Thread bill walton

On Sun, 2009-10-18 at 12:01 -0700, Yuri Leikind wrote:
> Hello all,
> 
> WiceGrid plugin version 0.5 is released.
> 
> WiceGrid is a Rails grid plugin.
> 
> A list of changes: http://leikind.org/2009/10/18/wicegrid-version-0-5
> Examples online: http://grid.leikind.org/
> Homepage: http://leikind.org/pages/wicegrid
> Source code: http://github.com/leikind/wice_grid/tree/v0.5
> 
> Best regards,
> Yuri Leikind

This looks very nice.  The documentation and examples are as impressive
as the demonstrated functionality.  Very well done!  Your timing is very
convenient for me too and I think I'll be giving it a try this week.

One thing I haven't been able to find in the documentation so far...  

If I understand correctly, I can put more than just a single attribute
value in a column.  For example, assuming I have separate columns in the
database for customer name, address, and phone number, I can put all of
them in one display column.  Yes?

Is it possible to do that AND to still have the ability to sort the grid
based on that column?  Is it possible to specify one of the elements I
put in a column as the one to use for sorting?  So that I could put
name, address, and phone in the column, but sort/filter on name only?

Thanks for your reply, and for your contribution!

Best regards,
Bill


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



[Rails] Re: [ANN] WiceGrid Plugin version 0.5

2009-10-19 Thread Gianluca Tessarolo

Many thanks Yuri, I see the examples and they are very impressive !!!

Congratulations !!!

I have only a little question: why using prototype ? I think the most 
rails projects are using jquery...

Do you think is it possible to have a unique parameterized plugin 
working with both prototype & jquery js library ?
> Hello all,
>
> WiceGrid plugin version 0.5 is released.
>
> WiceGrid is a Rails grid plugin.
>
> A list of changes: http://leikind.org/2009/10/18/wicegrid-version-0-5
> Examples online: http://grid.leikind.org/
> Homepage: http://leikind.org/pages/wicegrid
> Source code: http://github.com/leikind/wice_grid/tree/v0.5
>
> Best regards,
> Yuri Leikind
>
> >
>
>   


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 (should) each :user have his own table?

2009-10-19 Thread Frederick Cheung



On Oct 19, 10:38 am, AlwaysCharging  wrote:
> Thank you for the reply.
>
> I would, but that's exactly what that article was saying to steer
> clear of, and it makes sense.  If you have to keep querying the same
> table for everyone's new posts and post them back to your "feed" of
> the people that you follow, wouldn't that cause serious bottlenecks
> and lead to outages?  (which is exactly what I think is/was happening
> with twitter)
>

I think you misread the article - I don't think it is suggesting one
table per user.

it's saying

select * from tweet_queue where tweet_queue.user_id  = 123456 AND ...

rather than

select * from tweets
inner join followings on followings.followee = tweets.user_id
where followings.follower_id = 12456 AND ...


Fred

> And right now I'm just at the hypothetical stage as I'm still learning
> rails, so I don't have any constraints or requirements of what I'm
> trying to do.  I was just saying if my app was heavily intensive on
> user read/writes so that other users could follow other users,
> wouldn't it be best to give each their own table?
>
> On Oct 19, 4:53 am, Colin Law  wrote:
>
>
>
> > 2009/10/19 AlwaysCharging :
>
> > > I was reading this article a while back
> > >http://www.sitepoint.com/blogs/2008/06/06/did-rails-sink-twitter/
> > > and it got me thinking.  If I wanted to set up my app so that each
> > > user has his/her own table, how would I go about doing that?
>
> > > "create_table :users"  just creates a table in the database for a list
> > > of all the users (which I guess I'd want in addition to their
> > > individual tables), but is there a way to make it create an new table
> > > for each user?  Would this even be the best way if my app allowed
> > > "followers?"  Admittedly there'd be a ton of tables in my database,
> > > but wouldn't it make it easier for indexing all of your followers
> > > messages?
>
> > > Any insight is greatly appreciated.
>
> > Why not just put the information in the users table?  If you think
> > this is not an appropriate solution give more details of the
> > requirement so we can see what you are trying to do.
>
> > Colin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Rails Concurrent Requests

2009-10-19 Thread German

Is there a solution, for this issue?... i'm using postgres db. As far
as i understand what you say, every access to a native library, will
be locked and only one thread at a time will access.

On Oct 18, 8:06 pm, Frederick Cheung 
wrote:
> On Oct 18, 10:54 pm, German  wrote:
>
> > The problem is that my app, uses a lot of external partners..
> > connecting with web services, so a single request can take between 2
> > and 8 seconds.. imagine 100 people using my app :S...
> > Can you elaborate a bit about this "not multicore" issue? How one
> > thread can block the entire interpreter if i have the
> > config.threadsafe! on?
>
> Because MRI's threading isn't great - ruby threads don't map to native
> threads. Pure ruby code shouldn't block the entire interpreter but C
> stuff can (eg a mysql query). jruby is much better in this respect.
>
> Fred
>
>
>
>
>
> > On Oct 17, 8:53 pm, Frederick Cheung 
> > wrote:
>
> > > On Oct 17, 10:28 pm, German  wrote:
>
> > > > First of all, Thanks frederick fr the fast response!
>
> > > > I'll been tryint this, i found a BIG incrementation of the
> > > > performance. On the other hand, i can't beleibe how this is a feature
> > > > that I have to enable, and is not a default. What is the use of a web
> > > > application, that can't handle 2 request at the same time? IMO that is
> > > > useless.
>
> > > An awful lot of rails applications seem to get along just fine
> > > (especially as MRI's threading means that you don't take advantage of
> > > multiple cores, one thread can block the entire VM etc.)
>
> > > Fred
>
> > > > There are any concern about this?.. this feature is ready for
> > > > production?.. or it is experimental.
>
> > > > I've read in some places that you must be sure that your code is
> > > > thread safe, and that is obvious. Is there any other "problem" with
> > > > that feature?
>
> > > > Thanks
>
> > > > On Oct 17, 1:32 pm, Frederick Cheung 
> > > > wrote:
>
> > > > > On Oct 17, 3:20 pm, German  wrote:
>
> > > > > > It is true that a single Rails App instance can't handle more than 1
> > > > > > request at the same time?
>
> > > > > It used to be true, but as of 2.2.2 you can turn on thread safe mode.
> > > > > How much you benefit depends on what ruby interpreter you use what
> > > > > your app does etc.
>
> > > > > Fred
>
> > > > > > I've been looking to the passenger solution for this, and the 
> > > > > > mongrel
> > > > > > one, and others, but the solutions, are App pools, ans things like
> > > > > > that, but nobody explain this in a right way. I need a direct answer
> > > > > > to this question.
>
> > > > > > I know some workarounds, like clustering or pools, that's not what i
> > > > > > want right now.
>
> > > > > > 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: paperclip is not saving the files

2009-10-19 Thread Dhana Sekar
check it in your system folder in your rails root app , where you can find
your uploaded images

Dhana

On Mon, Oct 19, 2009 at 2:46 AM, petro_dev  wrote:

>
> For windows, make sure you close down the rails server and any command
> prompt instances and restart them. The imagemagick install path in
> program files (the folder containing identify.exe) needs to be
> accessible in the PATH variable. To check type echo %PATH% in the
> command prompt. If the imagemagick installation folder shows, the
> rails app should function.
>
> On Oct 10, 7:33 pm, about2flip  wrote:
> > I'm getting this error for windows setup does this solution work?
> > Going Gray trying to figure out why I am getting the error.
> >
> > THanks for your help.
> >
> > On Sep 4, 3:40 am, Rails List 
> > wrote:
> >
> >
> >
> > > Wasim Akram wrote:
> > > > I've installed image magick.
> > > > but it still shows the error message "/LOCALS~1/Temp/stream.3468.0 is
> > > >notrecognized
> > > > by the 'identify'command.".Is that i need to install it in the
> > > > project folder and give me some ways on how to compile it .or any
> > > > other gems avilable for this paperclip to work.
> > > > i'm in urgent need
> >
> > > > Plz help me in this regard...
> >
> > > Use this:
> >
> > > has_attached_file :image, :url => "/:attachment/:id_:style.:extension",
> > > :path => ":rails_root/public/:attachment/:id_:style.:extension",
> :styles
> > > => { :original => "500x500>" }
> >
> > > Let me know how it goes.  I have an working application that you can
> > > download fromhttp://www.classifiedscript.in
> >
> > > Cheers
> > > --
> > > 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 (should) each :user have his own table?

2009-10-19 Thread Anthony Metcalf

AlwaysCharging wrote:
> Thank you for the reply.
>
> I would, but that's exactly what that article was saying to steer
> clear of, and it makes sense.  If you have to keep querying the same
> table for everyone's new posts and post them back to your "feed" of
> the people that you follow, wouldn't that cause serious bottlenecks
> and lead to outages?  (which is exactly what I think is/was happening
> with twitter)
>
> And right now I'm just at the hypothetical stage as I'm still learning
> rails, so I don't have any constraints or requirements of what I'm
> trying to do.  I was just saying if my app was heavily intensive on
> user read/writes so that other users could follow other users,
> wouldn't it be best to give each their own table?
>
>   
One thing the article made clear was that the design of having a users
table makes sense in a *lot* of situations, just not all. The soution
they outline is very specific to twitter.

Alto bear this in mind, their system breaks down a little when you
decide to follow another user, you then have to find all (all of the
historical, just the last day? just the last 100? what?) their posts,
and insert them into your private post stream, which could get quite
intensive. Granted it doesn't happen as often as searching, or posting,
but it could have a big impact.

To answer your question though. You would probably have a users table,
and that would have a one to many relation to entries in a
_stream table. The logic that creates the user in the database
would first create the _stream table, and then create the
actual user. You would need a fair bit of reflection on the ruby side to
get that to work, as their wouldn't be anything in the DB to directly
connect the two tables.

Which sounds a bit fishy to me. Although I guess you could have
_stream as the table name, which is a little less ambiguous.

Anthony



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

2009-10-19 Thread InventoryTrackers

Yuri,
That's so cool you have an example page now!
If this works as well as your example page I think Rails has advanced
immeasurably and if we could find a reporting strategy, there'd be no
stopping us.
Huh Rah and many thanks!
David

On Oct 18, 1:01 pm, Yuri Leikind  wrote:
> Hello all,
>
> WiceGrid plugin version 0.5 is released.
>
> WiceGrid is a Rails grid plugin.
>
> A list of changes:http://leikind.org/2009/10/18/wicegrid-version-0-5
> Examples online:http://grid.leikind.org/
> Homepage:http://leikind.org/pages/wicegrid
> Source code:http://github.com/leikind/wice_grid/tree/v0.5
>
> Best regards,
> Yuri Leikind
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Odd behaviour of update_attributes in STI table

2009-10-19 Thread Max Williams

Frederick Cheung wrote:
> On Oct 19, 10:08�am, Max Williams 
> wrote:
>> I just noticed this odd behaviour (in rails 2.2.2). � It looks like
>> changing the type with update_attributes *doesn't* work (but returns
>> true!), but changing the field and then saving it *does* work. �Here i
>> have an STI situation where TeachingObject and LearningObject extend
>> Resource.
>>
>> The bit where update_attributes returns true, yet seems to fail, is
>> rather disconcerting. �Can anyone explain what's going on here?
> 
> I believe that the type column is marked as a protected attribute or
> something along those lines.
> 
> Fred

ahhh, well that would explain it.  It would also explain why 
update_attribute returns true - it just silently ignores the protected 
fields.  It's a bit annoyin that the api doesn't mention this: to quote

>>Single table inheritance
>>
>>Active Record allows inheritance by storing the name of the class in a column 
>>that by default is named "type" (can be changed by overwriting 
>>Base.inheritance_column). This means that an inheritance looking like this:
>>
>>  class Company < ActiveRecord::Base; end
>>  class Firm < Company; end
>>  class Client < Company; end
>>  class PriorityClient < Client; end
>>
>>When you do Firm.create(:name => "37signals"), this record will be saved in 
>>the companies table with type = "Firm". You can then fetch this row again 
>>using Company.find(:first, "name = ‘37signals’") and it will return a Firm 
>>object.
>>
>>If you don‘t have a type column defined in your table, single-table 
>>inheritance won‘t be triggered. In that case, it‘ll work just like normal 
>>subclasses with no special magic for differentiating between them or 
>>reloading the right type with find.
>>
>>Note, all the attributes for all the cases are kept in the same table. Read 
>>more: www.martinfowler.com/eaaCatalog/singleTableInheritance.html

unquote.

anyway, thanks Fred.
max
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Odd behaviour of update_attributes in STI table

2009-10-19 Thread Frederick Cheung



On Oct 19, 10:08 am, Max Williams 
wrote:
> I just noticed this odd behaviour (in rails 2.2.2).   It looks like
> changing the type with update_attributes *doesn't* work (but returns
> true!), but changing the field and then saving it *does* work.  Here i
> have an STI situation where TeachingObject and LearningObject extend
> Resource.
>
> The bit where update_attributes returns true, yet seems to fail, is
> rather disconcerting.  Can anyone explain what's going on here?

I believe that the type column is marked as a protected attribute or
something along those lines.

Fred
>
> thanks -max
>
> >> resource = Resource.first
>
> => # description: "", type: "TeachingObject",  >>> 
> resource.update_attributes(:type => "LearningObject")
> => true
> >> resource = Resource.first
>
> => # description: "", type: "TeachingObject",  >>> resource.type = 
> "LearningObject"
> => "LearningObject"
> >> resource.save
> => true
> >> resource = Resource.first
>
> => # description: "", type: "LearningObject",  >
> --
> 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: Linked associations question please help

2009-10-19 Thread Sijo k g

Hi

   Have you anywhere specified the  HABTM relation?It not supported I 
think. Please check your relations like

user.rb
user has_many stories
user has_many items through stories

story.rb
belongs_to user
has_many items

item.rb
belongs_to story





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

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



[Rails] Re: Can (should) each :user have his own table?

2009-10-19 Thread AlwaysCharging

Thank you for the reply.

I would, but that's exactly what that article was saying to steer
clear of, and it makes sense.  If you have to keep querying the same
table for everyone's new posts and post them back to your "feed" of
the people that you follow, wouldn't that cause serious bottlenecks
and lead to outages?  (which is exactly what I think is/was happening
with twitter)

And right now I'm just at the hypothetical stage as I'm still learning
rails, so I don't have any constraints or requirements of what I'm
trying to do.  I was just saying if my app was heavily intensive on
user read/writes so that other users could follow other users,
wouldn't it be best to give each their own table?


On Oct 19, 4:53 am, Colin Law  wrote:
> 2009/10/19 AlwaysCharging :
>
>
>
> > I was reading this article a while back
> >http://www.sitepoint.com/blogs/2008/06/06/did-rails-sink-twitter/
> > and it got me thinking.  If I wanted to set up my app so that each
> > user has his/her own table, how would I go about doing that?
>
> > "create_table :users"  just creates a table in the database for a list
> > of all the users (which I guess I'd want in addition to their
> > individual tables), but is there a way to make it create an new table
> > for each user?  Would this even be the best way if my app allowed
> > "followers?"  Admittedly there'd be a ton of tables in my database,
> > but wouldn't it make it easier for indexing all of your followers
> > messages?
>
> > Any insight is greatly appreciated.
>
> Why not just put the information in the users table?  If you think
> this is not an appropriate solution give more details of the
> requirement so we can see what you are trying to do.
>
> Colin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: We're sorry, but something went wrong on Tomcat

2009-10-19 Thread srinivasan sakthivel
Hi
 First check ur database and then give previliage in ur application.

Thanks

On Mon, Oct 19, 2009 at 2:36 PM, rtacconi  wrote:

>
> The problem is that form that server I cannot connect to the MSql
> server, so the error is, no DB connection. Ii there a way to test the
> DB connection of a Rails application?
>
> On Oct 13, 7:02 pm, Hassan Schroeder 
> wrote:
> > On Tue, Oct 13, 2009 at 10:56 AM, rtacconi  wrote:
> > > I cannot see any error in catalina.2009-10-13.log, so the ROOT.xml
> > > error is gone. But I still have "We're sorry, but something went
> > > wrong." I changed web.xml to development, but I cannot see any log.
> >
> > Did you restartTomcatafter changing to development mode?
> >
> > > must be a severe error. I have the MySql connector intomcat/lib
> > > directory. I might be that the web app is not able to connect to
> > > MySql, which is in another server.
> >
> > So make sure your database.yml entries for both development and
> > production are correct, and you can connect to the DB manually from
> > the command line using that info.
> >
> > --
> > Hassan Schroeder  hassan.schroe...@gmail.com
> > twitter: @hassan
> >
>

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



[Rails] Odd behaviour of update_attributes in STI table

2009-10-19 Thread Max Williams

I just noticed this odd behaviour (in rails 2.2.2).   It looks like
changing the type with update_attributes *doesn't* work (but returns
true!), but changing the field and then saving it *does* work.  Here i
have an STI situation where TeachingObject and LearningObject extend
Resource.

The bit where update_attributes returns true, yet seems to fail, is
rather disconcerting.  Can anyone explain what's going on here?

thanks -max

>> resource = Resource.first
=> # >
>> resource.update_attributes(:type => "LearningObject")
=> true
>> resource = Resource.first
=> # >
>> resource.type = "LearningObject"
=> "LearningObject"
>> resource.save
=> true
>> resource = Resource.first
=> # >
-- 
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: We're sorry, but something went wrong on Tomcat

2009-10-19 Thread rtacconi

The problem is that form that server I cannot connect to the MSql
server, so the error is, no DB connection. Ii there a way to test the
DB connection of a Rails application?

On Oct 13, 7:02 pm, Hassan Schroeder 
wrote:
> On Tue, Oct 13, 2009 at 10:56 AM, rtacconi  wrote:
> > I cannot see any error in catalina.2009-10-13.log, so the ROOT.xml
> > error is gone. But I still have "We're sorry, but something went
> > wrong." I changed web.xml to development, but I cannot see any log.
>
> Did you restartTomcatafter changing to development mode?
>
> > must be a severe error. I have the MySql connector intomcat/lib
> > directory. I might be that the web app is not able to connect to
> > MySql, which is in another server.
>
> So make sure your database.yml entries for both development and
> production are correct, and you can connect to the DB manually from
> the command line using that info.
>
> --
> Hassan Schroeder  hassan.schroe...@gmail.com
> twitter: @hassan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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 (should) each :user have his own table?

2009-10-19 Thread Colin Law

2009/10/19 AlwaysCharging :
>
> I was reading this article a while back
> http://www.sitepoint.com/blogs/2008/06/06/did-rails-sink-twitter/
> and it got me thinking.  If I wanted to set up my app so that each
> user has his/her own table, how would I go about doing that?
>
> "create_table :users"  just creates a table in the database for a list
> of all the users (which I guess I'd want in addition to their
> individual tables), but is there a way to make it create an new table
> for each user?  Would this even be the best way if my app allowed
> "followers?"  Admittedly there'd be a ton of tables in my database,
> but wouldn't it make it easier for indexing all of your followers
> messages?
>
> Any insight is greatly appreciated.

Why not just put the information in the users table?  If you think
this is not an appropriate solution give more details of the
requirement so we can see what you are trying to do.

Colin

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

2009-10-19 Thread theambler

Thanks so much for the quick response.

Yes that makes sense, and I wasn't aware it was possible.  However
having added to my User model:

has_many :items, :through=>:stories

I am getting the following error when trying to call @user.items

ActiveRecord::HasManyThroughSourceAssociationMacroError: Invalid
source reflection macro :has_many :through for
has_many :items, :through => :stories.  Use :source to specify the
source reflection.

I have to admit Reflections are something beyond my knowledge, and I
noted suggestions that nested HABTM associations weren't supported in
earlier versions of Rails.

Any thoughts?


On Oct 19, 9:20 am, Sijo k g  wrote:
> And By applying this in above case you can directly say
>
> current_user.items
>
> Sijo
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: paperclip - imagemagick Configuration

2009-10-19 Thread petro_dev

Also for other peoples benefit:

For windows, make sure you close down the rails server and any command
prompt instances and restart them. The imagemagick install path in
program files (the folder containing identify.exe) needs to be
accessible in the PATH variable. To check type echo %PATH% in the
command prompt. If the imagemagick installation folder shows, the
rails app should function.

On Oct 3, 2:17 am, tomrossi7  wrote:
> I figured it out!  I was setting my options like this (which used to
> work):
>
> Paperclip::Attachment.default_options.merge!(:command_path => "/usr/
> local/bin")
>
> But I noticed others using this method, which solved my problem!
>
> Paperclip.options.merge!(:command_path => "/usr/local/bin")
>
> I hope this helps someone else!
>
> Thanks,
> Tom
>
> On Oct 2, 1:57 pm, TomRossi7  wrote:
>
>
>
> > I'm not sure what changed, but I started getting errors from the
> >paperclipplugin:
>
> > [paperclip] An error was received while processing:
> > # > not recognized by the 'identify' command.>
>
> > I have verified the command path is correct.  What else should I be
> > checking?
>
> > Thanks!
> > Tom

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



[Rails] Re: paperclip is not saving the files

2009-10-19 Thread petro_dev

For windows, make sure you close down the rails server and any command
prompt instances and restart them. The imagemagick install path in
program files (the folder containing identify.exe) needs to be
accessible in the PATH variable. To check type echo %PATH% in the
command prompt. If the imagemagick installation folder shows, the
rails app should function.

On Oct 10, 7:33 pm, about2flip  wrote:
> I'm getting this error for windows setup does this solution work?
> Going Gray trying to figure out why I am getting the error.
>
> THanks for your help.
>
> On Sep 4, 3:40 am, Rails List 
> wrote:
>
>
>
> > Wasim Akram wrote:
> > > I've installed image magick.
> > > but it still shows the error message "/LOCALS~1/Temp/stream.3468.0 is
> > >notrecognized
> > > by the 'identify'command.".Is that i need to install it in the
> > > project folder and give me some ways on how to compile it .or any
> > > other gems avilable for this paperclip to work.
> > > i'm in urgent need
>
> > > Plz help me in this regard...
>
> > Use this:
>
> > has_attached_file :image, :url => "/:attachment/:id_:style.:extension",
> > :path => ":rails_root/public/:attachment/:id_:style.:extension", :styles
> > => { :original => "500x500>" }
>
> > Let me know how it goes.  I have an working application that you can
> > download fromhttp://www.classifiedscript.in
>
> > Cheers
> > --
> > 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] Can (should) each :user have his own table?

2009-10-19 Thread AlwaysCharging

I was reading this article a while back
http://www.sitepoint.com/blogs/2008/06/06/did-rails-sink-twitter/
and it got me thinking.  If I wanted to set up my app so that each
user has his/her own table, how would I go about doing that?

"create_table :users"  just creates a table in the database for a list
of all the users (which I guess I'd want in addition to their
individual tables), but is there a way to make it create an new table
for each user?  Would this even be the best way if my app allowed
"followers?"  Admittedly there'd be a ton of tables in my database,
but wouldn't it make it easier for indexing all of your followers
messages?

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

2009-10-19 Thread Sijo k g

Hi Josh

  Assuming you want to run application in production mode.So do

rake db:migrate RAILS_ENV=production
./script/server -e production



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

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



[Rails] Re: Linked associations question please help

2009-10-19 Thread Sijo k g

And By applying this in above case you can directly say

current_user.items






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

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



[Rails] Re: Deploying rails application

2009-10-19 Thread Eric

script/server -h

-eric

On Oct 18, 6:19 pm, Josh6847  wrote:
> I am looking to set my rails application into production mode. Does
> anyone have easy instructions on this or good documentation?
>
> Thanks in advance.
>
> Josh
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send 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: Linked associations question please help

2009-10-19 Thread Sijo k g

Hi

You have to look at 'nested has_many associations'. Search it here

http://guides.rubyonrails.org/association_basics.html


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

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



[Rails] [JOBS] Seeking technical co-founder for web 2.0 sustainability start-up in Vancouver – equity based an d part-time to start

2009-10-19 Thread Annalea Krebs

Do you have a passion to use technology for social and environmental
change?! Want to get in on the ground level of a promising company, as
a co-founder? This opportunity is equity based, and part-time to
start, leading to a full time opportunity as funding permits.

If you’re a self-motivated, entrepreneurial, developer then keep
reading!

We have a concept for and market interest in an online platform that
helps organizations attract and engage with the younger generation
around their sustainability initiatives and opportunities.

Our CEO has experience in the sustainability sector and has the
business skills to execute, but needs a technical partner to implement
and lead the technology development. That’s where you come in … we are
now looking for a technical entrepreneurial-minded person, with strong
development skills, to help us launch and grow our business. You
should love to write code, but if you also have an eye for design and
user experience – all the better. This is a hands on, collaborative
role, and is integral to the companies success.

You should be based out of the Vancouver or Victoria region. Recent
graduates with a portfolio are encouraged to apply!

Your experience & skills (our wish list):
• A degree or diploma in Computer Science or related field
• 3+ years of web application development experience with LAMP, Ruby
on Rails, Python/Django, or equivalent
• Solid SQL knowledge and experience building scalable database driven
web sites
• Knowledge of JavaScript and AJAX required
• Experience using open source software and services
• Experience using Amazon’s Web Services a bonus
• Familiarity with SEO, landing page optimization, web analytics a
bonus

Who you are:
• Passionate about web technologies, usability, and agile development
• Motivated self-starter / entrepreneurial / excellent communicator
• Business-sense / solutions-focused / loves continuous learning
• Flexible and able to work in a start-up environment
• You will be working closely with the CEO and will be managing a
technical team in the future, so people skills are good :)

What we need from you:
• Architect, implement (code), and maintain our online platform
• Provide overall technical guidance, ideas, and leadership
• Use your tech savvy to solve business problems and create business
opportunities
• Troubleshoot issues as necessary

Why Join Us?
• Great opportunity to get in on the ground level of a promising
company, lead technology development, and use your skills to make a
difference in the world!
• Early stage, equity based opportunity – terms negotiable. Part-time
to start, leading to a full-time opportunity as funding permits.

We Want to Hear From You!
Please direct all inquiries and resumes to annalea.kr...@gmail.com.
Please include links to previous projects.

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



[Rails] Deploying rails application

2009-10-19 Thread Josh6847

I am looking to set my rails application into production mode. Does
anyone have easy instructions on this or good documentation?

Thanks in advance.

Josh

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



[Rails] Linked associations question please help

2009-10-19 Thread theambler

I have a Users model.  Users  'have many' Stories, and Stories have
many Items.

This structure allows the sharing of Items between Stories and Stories
between Users.

But given there is no direct 'ownership' link between Users and Items,
what is the best way of building a list of Items which belong to a
Story to which a given User has access.

something like:

   current_user.stories.items

obviously doesn't work.

I've written some nested blocks ie:

  users.each do |user|
 user.stories.each.do |story|
story.items.each.do |item|
end
 end
  end

which works but is ugly and slow.

I could keep an index table of items linked to users but this is
redundant for most of my application.   I'm sure there is a more
obvious, simple way of doing this but I haven't come across it.

Any help gratefully received.




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