[Rails] rails startup

2009-03-13 Thread Difei Zhao

Greetings,

  I am wondering if there is a way to initiate a pre-stored key/value
pair from mysql to memcached during the boot procedure of rails? Thanks
in advance.

Cheers,
Difei
-- 
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: update_attributes and validation

2009-03-13 Thread Nilesh Kulkarni

Sumanth Krishna wrote:
> try with update_attributes! (which internally uses 'save!')
> 
> On Fri, Mar 13, 2009 at 2:00 PM, Nilesh Kulkarni <
> rails-mailing-l...@andreas-s.net> wrote:
> 
>> and 2028"
>> 50  don2000 $400
>>
>> if I provide wrong input for one say year "1800" for "don" and correct
>> for "james bond" year as "2000" it updates James bond ,correctly but do
>> not show validation message for "don" on my page. I want to display
>> message how can i do that
>> --
>> Posted via http://www.ruby-forum.com/.
>>
>> >
>>
> 
> 
> --
> --
> Thanks & Regards,
> Sumanth Krishna. A
> +358 40 3276564
> 
> Blogs:
> TwinclingCommunity:
> 
> http://sumanthtechsavvy.blogspot.com/
>  http://www.twincling.org/node/227
> 
> http://yourway2health.blogspot.com/
>http://www.osef.twincling.org
hi

I have used update_attributes! it shows validation message

ActiveRecord::RecordInvalid in BookController#edit_book

Validation failed: Year should be a above 1900

on different page ,but i want that message must be displayed on same 
page on top
my controller look like this

def edit_book
 if request.post?
  # code for update data ie "update_attribute!" method
end
   @books = Book.find(:all)
end

and I have view named "edit_book.html.erb"
-- 
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 RoR do this? How easily?

2009-03-13 Thread Norm
bill walton wrote:
> Hi Norm,
>
> On Wed, 2009-03-11 at 11:05 -0700, Norm wrote:
>   
>> I include a couple of scripts to put in your startup folder 
>> so the servers (db and web) start up at windows login.
>> 
>
> Do circumstances allow sharing?
>
> Best regards,
> Bill
>
>   
Sure.  They are nothing special and as I know very little about MS 
systems there is probably a better way to do it but it works.


1 - start_mysql.bat
PATH C:\InstantRails\mysql\bin;%PATH%
mysqld

2 - start_server.bat
CD C:\InstantRails\rails_apps\open_campground
PATH C:\InstantRails\ruby\bin;C:\InstantRails\mysql\bin;%PATH%
ruby script\server -e production

They require manual editing if InstantRails is installed in someplace 
other than C:
Just copy them into your startup folder and reboot..

Good luck
Norm





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



[Rails] Re: Creating/Updating Models from text/xml Requests

2009-03-13 Thread Phlip

MaggotChild wrote:

> And accept XML requests in the following manner:
> 
> 
>   Good Shipment
>   
>   
> 
>   Failure
>   


If you try this from_xml...

   http://gist.github.com/75525

...I think it would clear the make-work out of the way, allowing you to focus 
on 
the validations. Tell me if you get stuck - I wrote it for your exact 
situation, 
but it can't validate automatically.


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



[Rails] Creating/Updating Models from text/xml Requests

2009-03-13 Thread MaggotChild

I'm curious how others would deal with this situation.

In my case, I have:

class Package
  has_many :deliveries
end

class Delivery
  belongs_to :package
  belongs_to :region
end

class Region
  has_many :deliveries
end

And accept XML requests in the following manner:


  Good Shipment
  
  

  Failure
  
US
  


  Unknown
  
FR
  

  


Now, my controller would look something like this ugly beast:

class PackagesController
  def create
if package = params[:package]
  package = Package.find_or_initialize_by_name(package)
  if deliveries = package.delete(:deliveries)
 deliveries.each do |d|
 region = d.delete(:region)
 region = Region.find_or_create_by_name(region[:name])
 break if region.nil?
 package.deliveries.create(region)
 package.deliveries[-1].region = region
 end
  end
end
#save and more...
  end
end

As one can see, this is horrible for several reasons. One of the big
ones being request validation and error handling.

Overriding package.from_xml  is an option, but I find myself thinking
that I should be validating against request.body with say a DTD, as
opposed to picking apart the params hash. (Though I'll have to pick it
apart anyways to create the models...)

Then I find my self thinking that creating a course grained validation
method like a DTD is stupid since I have my fine grain validation
logic within the given models.

Yes, I've heard of ROXML.

Any thoughts?





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



[Rails] Re: Date Validation for date_select

2009-03-13 Thread Siddharth Ravichandran

Im sorry the validate method in the model (Spec which stores 
specifications of the registered users)
-- 
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] Date Validation for date_select

2009-03-13 Thread Siddharth Ravichandran

I am new to Rails and I am building this website based on the tutorials
from a book called Railspace. My problem is I have a form page which
accepts the date for
a birthdate field


  
 Birthdate 
<%= date_select :spec, :birthdate,
  :start_year=>Spec::START_YEAR,
  :end_year=>Time.now.year,
  :include_blank=>true,
  :order =>[:month, :day, :year]
%>


  

It works fine when I enter correct dates but when I try entering
something like Feb 31 2009 it gives me the following error.

   1 error(s) on assignment of multiparameter attributes

My parameter variable shows that its being passed as 3 seperate values
(that is my understanding please correct me if I am wrong)

{"commit"=>"Update", "spec"=>{"city"=>"Atlanta", "occupation"=>"Software
programmer", "zip_code"=>"21312", "birthdate(1i)"=>"1907",
"gender"=>"Male", "birthdate(2i)"=>"2", "birthdate(3i)"=>"31",
"first_name"=>"Dilbert", "last_name"=>"Dilbert", "state"=>"Georgia"}}

I cannot seem to validate this using the validate method on the
controller as I am unable to fetch the values of the parameters.
Ive tried using something like

def validate
 if (birthdate.month==2 && birthdate.day > 29)
   errors.add(:birthdate, "Invalida date")
end

but its seems to completely bypass this. It works correctly when i
simply type
 if(birthdate.month==2 )
errors.add(..)
but I dont seem to understand why I cannot validate it.

Could someone explain this to me.
Thanks in advance.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: How to disable REST in Rails Applications

2009-03-13 Thread Mike

Brian,

So in a new rails_apps just include the map.connect line and comment
the default ones?

Thank you

On 13 mar, 18:42, Brian Hogan  wrote:
> You don't have to disable anything. Don't use map.resources.
>
> The original
>
> map.connect :controller/:action/:id
>
> route should be all you need if you wanna go oldschool.
>
> On Fri, Mar 13, 2009 at 7:39 PM, Mike  wrote:
>
> > Yes, I know that REST is the new way to program in Rails, but I really
> > likes the old-fashion way, How can I disable REST so I can expose very
> > easily methods in my controller?
>
> > Thank you.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: How to disable REST in Rails Applications

2009-03-13 Thread Brian Hogan

You don't have to disable anything. Don't use map.resources.

The original

map.connect :controller/:action/:id

route should be all you need if you wanna go oldschool.

On Fri, Mar 13, 2009 at 7:39 PM, Mike  wrote:
>
> Yes, I know that REST is the new way to program in Rails, but I really
> likes the old-fashion way, How can I disable REST so I can expose very
> easily methods in my controller?
>
> Thank you.
> >
>

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



[Rails] How to disable REST in Rails Applications

2009-03-13 Thread Mike

Yes, I know that REST is the new way to program in Rails, but I really
likes the old-fashion way, How can I disable REST so I can expose very
easily methods in my controller?

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



[Rails] Re: Is Mongrel dead?

2009-03-13 Thread Matt Jones



On Mar 12, 2:41 pm, Gene Gene 
wrote:
> Rob Biedenharn wrote:
> >Perhaps it is just good enough for most. Just because it isn't
> >changing much doesn't mean that it is dead.
>
> To me it does. I bet performance can be improved, a nice UI to manage
> Mongrels and view logs can be added, etc. There is a reason Apache did
> not stop at 1.2. If it did, we won't be using it now. Things do get
> outdated and constant improvement is necessary.
>
> > Just because a company wants to pay for supported software doesn't
> > mean they understand the value of that software (or of OSS in general).
>
> Agreed. However, the fact of life is that companies consist of soldiers,
> leutenants, colonels, generals, and politicians :) soldier might know
> from experience that Rails/Mongrels is fine and his leutenant might
> agree. However, when it gets to the general's level he won't know and
> won't care - supplies to his troops must be guaranteed by a big corp
> (IBM, MSoft, HP, Sun, ...). This way politician can say something that
> sounds good to his constituents (shareholders). EngineYard is a good
> company, but it's no HP/Oracle/Some_other_heavy_weight_corp. In order
> for the Rails to be used at the highest corp level, there need to be
> backing from another big corp. There is a reason folks use Java and .Net
> to develop "ENTERPRIZE" level soft. I see how Sun is trying to get into
> the game with NetBeans and Glassfish capable of running JRuby/Rails.
> However, the effort seems to be just in case, kind of like MSoft's Iron
> Ruby. What I would LOVE to see is for HP or Oracle to step in and offer
> competition to MS/.Net and Sun/Java. I mean really back it up with a
> whole stack - app server, training, consulting, etc. It won't kill the
> little guys (there are plenty of Java consulting inc.'s besides the big
> 3), but it will get Rails to corp level for real.

As you point out, there's JRuby, which I've heard some larger
"enterprise" type
stuff is running on. I've even talked to a few folks who are sneaking
Rails apps
into their otherwise Java-only infrastructure that way.

However, you'll also find that a lot of folks have come to Rails (from
Java/.Net)
specifically to get away from the enterprise crowd. To use an animal
analogy,
Rails doesn't want to compete with the big dinosaurs - it's a small
mammal,
operating according to an entirely different set of rules.

--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] Rails Magazine Issue #1 - Free Download

2009-03-13 Thread Olimpiu Metiu

The free, digital edition of Rails Magazine (Issue #1) is now
available: http://railsmagazine.com/issues/1

If you’d like to support this effort, please take our survey:
http://survey.railsmagazine.com, and consider contributing an article.

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



[Rails] Re: bad model name

2009-03-13 Thread Robert Walker

Robert Walker wrote:
> Keep in mind that model names should be nouns. Controller actions are 
> verbs. In your case of WhatsNew is practically a complete sentence. 

Correction: Controller actions aren't necessarily verbs. It might be 
more accurate to say the handles what to do with the request and the 
verb is part of the request (i.e. "GET index" would get then index of 
news items and "POST create" would create new news items).
-- 
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: bad model name

2009-03-13 Thread Robert Walker

Philip Hallstrom wrote:
> Two choices for you..
> 
> - Add your own inflection so that 'news' is singularlized to 'news'.
> - Change your class name.

Keep in mind that model names should be nouns. Controller actions are 
verbs. In your case of WhatsNew is practically a complete sentence. 
"What is new?" Maybe use something like NewsItem or simply News, which 
rails will properly pluralize as "News." In this case the table name 
will be news.

Then to find out, "What is new?" you can create a named_scope that gets 
recent new items like this:

@recent_news_items = NewsItem.recent

or

@recent_news_items = News.recent
-- 
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] Observers and outside methods

2009-03-13 Thread Mike C

I'm thinking about using observers for my situation. Basically
whenever an object is created, I want a message to be sent to a user
via a PM system I made. At the moment this is happening within the
create method of the controller. I tried putting this in a callback in
the model, but it seems methods such as the URLs (users_path) and
current_user don't work in models. Since observers are also a type of
model, I was wondering if these methods don't work in them either?

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

2009-03-13 Thread Mike C

Thanks for the replies. Another thing I see are some search plugins
that use LIKE in them predominantly and that's also why I was
wondering if it was ok. searchlogic was one I was looking at and so
was search_do.

On Mar 13, 11:59 am, Philip Hallstrom  wrote:
> > Thanks, that makes things clearer. But how big is big? I don't plan on
> > my app being hugely popular, but would thousands of entries be ok? Is
> > there an area where LIKE starts to be really slow?
>
> If it's a blog, I wouldn't think twice about using LIKE.  That is, I  
> can't see a blog being big enough for it to become a problem.  
> However, as other folks have said it definitely can be the source of  
> problems down the road.
>
> At that point you should look at one of the full text search engines  
> like ferret, sphinx, solr, etc.
>
> Also, just so you're aware LIKE in mysql is case-INSENSITIVE.  LIKE in  
> PostgreSQL is case-SENSITIVE.
>
> So when you're searching for names and are happy doing a LIKE '%ill%'  
> to find those names below, keep in mind that won't work in  
> PostgreSQL.  PostgreSQL has an ILIKE for that, but then that's not  
> supported by MySQL.  PostgreSQL also has some regex pattern matching  
> functions that are faster, but again I believe are postgres only.
>
> Anyway, just something to keep in mind if you think your app might be  
> run with different backends.
>
> -philip
>
> > On Mar 13, 11:06 am, Charles Johnson  wrote:
> >> On Fri, Mar 13, 2009 at 12:42 PM, Mike C  wrote:
>
> >>> I've heard that using LIKE is very slow, but I see it being used a  
> >>> lot
> >>> in examples, blogs etc. Is it really that bad? Since Rails doesn't
> >>> directly support Fulltext search, this is the easiest way to get
> >>> searching done, right? Or are there any other easier ways? I'm using
> >>> acts_as_indexed right now, but it still doesn't do what LIKE does.
>
> >> The problem with the sql "LIKE" is that it can render the use of an
> >> index impossible. Imagine a search like:
>
> >> @users = User.find(:all, :conditions => "first_name like '%ILL%'")
>
> >> The database will have to find BILL, GILL, JILL, JILLIAN, etc. If  
> >> you have a
> >> few hundred or a few thousand users that may not be such an issue.  
> >> Millions
> >> of users makes this a different issue altogether. A full table scan  
> >> is
> >> needed, and what will you do with all those rows?
>
> >> The point is this, when you are tempted to use LIKE be sure the  
> >> data set
> >> searched and returned are small and that you try to other ways to  
> >> constrain
> >> the search.
>
> >> Cheers--
>
> >> Charles
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Interesting arrangement

2009-03-13 Thread DanC

Thanks Eric,

Exactly what I was looking for.

Dan

On 13 Mar, 22:05, Eric  wrote:
> http://railscasts.com/episodes/28-in-groups-of
>
> On Mar 13, 2:06 pm, DanC  wrote:
>
>
>
> > Hi all,
>
> > I have been asked to develop an app which basically displays 100
> > images on a homepage arranged in a 10 x 10 grid.
>
> > I have been using attachment_fu to upload images although I hear great
> > things about paperclip. Anyway, that is the easy part.
>
> > Does anyone have any advice about how best to arrange the images on
> > the page in a clever database way so I can just call all of the
> > pictures in my controller and they will each be allocated to a space
> > on the grid automatically?
>
> > I know this isn't a pure rails problem, but whilst I can think of lots
> > of long-winded manual ways of arranging images, I am sure there must
> > be better way.
>
> > Thanks,
>
> > Dan- Hide quoted text -
>
> - Show quoted text -
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Help with sorting / ordering

2009-03-13 Thread Tom Z Meinlschmidt

OK. so then you need to create your own queries with 
Reviews.find_by_sql() and insert appropriate sql statement, eg

select product_id, count(*) as counter from reviews where age between 
(10,20) and ... order by 2 desc

tom

Robert Scott wrote:
> Right, but that approach also means that I will be using all reviews for 
> all users.
> 
> The only reason I'm going through the hassle of trying to make it 
> dynamic is so that I could further segment the reviewers. So instead of 
> saying X reviewers would buy it again, I could get closer to X reviewers 
> in your age group would buy it again or X reviewers in your area, etc. 
> etc.
> 
> 
> 
> 
> Tom Z Meinlschmidt wrote:
>> easiest and fastest way is to keep number of reviews in column in
>> product table... then simple add :order => 'reviews_count desc' in your
>> Product.find()
>>
>> tom
>>
>> Robert Scott wrote:
>>> belong_to their respective products.
>>>
>>> So my question is this:
>>> How can I structure a query so that I can order products based on the
>>> number of people who would purchase it again?
>>>
>>> It'd be alot easier for me, and probably my server, if I just kept a
>>> running count of those in the actual product record, but I'm trying to
>>> keep it dynamic so that I can create custom reviewer sets elsewhere.
>>>
>>> Thanks in advance for any direction.
>>
>> --
>> ===
>> Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
>>
>> www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
>> ===
> 


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

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

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



[Rails] Re: Help with sorting / ordering

2009-03-13 Thread Robert Scott

Right, but that approach also means that I will be using all reviews for 
all users.

The only reason I'm going through the hassle of trying to make it 
dynamic is so that I could further segment the reviewers. So instead of 
saying X reviewers would buy it again, I could get closer to X reviewers 
in your age group would buy it again or X reviewers in your area, etc. 
etc.




Tom Z Meinlschmidt wrote:
> easiest and fastest way is to keep number of reviews in column in
> product table... then simple add :order => 'reviews_count desc' in your
> Product.find()
> 
> tom
> 
> Robert Scott wrote:
>> belong_to their respective products.
>> 
>> So my question is this:
>> How can I structure a query so that I can order products based on the
>> number of people who would purchase it again?
>> 
>> It'd be alot easier for me, and probably my server, if I just kept a
>> running count of those in the actual product record, but I'm trying to
>> keep it dynamic so that I can create custom reviewer sets elsewhere.
>> 
>> Thanks in advance for any direction.
> 
> 
> --
> ===
> Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache
> 
> www.meinlschmidt.com  www.maxwellrender.cz  www.lightgems.cz
> ===

-- 
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] Non-ActiveRecord observers

2009-03-13 Thread Rafael Rosa

Hi,

I'm integrating DataMapper in a Rails project, and I'm stumbling on some
problems, which I knew would happen. One of them is that Rails just
loads ActiveRecord's observers, and that, of course, doesn't work with
DataMapper's.

Does anyone knows if there's a plan to make this works well in the
future? Is that in the roadmap (assuming there's one) to Rails 3? Should
I open a ticket on Lighthouse?

Thanks,
Rafael
www.rafaelrosafu.com

P.S.: I'm not complaining, just want to know how I can help to fix 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] Re: Interesting arrangement

2009-03-13 Thread Eric

http://railscasts.com/episodes/28-in-groups-of

On Mar 13, 2:06 pm, DanC  wrote:
> Hi all,
>
> I have been asked to develop an app which basically displays 100
> images on a homepage arranged in a 10 x 10 grid.
>
> I have been using attachment_fu to upload images although I hear great
> things about paperclip. Anyway, that is the easy part.
>
> Does anyone have any advice about how best to arrange the images on
> the page in a clever database way so I can just call all of the
> pictures in my controller and they will each be allocated to a space
> on the grid automatically?
>
> I know this isn't a pure rails problem, but whilst I can think of lots
> of long-winded manual ways of arranging images, I am sure there must
> be better way.
>
> Thanks,
>
> Dan
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Help with sorting / ordering

2009-03-13 Thread Tom Z Meinlschmidt

easiest and fastest way is to keep number of reviews in column in 
product table... then simple add :order => 'reviews_count desc' in your 
Product.find()

tom

Robert Scott wrote:
> Hi! I hope someone can offer some insight or direction into a problem
> I'm having.
> 
> In my application, I have two tables: products and reviews.
> 
> - Products stores information on things that are sold
> - Reviews store comments from users that purchased the product, as well
> as boolean field about if they would purchase again.
> 
> The models are setup so that products has_many reviews and reviews
> belong_to their respective products.
> 
> So my question is this:
> How can I structure a query so that I can order products based on the
> number of people who would purchase it again?
> 
> It'd be alot easier for me, and probably my server, if I just kept a
> running count of those in the actual product record, but I'm trying to
> keep it dynamic so that I can create custom reviewer sets elsewhere.
> 
> Thanks in advance for any direction.


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

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

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



[Rails] Help with sorting / ordering

2009-03-13 Thread Robert Scott

Hi! I hope someone can offer some insight or direction into a problem
I'm having.

In my application, I have two tables: products and reviews.

- Products stores information on things that are sold
- Reviews store comments from users that purchased the product, as well
as boolean field about if they would purchase again.

The models are setup so that products has_many reviews and reviews
belong_to their respective products.

So my question is this:
How can I structure a query so that I can order products based on the
number of people who would purchase it again?

It'd be alot easier for me, and probably my server, if I just kept a
running count of those in the actual product record, but I'm trying to
keep it dynamic so that I can create custom reviewer sets elsewhere.

Thanks in advance for any direction.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Is Mongrel dead?

2009-03-13 Thread John Barnette

Hi,

On Mar 13, 2009, at 7:19 AM, bcardarella wrote:
> I don't see mongrel going anywhere any time soon. True, Passenger is
> the way to go for production but for development mode mongrel is the
> clear winner. Who wants to setup an Apache instance and edit config
> files for every new project in development?

If you're on Mac OS X, you might want to take a look at:  
http://github.com/alloy/passengerpane


~ j.

>
> - Brian Cardarella
>
> On Mar 12, 12:19 pm, Gene Gene 
> wrote:
>> Is Mongrel dead? When I look athttp://mongrel.rubyforge.org/wiki/News
>> the latest news was from close to a year ago, when last version of
>> Mongrel was released. A look at the tickets shows a rather sad  
>> picture
>> with only two developers “evanweaver” and “luislavena” contributing  
>> to
>> the bug fixes lately.
>>
>> Please understand that I am not complaining – I just want to know the
>> situation so that I can make intelligent decision on the long term
>> viability of Mongrel as an application server. I realize that it is a
>> community project  and if more people (including myself) would put in
>> more effort things would be different. However, as it stands now, I  
>> am
>> not able to contribute due to the lack of knowledge and time. This  
>> is a
>> normal case of an open source software and, as I said, I am not
>> complaining. Still, I would like to understand the long term
>> implications of using Mongrel.
>>
>> I know there is Phusion aka mod_rails. However, as it stands right  
>> now,
>> the company is not a truly “for profit” company and relies on  
>> donations
>> and consulting in installing mod_rails. Amount of dollars coming in  
>> for
>> installation consulting is probably questionable since installation  
>> is
>> fairly simple. The folks behind mod_rails hit the nail on the head
>> however, when they introduced “Passenger Enterprise License”.  Folks
>> responsible for strategic long term decisions regarding technology  
>> need
>> to be sure that the company won’t be left high and dry when Mogrel
>> drowns (just look at that picture onhttp://mongrel.rubyforge.org/ 
>> wiki-
>> poor Fluffy is drowining). Rails proved to be a viable framework,  
>> that
>> survived time test (although I would certainly prefer to see less
>> frequent version releases). However, I am puzzled by the lack of
>> interest in offering a commercial app server for Rails. There is
>> certainly room for such a thing. Folks like me would rather pay XYZ
>> dollars for a license, get phone support, etc. as oppose to  get free
>> Mongrel and keep my fingers crossed that new Ruby patch does not  
>> break
>> it to pieces like it did last year. I know that there is a number of
>> companies that use Rails regardless. However, the number would be  
>> bigger
>> if there were more commercial tools, especially servers. If you look
>> into Java world you will see that there is a reason why Weblogic
>> successfully competes with free JBoss, Tomcat, and Glassfish.
>>
>> …but I digress… So is Mongrel dead? Is there a commercial app  
>> server for
>> Rails?
>>
>> TPM
>>
>> P.S. am intentionally posting this in the Rails forum as oppose to
>> Mongrel forum or Deployment form, because I would like to hear from a
>> wider audience and also let the wider audience see this thread. I  
>> think
>> it is very important to the Rails community as it grows and as Rails
>> tries to be on the par with Java and .Net in large corporations. Some
>> indication where Ruby / Rails are can be gleaned from 
>> here:http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
>> --
>> 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] Interesting arrangement

2009-03-13 Thread DanC

Hi all,

I have been asked to develop an app which basically displays 100
images on a homepage arranged in a 10 x 10 grid.

I have been using attachment_fu to upload images although I hear great
things about paperclip. Anyway, that is the easy part.

Does anyone have any advice about how best to arrange the images on
the page in a clever database way so I can just call all of the
pictures in my controller and they will each be allocated to a space
on the grid automatically?

I know this isn't a pure rails problem, but whilst I can think of lots
of long-winded manual ways of arranging images, I am sure there must
be better way.

Thanks,

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



[Rails] Re: Proble wuth form

2009-03-13 Thread Jose vicente Ribera pellicer

Jose vicente Ribera pellicer wrote:
>  I tried with:
> 
>  form_for [...@encuesta, @pregunta] do |f|
>   <%= f.error_messages %>
> 
>
>  <%= f.label :texto %>
>  <%= f.text_field :texto %>
>
> ...
>   end
> 
>  The result is the same. I thinking that perhaps i can0t do "restful" 
> forms :(

Solved!!

<% form_for(@pregunta, :url => encuesta_preguntas_path(@encuesta)) do 
|f| %>

It rules!!
-- 
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, passenger, and images

2009-03-13 Thread Brian Hogan

Check your app's source. Look for anything dealing with asset_host. My
guess is something is prepending this to your image helper, and
asset_host will do that if you tell it to.

If you create a new Rails app, you'll be able to test this out by
making a controller and a view. On the view, just link to the
rails.png image in the /images folder that ships with a defalt app.

<%=image_tag "rails.png" %>

If that gives you trouble, then it's not your code.

HTH

On Fri, Mar 13, 2009 at 3:50 PM, Steve Odom  wrote:
>
> There are not any requests for my images showing up in my apache
> access_log where I use an image_tag. If I handroll the image ref
> like:
>
> 
>
> then it shows up fine. But if I use the image_tag helper like:
>
> <%= image_tag "icons/add.gif" %>
>
> ..it gets rendered like:
> http://localhost:3000/images/icons/add.gif?
> 1221425550" />
>
> ..and is broken as a result.
>
> My stylesheet and js requests show up because I'm not using the rails
> helpers (stylesheet_tag_link).
>
> I used preference pane to set it up. I was under the impression I did
> not have to add an entry in my /etc/hosts file.
>
> This is a new macbook where I havent used webrick, mongrel, or thin.
>
> Any ideas?
>
> Steve
>
> On Mar 13, 3:14 pm, Conrad Taylor  wrote:
>> On Fri, Mar 13, 2009 at 1:01 PM, Steve Odom  wrote:
>>
>> > Just switched over to passenger for development and production for my
>> > rails app. Liking it so far.
>>
>> > My problem is my image_links, stylesheet_tag_links, and
>> > javascript_tag_links are all adding "http://localhost:3000to the
>> > generated links. I got around the stylesheet and js links by not using
>> > the helpers.
>>
>> > I can access my all of my assets directly via
>> >http://dating.local/stylesheets/all.css,
>> > for example.
>>
>> > I used passenger pref pane to render the vhost. It looks like:
>> > 
>> >  ServerName dating.local
>> >  DocumentRoot "/Users/steveodom/Development/dating/public"
>> >  RailsEnv development
>> >  
>> >    Order allow,deny
>> >    Allow from all
>> >  
>> >  ErrorLog "/Users/steveodom/Development/dating/log/apache.log"
>> > 
>>
>> > I'm not getting any errors in my development.log or apache error_log
>>
>> > Everything should be standard. I've experimented with ProxyPass's but
>> > those didn't help.
>>
>> > I'm using passenger 2.0.6, rails 2.2.2
>>
>> > Any suggestions?
>>
>> > Thanks,
>> > Steve
>>
>> Steve, do you have the following line in your vhosts file:
>>
>> NameVirtualHost *:80
>>
>> Also, did you add an entry in your /etc/hosts file to contain the following:
>>
>> 127.0.0.1 dating.local
>>
>> Last but not least, did you stop Mongrel, Webrick, or Thin?
>>
>> -Conrad
> >
>

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



[Rails] date_select and HTML options?

2009-03-13 Thread Jason

I have the following code, but can't seem to get the class attribute
to show up in the generated select elements. I saw something about a
bug/patch. However, as am still learning RoR I didn't want to jump to
conclusions. Anyone see anything wrong:

<%= f.date_select :expiration_date, :order =>
[:month, :year], :discard_day => true, :class => "dtfld" %>

I've also tried:

<%= f.date_select :expiration_date, {:order =>
[:month, :year], :discard_day => true}, :class => "dtfld" %>
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email 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, passenger, and images

2009-03-13 Thread Steve Odom

There are not any requests for my images showing up in my apache
access_log where I use an image_tag. If I handroll the image ref
like:



then it shows up fine. But if I use the image_tag helper like:

<%= image_tag "icons/add.gif" %>

..it gets rendered like:
http://localhost:3000/images/icons/add.gif?
1221425550" />

..and is broken as a result.

My stylesheet and js requests show up because I'm not using the rails
helpers (stylesheet_tag_link).

I used preference pane to set it up. I was under the impression I did
not have to add an entry in my /etc/hosts file.

This is a new macbook where I havent used webrick, mongrel, or thin.

Any ideas?

Steve

On Mar 13, 3:14 pm, Conrad Taylor  wrote:
> On Fri, Mar 13, 2009 at 1:01 PM, Steve Odom  wrote:
>
> > Just switched over to passenger for development and production for my
> > rails app. Liking it so far.
>
> > My problem is my image_links, stylesheet_tag_links, and
> > javascript_tag_links are all adding "http://localhost:3000to the
> > generated links. I got around the stylesheet and js links by not using
> > the helpers.
>
> > I can access my all of my assets directly via
> >http://dating.local/stylesheets/all.css,
> > for example.
>
> > I used passenger pref pane to render the vhost. It looks like:
> > 
> >  ServerName dating.local
> >  DocumentRoot "/Users/steveodom/Development/dating/public"
> >  RailsEnv development
> >  
> >    Order allow,deny
> >    Allow from all
> >  
> >  ErrorLog "/Users/steveodom/Development/dating/log/apache.log"
> > 
>
> > I'm not getting any errors in my development.log or apache error_log
>
> > Everything should be standard. I've experimented with ProxyPass's but
> > those didn't help.
>
> > I'm using passenger 2.0.6, rails 2.2.2
>
> > Any suggestions?
>
> > Thanks,
> > Steve
>
> Steve, do you have the following line in your vhosts file:
>
> NameVirtualHost *:80
>
> Also, did you add an entry in your /etc/hosts file to contain the following:
>
> 127.0.0.1 dating.local
>
> Last but not least, did you stop Mongrel, Webrick, or Thin?
>
> -Conrad
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Proble wuth form

2009-03-13 Thread Jose vicente Ribera pellicer

 I tried with:

 form_for [...@encuesta, @pregunta] do |f|
  <%= f.error_messages %>

   
 <%= f.label :texto %>
 <%= f.text_field :texto %>
   
...
  end

 The result is the same. I thinking that perhaps i can0t do "restful" 
forms :(
-- 
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] translating next and previous in will paginate

2009-03-13 Thread Shuaib85

Dear all

I was wondering how can i use i18n to translate next and previous in
the will paginate plugin

any idea

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



[Rails] Re: Proble wuth form

2009-03-13 Thread Jose vicente Ribera pellicer

Umm i have a problem.
my routes.rb :

map.resources :encuestas do |encuesta|
encuesta.resources :preguntas do |pregunta|
pregunta.resources :solucions
   end
 end

I can see perfecly the index of preguntas
Now I want to create a new pregunta.
My url->http://localhost:3000/encuestas/1/preguntas/new

In the preguntas's controller:

def index
@encuesta = Encuesta.find(params[:encuesta_id])
@preguntas = Pregunta.find(:all)

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


In the view of new pregunta:

form_for [...@encuesta, @preguntas] do |f|
 <%= f.error_messages %>

  
<%= f.label :texto %>
<%= f.text_field :texto %>
  
   ...
 end

Encuesta has 2 fields, titulo and descripcion. Both are strings
Pregunta has 3 fields, encusta_id and orden are integer and text is 
string.


This is the error message:

NoMethodError in Preguntas#new

Showing app/views/preguntas/new.html.erb where line #8 raised:

undefined method `texto' for #

Extracted source (around line #8):

5:
6:   
7: <%= f.label :texto %>
8: <%= f.text_field :texto %>
9:   
10:   
11: <%= f.label :encuesta_id %>



Encuesta doesn't has texto, texto is a field of preguntas. This form is 
for preguntas not for encuesta. Why is supossing that texto is a field 
of encuesta??
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: ruby capitalizing singular version of route

2009-03-13 Thread Freddy Andersen

What version of Rails/Ruby are you on?

Loading development environment (Rails 2.2.2)
>> "addresses".singularize
=> "address"
>> "routes".singularize
=> "route"

It works 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: rails, passenger, and images

2009-03-13 Thread Conrad Taylor
On Fri, Mar 13, 2009 at 1:01 PM, Steve Odom  wrote:

>
> Just switched over to passenger for development and production for my
> rails app. Liking it so far.
>
> My problem is my image_links, stylesheet_tag_links, and
> javascript_tag_links are all adding "http://localhost:3000 to the
> generated links. I got around the stylesheet and js links by not using
> the helpers.
>
> I can access my all of my assets directly via
> http://dating.local/stylesheets/all.css,
> for example.
>
> I used passenger pref pane to render the vhost. It looks like:
> 
>  ServerName dating.local
>  DocumentRoot "/Users/steveodom/Development/dating/public"
>  RailsEnv development
>  
>Order allow,deny
>Allow from all
>  
>  ErrorLog "/Users/steveodom/Development/dating/log/apache.log"
> 
>
> I'm not getting any errors in my development.log or apache error_log
>
> Everything should be standard. I've experimented with ProxyPass's but
> those didn't help.
>
> I'm using passenger 2.0.6, rails 2.2.2
>
> Any suggestions?
>
> Thanks,
> Steve


Steve, do you have the following line in your vhosts file:

NameVirtualHost *:80

Also, did you add an entry in your /etc/hosts file to contain the following:

127.0.0.1 dating.local

Last but not least, did you stop Mongrel, Webrick, or Thin?

-Conrad

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



[Rails] Re: rails, passenger, and images

2009-03-13 Thread Tom Z Meinlschmidt

look into apache access_log, if there any regular requests to the 
js/image/css files..

I'm using passenger too without any problems...

tom

Steve Odom wrote:
> Just switched over to passenger for development and production for my
> rails app. Liking it so far.
> 
> My problem is my image_links, stylesheet_tag_links, and
> javascript_tag_links are all adding "http://localhost:3000 to the
> generated links. I got around the stylesheet and js links by not using
> the helpers.
> 
> I can access my all of my assets directly via 
> http://dating.local/stylesheets/all.css,
> for example.
> 
> I used passenger pref pane to render the vhost. It looks like:
> 
>   ServerName dating.local
>   DocumentRoot "/Users/steveodom/Development/dating/public"
>   RailsEnv development
>   
> Order allow,deny
> Allow from all
>   
>   ErrorLog "/Users/steveodom/Development/dating/log/apache.log"
> 
> 
> I'm not getting any errors in my development.log or apache error_log
> 
> Everything should be standard. I've experimented with ProxyPass's but
> those didn't help.
> 
> I'm using passenger 2.0.6, rails 2.2.2
> 
> Any suggestions?
> 
> Thanks,
> Steve
-- 
===
Tomas Meinlschmidt, MS {MCT, MCP+I, MCSE, AER}, NetApp Filer/NetCache

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

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



[Rails] rails, passenger, and images

2009-03-13 Thread Steve Odom

Just switched over to passenger for development and production for my
rails app. Liking it so far.

My problem is my image_links, stylesheet_tag_links, and
javascript_tag_links are all adding "http://localhost:3000 to the
generated links. I got around the stylesheet and js links by not using
the helpers.

I can access my all of my assets directly via 
http://dating.local/stylesheets/all.css,
for example.

I used passenger pref pane to render the vhost. It looks like:

  ServerName dating.local
  DocumentRoot "/Users/steveodom/Development/dating/public"
  RailsEnv development
  
Order allow,deny
Allow from all
  
  ErrorLog "/Users/steveodom/Development/dating/log/apache.log"


I'm not getting any errors in my development.log or apache error_log

Everything should be standard. I've experimented with ProxyPass's but
those didn't help.

I'm using passenger 2.0.6, rails 2.2.2

Any suggestions?

Thanks,
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: New Browser Window using AJAX

2009-03-13 Thread Starr Horne

> Greg - this "works" but is flagged by popup blockers on IE and
> Firefox.  Any thoughts on methods around this?

I don't know if it helps, but I've noticed that browsers will let you open a 
window via JS, as long as the JS was called as a result of a user click. The 
exact same code will be blocked if it's called by a timer, or some other 
non-user source.

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


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



[Rails] unit test validate boolean

2009-03-13 Thread Michael Rigart

Hi,

How do you validate booleans? Normally, I validate them through

  validates_inclusion_of :is_root, :in => [false, true]

But when I test the :is_root attribute against a string, it passes. Here 
are some examples:

passes my test => [0, 1, true, false] (they should pass right?)
don't pass => [nil, '', ' '] (they shouldn't pass, so test is still ok)

passes my test => ['this is not valid' ,-1, 1.30 ,2, 10], but they 
shouldn't. Am I overlooking something, or is there still a bug in Rails 
2.3 RC2?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: ruby capitalizing singular version of route

2009-03-13 Thread Ben Lieber

Nevermind. I found a custom inflection that had been added by some other 
people on the project. 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: Starling Service

2009-03-13 Thread Freddy Andersen

#!/bin/sh
### BEGIN INIT INFO
# Provides:  starling
# Required-Start:$local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Default-Start: 2 3 4 5
# Default-Stop:  S 0 1 6
# Short-Description: starling initscript
# Description:   starling
### END INIT INFO
# Source function library.
. /etc/rc.d/init.d/functions



DAEMON=starling
DAEMON_PATH=/usr/local/bin/
SCRIPT_NAME=/etc/init.d/starling
CONFIG_PATH=/var/www/site/current/config/production-starling.yml

start()
{
echo -n $"Starting $DAEMON: "
daemon $DAEMON_PATH$DAEMON start -f $CONFIG_PATH

touch /var/lock/subsys/$DAEMON
echo
}

stop()
{
echo -n $"Shutting down $DAEMON: "
killproc $DAEMON

rm -f /var/lock/subsys/$DAEMON
echo
}
# Exit if the package is not installed
[ -x "$DAEMON_PATH$DAEMON" ] || exit 0

case "$1" in
  start)
start
;;
  stop)
stop
;;
  restart)
stop
start
;;
  *)
echo "Usage: $SCRIPT_NAME {start|stop|restart}" >&2
exit 3
;;
esac

:

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



[Rails] Re: Tables and Join

2009-03-13 Thread Rob Biedenharn

On Mar 13, 2009, at 12:55 PM, Shandy Nantz wrote:
> I have two tables - Account and Enpseudo. My accounts table has an
> enpseudo_id. I am trying to do an inner join on Enpseudo and keep
> getting this error:
>
> Association named 'account' was not found; perhaps you misspelled it?
>
> I imagine this means that I have the associations in my models sut-up
> wrong.
>
> In my Account model I have: belongs_to :enpseudo
>
> In my Enpseudo model I have: has_many :accounts
>
> Here is the code to my find:
>
> @accountsfrompseudo = Enpseudo.find( :all, :joins => :account,
>  :conditions => { :accounts => { :enpseudo_id =>  
> userpseudo.enpseudo_id
> }})
>
> userpseudo.enpseudo_id is a varible that I am getting from yet a third
> table that is just containing an enpseudo id.
>
> My question is do I have my models set-up correctly? If someone could
> point me to some references on rails and table set-up and  
> associations,
> that would be great too. Thanks,
>
> -S
> -- 


You almost have it.

@accountsfrompseudo = Enpseudo.find(userpseudo.enpseudo_id,
 :include => :accounts)

Or if your "third table" (assuming Userpseudo model)

class Userpseudo
   belongs_to :enpseudo
end

Then you get the same result with:

@accounts_from_pseudo = userpseudo.user.accounts


-Rob

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



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



[Rails] Re: Using LIKE

2009-03-13 Thread Philip Hallstrom

> Thanks, that makes things clearer. But how big is big? I don't plan on
> my app being hugely popular, but would thousands of entries be ok? Is
> there an area where LIKE starts to be really slow?

If it's a blog, I wouldn't think twice about using LIKE.  That is, I  
can't see a blog being big enough for it to become a problem.   
However, as other folks have said it definitely can be the source of  
problems down the road.

At that point you should look at one of the full text search engines  
like ferret, sphinx, solr, etc.

Also, just so you're aware LIKE in mysql is case-INSENSITIVE.  LIKE in  
PostgreSQL is case-SENSITIVE.

So when you're searching for names and are happy doing a LIKE '%ill%'  
to find those names below, keep in mind that won't work in  
PostgreSQL.  PostgreSQL has an ILIKE for that, but then that's not  
supported by MySQL.  PostgreSQL also has some regex pattern matching  
functions that are faster, but again I believe are postgres only.

Anyway, just something to keep in mind if you think your app might be  
run with different backends.

-philip




> On Mar 13, 11:06 am, Charles Johnson  wrote:
>> On Fri, Mar 13, 2009 at 12:42 PM, Mike C  wrote:
>>
>>> I've heard that using LIKE is very slow, but I see it being used a  
>>> lot
>>> in examples, blogs etc. Is it really that bad? Since Rails doesn't
>>> directly support Fulltext search, this is the easiest way to get
>>> searching done, right? Or are there any other easier ways? I'm using
>>> acts_as_indexed right now, but it still doesn't do what LIKE does.
>>
>> The problem with the sql "LIKE" is that it can render the use of an
>> index impossible. Imagine a search like:
>>
>> @users = User.find(:all, :conditions => "first_name like '%ILL%'")
>>
>> The database will have to find BILL, GILL, JILL, JILLIAN, etc. If  
>> you have a
>> few hundred or a few thousand users that may not be such an issue.  
>> Millions
>> of users makes this a different issue altogether. A full table scan  
>> is
>> needed, and what will you do with all those rows?
>>
>> The point is this, when you are tempted to use LIKE be sure the  
>> data set
>> searched and returned are small and that you try to other ways to  
>> constrain
>> the search.
>>
>> Cheers--
>>
>> Charles
> >


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



[Rails] Re: Managing ads banner

2009-03-13 Thread Philip Hallstrom

> Philip Hallstrom wrote:
>>> What is the best way to include ad banners in rails? Do you include
>>> them
>>> in default layout? What is the ideal way if the ad has to change  
>>> each
>>> time?
>>
>> My advice would be to not to do it.  Tie Rails into an existing ad
>> server.  You really don't want to have to write your own ad server if
>> you can avoid it.
>>
>> You may find this useful:
>> http://pjkh.com/articles/2006/12/21/integrating-openads-with-rails
>>
>> I'm assuming you want to sell your own banners, otherwise integrating
>> Google Adsense or similar is as simple as just dropping in the code.
>>
>> -philip
>
> Thank Philip.
>
> I was actually investigating both options, making my own or using
> adsense.Can you please share some information (or links) on how to
> integrate Adsense in my code?

Just drop the code into your views...

If you want to make it a bit more configurable, setup a simple admin  
tool where your ad guy can paste the adsense code into a text_area and  
then include that.  Add some keys so in your view you'd do something  
like:

<%= AdsenseCode.find_by_key("homepage_bottom_right") %>

Or similar.

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

2009-03-13 Thread Charles Johnson
On Fri, Mar 13, 2009 at 1:11 PM, Mike C  wrote:

>
> Thanks, that makes things clearer. But how big is big? I don't plan on
> my app being hugely popular, but would thousands of entries be ok? Is
> there an area where LIKE starts to be really slow?
>
Depending on the speed of your hardware and the performance of your database
I would look for other ways to search if you have more than a 1000 rows or
two. I have a postgres database here with an accounts table with 1810 rows.
A LIKE search for names like '%ce% returned no rows in 25 ms. I have a jobs
table with 5.3 million rows and the same search took 28 seconds to return no
rows.

Of course, if your database caches searches and you do the same
search repetitively  they will get faster and faster. I guess I would not
worry about a few thousand rows. Get you app working, passing all tests,
then worry about optimizations.

Cheers--

Charles

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



[Rails] Re: Using LIKE

2009-03-13 Thread Maurício Linhares

Likes are always slow if you must do a suffix match ( "%something" ),
as no index can handle that. But if you're doing a prefix match (
"something%" ) it won't be that bad.

And there's no "how big is big". You can have a slow app with a
thousand rows and a hundred queries per second, and you can have a
fast one with a million rows and a query per second. It all depends on
what you're doing.

Get a book on database optimization, all big databases have one, then
you'll undertand what's fast and what's slow about your database.

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



On Fri, Mar 13, 2009 at 3:11 PM, Mike C  wrote:
>
> Thanks, that makes things clearer. But how big is big? I don't plan on
> my app being hugely popular, but would thousands of entries be ok? Is
> there an area where LIKE starts to be really slow?
>
> On Mar 13, 11:06 am, Charles Johnson  wrote:
>> On Fri, Mar 13, 2009 at 12:42 PM, Mike C  wrote:
>>
>> > I've heard that using LIKE is very slow, but I see it being used a lot
>> > in examples, blogs etc. Is it really that bad? Since Rails doesn't
>> > directly support Fulltext search, this is the easiest way to get
>> > searching done, right? Or are there any other easier ways? I'm using
>> > acts_as_indexed right now, but it still doesn't do what LIKE does.
>>
>> The problem with the sql "LIKE" is that it can render the use of an
>> index impossible. Imagine a search like:
>>
>> @users = User.find(:all, :conditions => "first_name like '%ILL%'")
>>
>> The database will have to find BILL, GILL, JILL, JILLIAN, etc. If you have a
>> few hundred or a few thousand users that may not be such an issue. Millions
>> of users makes this a different issue altogether. A full table scan is
>> needed, and what will you do with all those rows?
>>
>> The point is this, when you are tempted to use LIKE be sure the data set
>> searched and returned are small and that you try to other ways to constrain
>> the search.
>>
>> Cheers--
>>
>> Charles
> >
>

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



[Rails] Re: Managing ads banner

2009-03-13 Thread Youyou Semsem

Philip Hallstrom wrote:
>> What is the best way to include ad banners in rails? Do you include  
>> them
>> in default layout? What is the ideal way if the ad has to change each
>> time?
> 
> My advice would be to not to do it.  Tie Rails into an existing ad
> server.  You really don't want to have to write your own ad server if
> you can avoid it.
> 
> You may find this useful: 
> http://pjkh.com/articles/2006/12/21/integrating-openads-with-rails
> 
> I'm assuming you want to sell your own banners, otherwise integrating
> Google Adsense or similar is as simple as just dropping in the code.
> 
> -philip

Thank Philip.

I was actually investigating both options, making my own or using 
adsense.Can you please share some information (or links) on how to 
integrate Adsense in my code?

Thanks,
Youssef
-- 
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 LIKE

2009-03-13 Thread Mike C

Thanks, that makes things clearer. But how big is big? I don't plan on
my app being hugely popular, but would thousands of entries be ok? Is
there an area where LIKE starts to be really slow?

On Mar 13, 11:06 am, Charles Johnson  wrote:
> On Fri, Mar 13, 2009 at 12:42 PM, Mike C  wrote:
>
> > I've heard that using LIKE is very slow, but I see it being used a lot
> > in examples, blogs etc. Is it really that bad? Since Rails doesn't
> > directly support Fulltext search, this is the easiest way to get
> > searching done, right? Or are there any other easier ways? I'm using
> > acts_as_indexed right now, but it still doesn't do what LIKE does.
>
> The problem with the sql "LIKE" is that it can render the use of an
> index impossible. Imagine a search like:
>
> @users = User.find(:all, :conditions => "first_name like '%ILL%'")
>
> The database will have to find BILL, GILL, JILL, JILLIAN, etc. If you have a
> few hundred or a few thousand users that may not be such an issue. Millions
> of users makes this a different issue altogether. A full table scan is
> needed, and what will you do with all those rows?
>
> The point is this, when you are tempted to use LIKE be sure the data set
> searched and returned are small and that you try to other ways to constrain
> the search.
>
> Cheers--
>
> Charles
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Using LIKE

2009-03-13 Thread Charles Johnson
On Fri, Mar 13, 2009 at 12:42 PM, Mike C  wrote:

>
> I've heard that using LIKE is very slow, but I see it being used a lot
> in examples, blogs etc. Is it really that bad? Since Rails doesn't
> directly support Fulltext search, this is the easiest way to get
> searching done, right? Or are there any other easier ways? I'm using
> acts_as_indexed right now, but it still doesn't do what LIKE does.

The problem with the sql "LIKE" is that it can render the use of an
index impossible. Imagine a search like:

@users = User.find(:all, :conditions => "first_name like '%ILL%'")

The database will have to find BILL, GILL, JILL, JILLIAN, etc. If you have a
few hundred or a few thousand users that may not be such an issue. Millions
of users makes this a different issue altogether. A full table scan is
needed, and what will you do with all those rows?

The point is this, when you are tempted to use LIKE be sure the data set
searched and returned are small and that you try to other ways to constrain
the search.

Cheers--

Charles

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



[Rails] Re: Understanding how methods are made available within controller tests

2009-03-13 Thread Karl Baum
Makes sense.  My only confusion is I thought that in ruby methods and
attributes can be imported to a class either through inheritance or
importing a module.  In this case, these extra attributes such as "session"
or "cookies" do not exist within the parent class nor the imported module.
 Is rails including extra modules within my classes at runtime?
Thanks for your help!

-karl

On Fri, Mar 13, 2009 at 5:53 AM, Frederick Cheung <
frederick.che...@gmail.com> wrote:

>
>
>
> On Mar 13, 3:38 am, Karl  wrote:
> > Being new to rails and ruby, I am trying to figure out how things fit
> > together.  In particular i am trying to understand how attributes such
> > as "session" and "cookies" are made available to Controller tests.
> > Specifically I am working on a test from the RailsSpace book which
> > extends Test::Unit::TestCase and only imports the module
> > ApplicationHelper while attributes such as cookies and session are
> > defined within the ActionController::TestProcess module.   I cannot
> > figure out how module ActionController::TestProcess is included within
> > the UserControllerTest.
>
> The test_helper file that you require at the top of your test file in
> turn requires a bunch of stuff, in particular a file that adds those
> methods to test cases.
>
> Fred
> >
> > require File.dirname(__FILE__) + '/../test_helper'
> > require 'user_controller'
> >
> > # Re-raise errors caught by the controller.
> > class UserController; def rescue_action(e) raise e end; end
> >
> > class UserControllerTest < Test::Unit::TestCase
> >   include ApplicationHelper
> >
> > ..
> > ..
> >  def authorize(user)
> > @request.session[:user_id] = user.id
> >   end
> >
> >   def friendly_url_forwarding_aux(test_page, protected_page, user)
> > get protected_page
> > assert_response :redirect
> > assert_redirected_to :action => "login"
> > post test_page, :user => user
> > assert_response :redirect
> > assert_redirected_to :action => protected_page
> > assert_nil session[:protected_page]
> >   end
> >
> >   def cookie_value(symbol)
> > cookies[symbol.to_s].value.first
> >   end
> >
> >   def cookie_expires(symbol)
> > cookies[symbol.to_s].expires
> >   end
> >
> > thx.
> >
> > -karl
> >
>

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



[Rails] Re: Which is the best way to do this? (about save time data

2009-03-13 Thread Charles Johnson
On Fri, Mar 13, 2009 at 11:27 AM, John Smith <
rails-mailing-l...@andreas-s.net> wrote:

>
> Thanks for your help, Charles. I appreciate it.
>
> What I want is the duration needed to complete a specific task. So when
> I have a lot of tasks, I will be able to search tasks width its
> durations is bigger that 2 hours and 10 minutes, for example. I don't
> care about days, monts of yearsM I only need the duration.
> So, should I use a Datetime in order to make search easy?
>
> Again, thanks a lot.
>
 Because you want a duration rather than a specific time, I would convert
hours and minutes to pure minutes and save that integer. That would make the
searching easy and fast: @tasks = Task.find(:all, :order => :start_date,
:conditions => 'duration >= 190') or some such.

Cheers--

Charles

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



[Rails] Using LIKE

2009-03-13 Thread Mike C

I've heard that using LIKE is very slow, but I see it being used a lot
in examples, blogs etc. Is it really that bad? Since Rails doesn't
directly support Fulltext search, this is the easiest way to get
searching done, right? Or are there any other easier ways? I'm using
acts_as_indexed right now, but it still doesn't do what LIKE does.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Starling Service

2009-03-13 Thread TomRossi7

Does anyone know a graceful way to stop the Starling service?  I can't
seem to find any documentation and have just been issuing a kill
command on the pid.

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: Proble wuth form

2009-03-13 Thread Jose vicente Ribera pellicer

Sumanth Krishna wrote:
> Hey,
> 
>   Please refer to correct usage of form_for:
> API: 
> http://api.rubyonrails.org/classes/ActionView/Helpers/FormHelper.html
> with examples:
> http://apidock.com/rails/ActionView/Helpers/FormHelper/form_for
> 
> On Fri, Mar 13, 2009 at 1:21 PM, Jose vicente Ribera pellicer <
> rails-mailing-l...@andreas-s.net> wrote:
> 
>> <%- end -%>
>> Extracted source (around line #10):
>>
>>
>> >
>>
> 
> 
> --


Partially solved.

 <%- end -%> was write, but i didń copy it.

Thanks a lot
-- 
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: bad model name

2009-03-13 Thread Philip Hallstrom

> I created model named "whats_new".
>
> $ script/generate model whats_new
>  exists  app/models/
>  exists  test/unit/
>  exists  test/fixtures/
>  create  app/models/whats_new.rb
>  create  test/unit/whats_new_test.rb
>  create  test/fixtures/whats_news.yml
>  exists  db/migrate
>  create  db/migrate/*_create_whats_news.rb
>
> -
>
> rake db:migrate
> WhatsNew.find()
> WhatsNew.new
>
> There are no problem.
>
> However,
> test/unit/whats_new_test.rb
> -
> whats_news(:data1)
> -
> => "No class attached to find."
>
> ---
> class Fixtures
> ...
> ...
> def initialize
> ...
> @class_name = class_name ||
>  (ActiveRecord::Base.pluralize_table_names ?
> @table_name.singularize.camelize : @table_name.camelize)
> p @class_name
> ...
> end
> end
> ---
> => "WhatsNews"
> A true class name is "WhatsNew".
>
> @table_name == "whats_news"
>
>>> "whats_news".singularize.camelize
> => "WhatsNews"
>>> "whats_new".pluralize.singularize
> => "whats_news"
>
> By the way, I cannot speak English...

In english, 'news' is both singular and plural.  A single news item is  
still called 'news' not 'new'.

Two choices for you..

- Add your own inflection so that 'news' is singularlized to 'news'.
- Change your class name.

-philip



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



[Rails] Re: Tables and Join

2009-03-13 Thread Shandy Nantz

I tried enpseudo.accounts to make sure that association was working and 
it was. I ended up doing straight sql to get what I needed, but I 
thought learning how to do it the rails way would be interesting.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Managing ads banner

2009-03-13 Thread Philip Hallstrom

> What is the best way to include ad banners in rails? Do you include  
> them
> in default layout? What is the ideal way if the ad has to change each
> time?

My advice would be to not to do it.  Tie Rails into an existing ad  
server.  You really don't want to have to write your own ad server if  
you can avoid it.

You may find this useful: 
http://pjkh.com/articles/2006/12/21/integrating-openads-with-rails

I'm assuming you want to sell your own banners, otherwise integrating  
Google Adsense or similar is as simple as just dropping in the code.

-philip

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



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

2009-03-13 Thread marshall ruiters
I  DO NOT MARSHALL

   1. [?][?]

On Fri, Mar 13, 2009 at 5:04 PM, Robert Walker <
rails-mailing-l...@andreas-s.net> wrote:

>
> Brian Hogan wrote:
> > @Robert:
> >
> > I totally agree with your approach. I was merely stating how the
> > requested goal could be achieved. As web experts, you and I understand
> > how the web works and how users perceive things, but our clients often
> > demand that we do things in different ways.
>
> @Brian. Yes, thanks for pointing that out. As developers we often do
> things we don't completely agree with in order to satisfy the needs and
> wants of our clients.
> --
> 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] bad model name

2009-03-13 Thread tned

I created model named "whats_new".

$ script/generate model whats_new
  exists  app/models/
  exists  test/unit/
  exists  test/fixtures/
  create  app/models/whats_new.rb
  create  test/unit/whats_new_test.rb
  create  test/fixtures/whats_news.yml
  exists  db/migrate
  create  db/migrate/*_create_whats_news.rb

-

rake db:migrate
WhatsNew.find()
WhatsNew.new

There are no problem.

However,
test/unit/whats_new_test.rb
-
whats_news(:data1)
-
=> "No class attached to find."

---
class Fixtures
 ...
 ...
 def initialize
 ...
@class_name = class_name ||
  (ActiveRecord::Base.pluralize_table_names ?
@table_name.singularize.camelize : @table_name.camelize)
p @class_name
 ...
 end
end
---
=> "WhatsNews"
A true class name is "WhatsNew".

@table_name == "whats_news"

>> "whats_news".singularize.camelize
=> "WhatsNews"
>> "whats_new".pluralize.singularize
=> "whats_news"

By the way, I cannot speak English...

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



[Rails] Re: Model belongs_to

2009-03-13 Thread "Wolas!"

short answer is no. for several reasons:

1) Rails find methods select all columns by default, and by taking the
belongs_to out of the class (which is how i assume u want to "diasble"
it) it will still include the attribute customer_id it in the results.

2) Rails doesnt load associated objects by default unless you
explicitely tell it to with the :include switch so:

order = Order.first   => will give you a new Order(customer_id, ...)
but the customer it is assocuiated with will not be there! just the
reference (id:integer). if i then go order.customer, you will see
another select in the logs

Order.first(:include => :customer) will load the customer as well. so
if i then go order.customer, the db is not touched again because i
already loaded it.


If you want to speed thing up (a very tiny little bit) check out what
methods you are calling in order and only select the attributes you
will use. so for example, if you are only marking it complete you can
do something like:

order = Order.first(:select => :completed)
order.update_attributes :completed => true
order.save

beware that if you (by mistake) need a attribute you have not loaded
rails will raise an AttributeNotFound (i think is the name) exception

as a sidenote, it is wise not to perform optimisations untill you
profile your program as a whole. so as a rule of thumb, od it the
simple stupid way first, then gather stats of how your software is
ebing used and then optimise on the most comonly used functions. If
not, you might end up spending hours optimising a function that is
only called once or twice a month.

On Mar 13, 5:35 pm, Fresh Mix 
wrote:
> If I have in Order -model row: belongs_to :customer it joins two tables
> and show customers information. But if I don't need user informatioan,
> can I temporarily disable  it and speed up "select"?
> --
> 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] ruby capitalizing singular version of route

2009-03-13 Thread Ben Lieber

Hi All,

I've searched on this topic and can't seem to find anyone results saying
others have had the same problem, so hope someone here can help.

if in routes, I map addresses:
map.resources :addresses

If get the following routes:
addresses
new_Address
edit_Address

Note that the singular routes (new, edit) are capitalized.

to prove the issue, in console, I can type:
>> "addresses".singularize
=> "Address"

and you see it doesn't happen with a word that doesn't require more than
stripping the 's':
>> "routes".singularize
=> "route"

this makes it impossible to use 'form_for @address', etc because it
produces lowercase route call that don't match.

Thanks for any help!

-Ben
-- 
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] Tables and Join

2009-03-13 Thread Shandy Nantz

I have two tables - Account and Enpseudo. My accounts table has an
enpseudo_id. I am trying to do an inner join on Enpseudo and keep
getting this error:

Association named 'account' was not found; perhaps you misspelled it?

I imagine this means that I have the associations in my models sut-up
wrong.

In my Account model I have: belongs_to :enpseudo

In my Enpseudo model I have: has_many :accounts

Here is the code to my find:

@accountsfrompseudo = Enpseudo.find( :all, :joins => :account,
  :conditions => { :accounts => { :enpseudo_id => userpseudo.enpseudo_id
}})

userpseudo.enpseudo_id is a varible that I am getting from yet a third
table that is just containing an enpseudo id.

My question is do I have my models set-up correctly? If someone could
point me to some references on rails and table set-up and associations,
that would be great too. Thanks,

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

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



[Rails] Managing ads banner

2009-03-13 Thread Youyou Semsem

Hi guys,

What is the best way to include ad banners in rails? Do you include them
in default layout? What is the ideal way if the ad has to change each
time?

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] Model belongs_to

2009-03-13 Thread Fresh Mix

If I have in Order -model row: belongs_to :customer it joins two tables
and show customers information. But if I don't need user informatioan,
can I temporarily disable  it and speed up "select"?
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Which is the best way to do this? (about save time data

2009-03-13 Thread John Smith

Thanks for your help, Charles. I appreciate it.

What I want is the duration needed to complete a specific task. So when 
I have a lot of tasks, I will be able to search tasks width its 
durations is bigger that 2 hours and 10 minutes, for example. I don't 
care about days, monts of yearsM I only need the duration.
So, should I use a Datetime in order to make search easy?

Again, thanks a lot.

Charles Johnson wrote:
> On Fri, Mar 13, 2009 at 8:00 AM, John Smith <
> rails-mailing-l...@andreas-s.net> wrote:
> 
>>
>> I think that select_hour(0) and select_minute(0) it's what I need. I
>> just want to save the time it's needed to complete a task, so I only
>> need to select and hour and minutes. How should I save this? Like a
>> string or like a datetime? I think it would b better datetime, because I
>> want to search by this time. But then I think I should need to create a
>> datetable using two fields, select_hour and select_minute. Is it
>> correct?
>> --
>>
> As I said, this depends on what you are wanting to record. For me, if I 
> were
> interested in something like "On this date I worked on  task-1 for 3 
> hours
> and 37 minutes,  and task-2 for 2 hours and 7 minutes" I would be 
> recording
> a date, and then I would convert "hours" and "minutes" to just minutes 
> (3
> hours and 37 minutes = 217 minutes) and save the date and the total 
> minutes.
> All of the Date, DateTime, and Time objects in ruby are related to a
> calendar, i.e., the want a date and a specific time, not a date and a
> duration, which seems to me what you are after. Make sense?
> 
> Cheers--
> 
> Charles

-- 
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] Rails Genarator Destroy

2009-03-13 Thread Kivanio Barbosa

Hi,

I created a custom generator, but i won't some files deleted when i
call "script/destroy".

So, i'm trying undesrtand how don't delete a specific file generated.

When i call "script/destroy" It's destroying everything that was
created by "script/generate".

Anyone know about some option to skip file be deleted? or a way to skip it?


Kivanio Barbosa
Cel 8121-4248

Blog: www.kivanio.com.br
Company: www.eiqconsultoria.com.br

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



[Rails] pb rails require 'htmldoc'

2009-03-13 Thread Babiben Aaa

Salut,

  J'ai un petit problème (encore!!! Et oui...) cette fois-ci avec
htmldoc.
J'essaye de générer un fichier pdf avec rails (dans Netbeans 6.5) et
j'obtiens toujours le message d'erreur suivant "no such file to load --
htmldoc".

Apparemment, il ne tient pas compte de mon "require 'htmldoc'" ?
-- 
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: updating git-installed plugin

2009-03-13 Thread Zac Zheng

> 
> I do
> 
> script/plugin install --force 

Thanks for the reply Craig.

>From reading the command name 'script/plugin update', it sounded like it 
would update plugins! ah well.
-- 
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: New Browser Window using AJAX

2009-03-13 Thread DPF



Greg - this "works" but is flagged by popup blockers on IE and
Firefox.  Any thoughts on methods around this?
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: gem install blackbook on centos error

2009-03-13 Thread Frederick Cheung



On Mar 13, 1:37 pm, Jeba Momin 
wrote:
> Charles Johnson wrote:
> > On Fri, Mar 13, 2009 at 8:11 AM, Jeba Momin <
> > rails-mailing-l...@andreas-s.net> wrote:
>
> > Exactly the same error message? (Sorry about asking that.)
>
> > Cheers--
>
> > Charles
>
> Yes..exactly the same error message
> And I don't have the privileges to install YUM on the m/c.
> So can't even do that...

I know nothing about centos, but did you just install the libraries or
did you also install the associated development headers (they are
frequently split out into separate packages eg libfoo and libfoo-dev
or libfoo-devel)

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



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

2009-03-13 Thread Robert Walker

Brian Hogan wrote:
> @Robert:
> 
> I totally agree with your approach. I was merely stating how the
> requested goal could be achieved. As web experts, you and I understand
> how the web works and how users perceive things, but our clients often
> demand that we do things in different ways.

@Brian. Yes, thanks for pointing that out. As developers we often do 
things we don't completely agree with in order to satisfy the needs and 
wants of our clients.
-- 
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: Making the 'Back' link look the same as form.submit "Sa

2009-03-13 Thread Brian Hogan

@Robert:

I totally agree with your approach. I was merely stating how the
requested goal could be achieved. As web experts, you and I understand
how the web works and how users perceive things, but our clients often
demand that we do things in different ways.


On Fri, Mar 13, 2009 at 9:25 AM, Robert Walker
 wrote:
>
> Brian Hogan wrote:
>> I have found that the best solution to this problem is to use an image
>> button for the submit button, and then use css to apply the same image
>> to the back link. It's accessible and requires no javascript.
>
> That's not a bad approach. It would be one way to get a consistent look,
> although not a platform specific look. However, recently I've taken the
> up the practice that I see a lot of Rails developers using: I just
> accept the web by using a standard submit button, and standard
> hyperlink. Then I try to design my pages around that concept.
>
> There already exists a "mental model" around form buttons and
> hyperlinks. Trying to hide the differences between them behind a visual
> facade can actually work against the existing "mental model." Making a
> link look like a button might actually be more confusing. For example
> when I see a link I know right away that clicking it will simply take me
> to another page. It won't submit any information related to the form. At
> least that's the expected behavior.
>
> The "mental model," however, can be broken in a number of different
> ways. For example, it is possible to attach a script to a link that does
> actually submit information from the form, or change some state on the
> server.
> --
> 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: Coding standards

2009-03-13 Thread Phlip

> Can you clarify this? I don't quite understand, but it looks intriguing.

Don't do this:

   unless good_thing
 bad_path
   else
 good_path
   end

Do this:

   if good_thing
 good_path
   else
 bad_path
   end

The condition should almost always use an 'if', should always state its intent 
positively, and should always put the happy path above the sad path.

Similarly, don't:

   return unless good_thing

Do:

   good_thing or return



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



[Rails] Re: Coding standards

2009-03-13 Thread Phlip

Brandon Olivares wrote:

> The only thing I question is that it says always to include the parentheses
> around parameter lists. I tend to do the very opposite, only including
> parentheses when absolutely necessary. I think Phlip said something similar?
> Unless I totally misunderstood.

Omit the top-level parens. You need the rest, to disambiguate.

   p call_method(with, args)

The p is the top-level method.


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



[Rails] Re: Coding standards

2009-03-13 Thread Phlip

>> http://www.caliban.org/ruby/rubyguide.shtml#style?  If so I will follow
> 
> I got 4 lines into this document and my brain threw a fatal exception 
> after this statement:
> 
> "header block with author's name, Perforce Id tag..."
> 
> When I saw "Perforce Id," I stopped processing the document.

Does the document say to unit test everything? Does Java's Official guide say 
that?


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



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

2009-03-13 Thread Robert Walker

Brian Hogan wrote:
> I have found that the best solution to this problem is to use an image
> button for the submit button, and then use css to apply the same image
> to the back link. It's accessible and requires no javascript.

That's not a bad approach. It would be one way to get a consistent look, 
although not a platform specific look. However, recently I've taken the 
up the practice that I see a lot of Rails developers using: I just 
accept the web by using a standard submit button, and standard 
hyperlink. Then I try to design my pages around that concept.

There already exists a "mental model" around form buttons and 
hyperlinks. Trying to hide the differences between them behind a visual 
facade can actually work against the existing "mental model." Making a 
link look like a button might actually be more confusing. For example 
when I see a link I know right away that clicking it will simply take me 
to another page. It won't submit any information related to the form. At 
least that's the expected behavior.

The "mental model," however, can be broken in a number of different 
ways. For example, it is possible to attach a script to a link that does 
actually submit information from the form, or change some state on the 
server.
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Re: Is Mongrel dead?

2009-03-13 Thread bcardarella

I don't see mongrel going anywhere any time soon. True, Passenger is
the way to go for production but for development mode mongrel is the
clear winner. Who wants to setup an Apache instance and edit config
files for every new project in development?

- Brian Cardarella

On Mar 12, 12:19 pm, Gene Gene 
wrote:
> Is Mongrel dead? When I look athttp://mongrel.rubyforge.org/wiki/News
> the latest news was from close to a year ago, when last version of
> Mongrel was released. A look at the tickets shows a rather sad picture
> with only two developers “evanweaver” and “luislavena” contributing to
> the bug fixes lately.
>
> Please understand that I am not complaining – I just want to know the
> situation so that I can make intelligent decision on the long term
> viability of Mongrel as an application server. I realize that it is a
> community project  and if more people (including myself) would put in
> more effort things would be different. However, as it stands now, I am
> not able to contribute due to the lack of knowledge and time. This is a
> normal case of an open source software and, as I said, I am not
> complaining. Still, I would like to understand the long term
> implications of using Mongrel.
>
> I know there is Phusion aka mod_rails. However, as it stands right now,
> the company is not a truly “for profit” company and relies on donations
> and consulting in installing mod_rails. Amount of dollars coming in for
> installation consulting is probably questionable since installation is
> fairly simple. The folks behind mod_rails hit the nail on the head
> however, when they introduced “Passenger Enterprise License”.  Folks
> responsible for strategic long term decisions regarding technology need
> to be sure that the company won’t be left high and dry when Mogrel
> drowns (just look at that picture onhttp://mongrel.rubyforge.org/wiki-
> poor Fluffy is drowining). Rails proved to be a viable framework, that
> survived time test (although I would certainly prefer to see less
> frequent version releases). However, I am puzzled by the lack of
> interest in offering a commercial app server for Rails. There is
> certainly room for such a thing. Folks like me would rather pay XYZ
> dollars for a license, get phone support, etc. as oppose to  get free
> Mongrel and keep my fingers crossed that new Ruby patch does not break
> it to pieces like it did last year. I know that there is a number of
> companies that use Rails regardless. However, the number would be bigger
> if there were more commercial tools, especially servers. If you look
> into Java world you will see that there is a reason why Weblogic
> successfully competes with free JBoss, Tomcat, and Glassfish.
>
> …but I digress… So is Mongrel dead? Is there a commercial app server for
> Rails?
>
> TPM
>
> P.S. am intentionally posting this in the Rails forum as oppose to
> Mongrel forum or Deployment form, because I would like to hear from a
> wider audience and also let the wider audience see this thread. I think
> it is very important to the Rails community as it grows and as Rails
> tries to be on the par with Java and .Net in large corporations. Some
> indication where Ruby / Rails are can be gleaned from 
> here:http://www.tiobe.com/index.php/content/paperinfo/tpci/index.html
> --
> Posted viahttp://www.ruby-forum.com/.
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: how to intregrate authorised.net with rails application

2009-03-13 Thread Nils o. Janus

Anshali Dhande wrote:
> Hi All,
> Please help me out for this issue
> Issue is:" how to integrate authorised.net with rails application:
> thanks

Check to works of Cody Fauser for this at http://www.activemerchant.org/

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

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



[Rails] Re: how to intregrate authorised.net with rails application

2009-03-13 Thread Jeff

On Mar 13, 8:22 am, Anshali Dhande 
wrote:
> Hi All,
> Please help me out for this issue
> Issue is:" how to integrate authorised.net with rails application:
> thanks
> --
> Posted viahttp://www.ruby-forum.com/.

http://lmgtfy.com/?q=authorize.net+rails


Jeff

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



[Rails] Re: Helpers in Models

2009-03-13 Thread Robert Walker

Rudi W. wrote:
>Therefore I've started investigating how I can accesss my helpers in my
>model - I know this is not best practise, but its the only way I can see
>to make this work.

So your idea here is to fix a bad practice by using an even worse 
practice?

> How do I reach my helpers in the model in a more efficient way?
> Or can I construct my code in a more correct way?

Dealing with languages is a view specific tasks. Models should not be 
concerned with language specific issues, In my view the pain this is 
giving you should be viewed like a "toothache." Your code is trying to 
tell you something is fundamentally wrong. Using pain relievers, might 
get you by for a time, but eventually the problem will need to be 
addresses at the source.

However, if you have code that needs to be shared between the MVC layers 
it's common practice to put that code in modules inside the lib 
directory, which is provided for just this sort of sharing. That doesn't 
mean, however, that lib is intended to be a "free zone" where rules of 
MVC don't matter and you're free to break it at will.
-- 
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: Coding standards

2009-03-13 Thread Brandon Olivares



> -Original Message-
> From: rubyonrails-talk@googlegroups.com [mailto:rubyonrails-
> t...@googlegroups.com] On Behalf Of Phlip
> Sent: Friday, March 13, 2009 8:42 AM
> To: rubyonrails-talk@googlegroups.com
> Subject: [Rails] Re: Coding standards
> That notation looks unfamiliar, and it saves a couple of lines -
> without
> cramming. It also obeys the perfectly universal coding standard,
> "Always promote
> the positive path thru a method, and demote the negative or failing
> path. Make
> the failing path low or to the right, and run the positive path down
> along the
> left."

Can you clarify this? I don't quite understand, but it looks intriguing.

Brandon


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



[Rails] Re: Coding standards

2009-03-13 Thread Brandon Olivares

Hi,
I
'm rather new to Ruby, but most of what it mentions seems similar to what
I've seen so far.

The only thing I question is that it says always to include the parentheses
around parameter lists. I tend to do the very opposite, only including
parentheses when absolutely necessary. I think Phlip said something similar?
Unless I totally misunderstood.

So I guess that's my question to everyone else: do you include parenthesis
around arguments or not?

Brandon

> -Original Message-
> From: rubyonrails-talk@googlegroups.com [mailto:rubyonrails-
> t...@googlegroups.com] On Behalf Of John Fletcher
> Sent: Friday, March 13, 2009 7:10 AM
> To: rubyonrails-talk@googlegroups.com
> Subject: [Rails] Coding standards
> 
> One thing I really like about Java compared to PHP is that there's an
> official coding standard. This is because I don't really mind which
> standard I use, I just want to be told what to do and have the highest
> likelihood that other code I encounter in that language will use a
> standard that I'm used to.
> 
> 
> 
> Bearing that in mind... I'm starting to learn Ruby and noticed there
> doesn't appear to be an official coding standard, nor for Rails. This
> document basically claims to be a de facto standard, is that true
> http://www.caliban.org/ruby/rubyguide.shtml#style?  If so I will follow
> their conventions. Or is there a better resource? Is the community
> fairly consistent in their coding style?  I find the Java community is
> fairly consistent, the PHP community rather the opposite.
> 
> 
> 
> Regards,
> 
> John
> 
> 
> > 



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



[Rails] Re: gem install blackbook on centos error

2009-03-13 Thread Jeba Momin

Charles Johnson wrote:
> On Fri, Mar 13, 2009 at 8:11 AM, Jeba Momin <
> rails-mailing-l...@andreas-s.net> wrote:
> 
>>
> Exactly the same error message? (Sorry about asking that.)
> 
> Cheers--
> 
> Charles

Yes..exactly the same error message
And I don't have the privileges to install YUM on the m/c.
So can't even do that...
-- 
Posted via http://www.ruby-forum.com/.

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



[Rails] Helpers in Models

2009-03-13 Thread Rudi W.

I have an app that relies on a series of helpers to generate language
specific text strings for all output.

In one of my models I have to save one of these language specific
strings to the table.
Therefore I've started investigating how I can accesss my helpers in my
model - I know this is not best practise, but its the only way I can see
to make this work.

I know of the solution with including the helper in the model like this:

 class Employee < ActiveRecord::Base
   include LanguageHelper
 end

But this is not that good performance wise?

How do I reach my helpers in the model in a more efficient way?
Or can I construct my code in a more correct way?

Best regards
Rudi
-- 
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: Playing videos

2009-03-13 Thread Martin Hawkins

Excellent, thank you, just what I needed.

On Mar 13, 1:06 pm, Sean McGilvray  wrote:
> Go to flowplayer.org. You can easily integrate this player which will  
> work with avi files. You can program it to your hearts desire. I am  
> using it in a similar fasion on my site.
>
> Sean McGilvray
>
> Sent from my iPhone
>
> On Mar 13, 2009, at 2:33 AM, Martin Hawkins   
> wrote:
>
>
>
> > My app needs to play videos. They are stored in a huge library and are
> > all about 2mb in size. They are avi files.
> > The user enters criteria which selects the appropriate videos and I
> > need to offer a playlist.
> > Playing one at a time offers no problem - just use send_file and the
> > file gets downloaded and played.
>
> > My problem is that I need to offer the play_list. Preferably, I need
> > to start the download of the list of files and get the player working
> > on the first one while the others are downloading.
> > I can't get that to happen using send_file - it only works on one file
> > at time.
>
> > Does anybody have any bright ideas for me?
> > thanks
> > Martin
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Select forms

2009-03-13 Thread johnsonmlw

Perhaps I'm thinking a bit 'php' about this. What I'm trying to do
doesn't seem to be very 'rails' so I could use some guidance.

I'd like to provide filters on data before rendering a table, and I'm
thinking that select drop-downs on a form would be one way to achieve
this. The user could drop-down select the data to see (in this case
for example, selecting English assessment results, or Reading, or
Maths; then another select drop-down to select the group of pupils (by
cohort), then another for selecting gender, etc. This could all be
selected on one form, then submitted and I'd like the page to reload
and render the relevant data. This is the way I would handle it in
php. But I suspect there maybe a better way in rails?

Could someone assist my thinking please?

Thanks.

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



[Rails] Re: gem install blackbook on centos error

2009-03-13 Thread Charles Johnson
On Fri, Mar 13, 2009 at 8:11 AM, Jeba Momin <
rails-mailing-l...@andreas-s.net> wrote:

>
> Thanks for replying...
> I dont have YUM installed on my m/c so I did..
> up2date install libxslt
>
> It worked fine and installed successfully.
> But while doing
> gem install blackbook
> I get exactly the same error again...!!!   :(
> Where am I going wrong???
>
Exactly the same error message? (Sorry about asking that.)

Cheers--

Charles

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



[Rails] how to intregrate authorised.net with rails application

2009-03-13 Thread Anshali Dhande

Hi All,
Please help me out for this issue
Issue is:" how to integrate authorised.net with rails application:
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: Which is the best way to do this? (about save time data)

2009-03-13 Thread Charles Johnson
On Fri, Mar 13, 2009 at 8:00 AM, John Smith <
rails-mailing-l...@andreas-s.net> wrote:

>
> I think that select_hour(0) and select_minute(0) it's what I need. I
> just want to save the time it's needed to complete a task, so I only
> need to select and hour and minutes. How should I save this? Like a
> string or like a datetime? I think it would b better datetime, because I
> want to search by this time. But then I think I should need to create a
> datetable using two fields, select_hour and select_minute. Is it
> correct?
> --
>
As I said, this depends on what you are wanting to record. For me, if I were
interested in something like "On this date I worked on  task-1 for 3 hours
and 37 minutes,  and task-2 for 2 hours and 7 minutes" I would be recording
a date, and then I would convert "hours" and "minutes" to just minutes (3
hours and 37 minutes = 217 minutes) and save the date and the total minutes.
All of the Date, DateTime, and Time objects in ruby are related to a
calendar, i.e., the want a date and a specific time, not a date and a
duration, which seems to me what you are after. Make sense?

Cheers--

Charles

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



[Rails] Re: Something crazy with rake test

2009-03-13 Thread Bob Mundane

This is a bug.

Described here
http://rails.lighthouseapp.com/projects/8994/tickets/1878-a-generated-plugins-tests-are-not-run-by-rake-test

The generated test_helper.rb file is faulty

Solution is to
require 'test/unit' at the top of test_helper.rb

-- 
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: Coding standards

2009-03-13 Thread Robert Walker

John Fletcher wrote:
> http://www.caliban.org/ruby/rubyguide.shtml#style?  If so I will follow

I got 4 lines into this document and my brain threw a fatal exception 
after this statement:

"header block with author's name, Perforce Id tag..."

When I saw "Perforce Id," I stopped processing the document.
-- 
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: gem install blackbook on centos error

2009-03-13 Thread Jeba Momin

Charles Johnson wrote:

> So, did you try what the error suggested? Did you do  'yum install 
> libxslt'
>  ?
>Charles

Thanks for replying...
I dont have YUM installed on my m/c so I did..
up2date install libxslt

It worked fine and installed successfully.
But while doing
gem install blackbook
I get exactly the same error again...!!!   :(
Where am I going wrong???

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: not logged in in subdomain?

2009-03-13 Thread phil

thanks! I was missing the .
I'll give that a try


On Mar 12, 2:00 pm, Starr Horne  wrote:
> On Thu, 12 Mar 2009 04:38:15 -0700 (PDT)
>
> phil  wrote:
>
> > For some reason my users get logged out when they switch to a
> > subdomain.
>
> You need to specify a wildcard domain for your auth cookie. The default is to 
> use the entire domain.
>
> Here's a blog post explaining how:
>
> http://szeryf.wordpress.com/2008/01/21/cookie-handling-in-multi-domai...
>
> SH
>
> --
> Starr Horne
> My blog:http://starrhorne.com
> Check out my Helpdesk RailsKit:http://railskits.com/helpdesk/
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com
To unsubscribe from this group, send email to 
rubyonrails-talk+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~--~~~~--~~--~--~---



[Rails] Re: Playing videos

2009-03-13 Thread Sean McGilvray

Go to flowplayer.org. You can easily integrate this player which will  
work with avi files. You can program it to your hearts desire. I am  
using it in a similar fasion on my site.

Sean McGilvray

Sent from my iPhone

On Mar 13, 2009, at 2:33 AM, Martin Hawkins   
wrote:

>
> My app needs to play videos. They are stored in a huge library and are
> all about 2mb in size. They are avi files.
> The user enters criteria which selects the appropriate videos and I
> need to offer a playlist.
> Playing one at a time offers no problem - just use send_file and the
> file gets downloaded and played.
>
> My problem is that I need to offer the play_list. Preferably, I need
> to start the download of the list of files and get the player working
> on the first one while the others are downloading.
> I can't get that to happen using send_file - it only works on one file
> at time.
>
> Does anybody have any bright ideas for me?
> thanks
> Martin
> >

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



[Rails] Re: gem install blackbook on centos error

2009-03-13 Thread Charles Johnson
On Fri, Mar 13, 2009 at 4:07 AM, Jeba Momin <
rails-mailing-l...@andreas-s.net> wrote:

>
> Hello,
> I'm trying to install the blackbook gem on my m/c with centos , but i
> get the following error:
> Building native extensions.  This could take a while...
> ERROR:  Error installing blackbook:
>ERROR: Failed to build gem native extension.
>
> /opt/ruby-enterprise-1.8.6-20090201/bin/ruby extconf.rb install
> blackbook
> checking for #include 
> ... yes
> checking for #include 
> ... no
> libxslt is missing.  try 'port install libxslt' or 'yum install libxslt'
> *** extconf.rb failed ***
> Could not create Makefile due to some reason, probably lack of
> necessary libraries and/or headers.  Check the mkmf.log file for more
> details.  You may need configuration options.


So, did you try what the error suggested? Did you do  'yum install libxslt'
 ?

Cheers--

Charles

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



[Rails] Re: Which is the best way to do this? (about save time data)

2009-03-13 Thread John Smith

I think that select_hour(0) and select_minute(0) it's what I need. I 
just want to save the time it's needed to complete a task, so I only 
need to select and hour and minutes. How should I save this? Like a 
string or like a datetime? I think it would b better datetime, because I 
want to search by this time. But then I think I should need to create a 
datetable using two fields, select_hour and select_minute. Is it 
correct?
-- 
Posted via http://www.ruby-forum.com/.

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



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

2009-03-13 Thread Vrishali....

ok...

I got the solution by myself

now i am using the code...

@companies.each do |company|
places  [ {:address => company.addr, :description =>
company.cname , :image => company.img}]
end

it is working without ant error...


but now the problem is that .

the values are getting overwritted in places array...and only last
record is saved...


so what can i do for increamenting places index...


or anybody knows any another method

please help 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: update_attributes and validation

2009-03-13 Thread Sumanth Krishna
try with update_attributes! (which internally uses 'save!')

On Fri, Mar 13, 2009 at 2:00 PM, Nilesh Kulkarni <
rails-mailing-l...@andreas-s.net> wrote:

>
> hi all,
>
>
>I am updating 50 records on one page with update_attributes method
> ,my validations are
>
>
> validates_numericality_of :year, :greater_than_or_equal_to => 1900,
> :less_than_or_equal_to => 2028,  :message => "Year must be between 1900
> and 2028"
> valdate_presence_of:title
> valdate_presence_of:price
>
> id title   yearprice
> 1  James bond  2008  $100
> 2  zoro the mask   1978  $ 50
> .
> .
> .
> .
> 50  don2000 $400
>
> if I provide wrong input for one say year "1800" for "don" and correct
> for "james bond" year as "2000" it updates James bond ,correctly but do
> not show validation message for "don" on my page. I want to display
> message how can i do that
> --
> Posted via http://www.ruby-forum.com/.
>
> >
>


-- 
-- 
Thanks & Regards,
Sumanth Krishna. A
+358 40 3276564

Blogs:
TwinclingCommunity:

http://sumanthtechsavvy.blogspot.com/
 http://www.twincling.org/node/227

http://yourway2health.blogspot.com/
   http://www.osef.twincling.org

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



[Rails] Re: storing and retrieving arrays in mysql using rails

2009-03-13 Thread vimal

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



[Rails] Re: Coding standards

2009-03-13 Thread Phlip

John Fletcher wrote:

> One thing I really like about Java compared to PHP is that there’s an 
> official coding standard.

If the Official Coding Standard just... jumped off a cliff, would you?

> Bearing that in mind... I’m starting to learn Ruby and noticed there 
> doesn’t appear to be an official coding standard, nor for Rails. This 
> document basically claims to be a de facto standard, is that true 
> http://www.caliban.org/ruby/rubyguide.shtml#style?  If so I will follow 
> their conventions. Or is there a better resource? Is the community 
> fairly consistent in their coding style?  I find the Java community is 
> fairly consistent, the PHP community rather the opposite.

Ruby is supported by a real community, not a corporate oligarchy. We have no 
motive to pay some flunky to write up a document full of our leaders' whims and 
proclivities. Yet our coding standard really does exist - it is the amalgam of 
our best literature. For example:

  - 2 spaces for indentation
  - under_bar not CamelCase
  - omit unused keywords, such as return
  - omit top-level parens
  - the closer to correct English grammar the better
  - do-end on multi-line blocks
  - {} on blocks followed by .methods
  - cram everything onto one line (then wrap it funkily)

You will notice that not all of our standards make sense. Making them official 
would only exacerbate this problem.

Ruby's incredibly rich syntax powers our style. For example, the operators 'or' 
and 'and' associate more loosely than '=', so we can write:

   match.xpath('*').each do |child|
 issue = match_nodes(child, node) and
   return issue
   end

That notation looks unfamiliar, and it saves a couple of lines - without 
cramming. It also obeys the perfectly universal coding standard, "Always 
promote 
the positive path thru a method, and demote the negative or failing path. Make 
the failing path low or to the right, and run the positive path down along the 
left."

The Official Java Standard doubtless enforced that too...

-- 
   Phlip


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



[Rails] Re: storing and retrieving arrays in mysql using rails

2009-03-13 Thread Sumanth Krishna
Interesting,
  nothing extra tweaks are required to achieve this.

<%= select_tag "days[]", options_for_select([ "Mon", "Tue", "Wed",
"Thu","Fri","Sat","Sun",], "Monday"),:multiple => true %>

This would ensure that your selection is stored into array "days[]".
You can store this as string into db with a delimiter of your choice
[preferably days.join(",")].

hope it was useful, else post me more details :)

On Fri, Mar 13, 2009 at 2:16 PM, vimal  wrote:

>
> Hi,
>
>  I have a multiple checkbox of values 1 to 7 for selecting weekdays.
>
>  What is the possibility of storing the selected weekdays array in
> mysql
>  and what type of field should i create in the table for storing the
> array.
>  Any suggestions???
>
> Regards,
> Vimal Das
>
> >
>


-- 
-- 
Thanks & Regards,
Sumanth Krishna. A
+358 40 3276564

Blogs:
TwinclingCommunity:

http://sumanthtechsavvy.blogspot.com/
 http://www.twincling.org/node/227

http://yourway2health.blogspot.com/
   http://www.osef.twincling.org

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



  1   2   >