[Rails] Ruby on Rails Developer

2011-03-08 Thread Soji Mathew
Hi,
We are hiring RoR developers
Work Location: Bangalore(India)
Ruby on Rails Developer

Relevant Years of Experience 3-5 years
Educational Qualification: B.E/B.Tech, MCA, MSc Computer Science, Msc
IT
Experience creating a stable, secure, and manageable Rails production
environment on Linux
Knowledge of Rails authentication methods (especially with Active
Directory)
Ability to write clear, self-documenting code
Heavy use of test-driven development
Involvement in pair programming
Building standard-based, cross-browser templates

Required Skills:
Ruby on Rails, version 3
JRuby, and the test framework Rspec.
Apache, with Passenger and Virtual Hosting
MySQL
Linux system administration
AJAX and non-obtrusive Javascript.
Interested candidates may forward your updated profile ASAP as MS word
document to soj...@tlisoftware.in

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



[Rails] Invalid accept header: IE & external link

2011-03-08 Thread Mack Data
Hi!  I'm getting an error similar to one describe by others using
Devise and Ajax in Internet Explorer:  IE processes the controller as
"*/*" and the Http Basic Validation box pops up instead of having
Devise perform the validation.

The weird thing is that this *only* happens when clicking on a
separate link.  If I copy & paste the link address, everything works
fine.  If I click on the link, Http Basic Validation takes over
instead.

All gems should be up to date:  Rails 3.0.5, Devise 1.1.7, newest
jquery-ujs in my javascripts folder.

Any idea why clicking on a link triggers such different behavior than
copying & pasting the link?

Thanks!

 Chris

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



[Rails] RoR failure

2011-03-08 Thread Julio Figueiredo
I am a newbie at RoR and am disappointed by the fact that I couldn't
install it in my Ubuntu 10.10 using an IDE. I tried NetBeans 6.9.1,
Eclipse 3.6.2, Aptana Studio and its plugin for Eclipse and RubyMine.
There was always a problem somewhere (rails, rubygems, rake, etc)
preventing me from working with my project. I currently have Netbeans
6.9.1 bundled with java jdk 1.6.0. I've already tried to install its
necessary plugins without success.
Can someone help me on how to build a solid RoR environment to use
with Netbeans 6.9.1?

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



[Rails] Re: Translate (internationalize) entire pages - best practice?

2011-03-08 Thread Stefano
Hi Walter

Thank you for your answer. I already have watched that railcast but he
really only talks about changing the backend. He doesnt compare the
options of storing pages in the DB or retrieving them from locale
files, thats what my question is mainly about I guess.

Is it a good idea to store entire pages so possibly a lot of text in a
redis database or key driven storage? Or is it more to translate
little stuff like buttons, links, etc.

Regards
Stefano

On Mar 8, 9:27 pm, Walter Lee Davis  wrote:
> On Mar 8, 2011, at 1:48 PM, Stefano wrote:
>
>
>
> > Hi guys
>
> > I am working on a webpage for a company and one of the requirements is
> > that the entire webpage is capable of supporting multiple languages.
>
> > Now stop before you start writing because yes, I am aware of i18n, but
> > I am not entirely convinced that it would be the best thing to put the
> > content into one particular locale file... So the options are:
>
> > 1) Store content in database has advantages that it would be easy to
> > modify existing pages using the CMS. Drawback is that every time the
> > page is loaded it has to query the database and fields like 'content'
> > or whatever could get potentially very large if there is a lot of text
> > on the page.
>
> > 2) Content storage in locale files. Seems like the 'nicer' solution
> > because you can give these files to an external business to translate
> > or whatever but does have the disadvantage that it would be harder to
> > write a CMS for this. Also it seems a little strange to make pages
> > that have placeholder locales for the content? content_1: "foobar"
> > content_2: "foobar2" ? Just looks strange...
>
> > So I was a little surprised about the lack of good advice on the
> > internet. Surely this is done everywhere, all the time but I couldnt
> > find a book about it (yes, tried the obvious stuff, agile web
> > development, recipes, etc.) or any good webpage discussing the
> > problem.
>
> > Thanks and looking forward to hearing your response
> > Stefano
>
> Ryan Bates' ears must be burning right now. He just covered this in  
> Monday's Railscast.http://railscasts.com
>
> Walter

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



[Rails] Re: 2.0.2 Postgres don't work

2011-03-08 Thread Prasad B.
i am also same problem please give me solution . I am getting below
error
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:76:in
`establish_connection': Pl
ease install the postgres adapter: `gem install
activerecord-postgres-adapter` (
no such file to load --
active_record/connection_adapters/postgres_adapter) (Run
timeError)

i am using
--
ruby 1.8.7
rails 2.3.5
pg 0.9.0

But i have postgres_adapter.rb file


C:\Ruby187\lib\ruby\gems\1.8\gems\activerecord-2.3.5\lib\active_record\connection_adapters
 
but it says no such file to load .let me answer any one.

Thansk 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: 2.0.2 Postgres don't work

2011-03-08 Thread Prasad B.
i am also same problem please give me solution . I am getting below 
error
C:/Ruby187/lib/ruby/gems/1.8/gems/activerecord-2.3.5/lib/active_record/connectio
n_adapters/abstract/connection_specification.rb:76:in 
`establish_connection': Pl
ease install the postgres adapter: `gem install 
activerecord-postgres-adapter` (
no such file to load -- 
active_record/connection_adapters/postgres_adapter) (Run
timeError)

i am using
--
ruby 1.8.7
rails 2.3.5
pg 0.9.0

-- 
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] " instead of " in js code rendered by erb

2011-03-08 Thread slava
Having problems rendering javascript in erb file. Thanks for
suggestions.

//layout erb file
(function() {

...
var widget_properties = {};
   <%= content_for?(:extend_widget) ? "widget_properties = " +
yield(:extend_widget) : '' %>
...
})();


//view erb file
<% content_for :extend_widget do %>
extend = {
_init: function() {
$("input[type='checkbox']", this).live('click', function() {
...
});
}
}

<% end %>

//resulting script - notice the " instead of " in code below
(function() {
...
widget_properties = extend = {
 _init: function() {
$("input[type='checkbox']", this).live('click',
function() {
...

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



Re: [Rails] validation order firing

2011-03-08 Thread Me
OK, cool.  Thanks.

On Tuesday, March 8, 2011 9:40:30 PM UTC-6, jim wrote:
>
>
>
> On Wed, Mar 9, 2011 at 11:36 AM, Me  wrote:
>
>> But is the validates_presence_of supposed to catch that first?
>>
>>
> ah ok, now i see what you mean. 
>
> validations don't work that way. all validations are run even when the 
> previous
> validations fail.  that's why you need to add :if and :except arguments so 
> that
> some validations are run only when some conditions are met.
>  
>
>> On Tuesday, March 8, 2011 9:33:40 PM UTC-6, jim wrote:
>>>
>>>
>>>
>>> On Wed, Mar 9, 2011 at 10:34 AM, Me  wrote:
>>>
 Ok, well the value in the validates_each is giving me nil, not sure 
 why.  Error is:

 The error occurred while evaluating nil.>=):

 validates_presence_of :code
 validates_uniqueness_of :code
 validates_presence_of :valid_from_date, :expiry_date
 validates_each :expiry_date do |record, attribute, value|
   record.errors.add(:expiry_date, 'must be after or the same as valid 
 from date') unless value >= record.valid_from_date
 end

  
>>> the error says that value is nil so check first if it's nil or not.
>>>
>>> validates_each :expiry_date do |record, attribute, value|
>>>   record.errors.add(:expiry_date, 'must be after or the same as valid 
>>> from date') if value && !(value >= record.valid_from_date)
>>> end
>>>  
>>>
  On Tuesday, March 8, 2011 8:28:21 PM UTC-6, jim wrote:

>
>
>  On Wed, Mar 9, 2011 at 10:19 AM, Me  wrote:
>
>> If you have:
>>
>> validates_presence_of
>> validates_uniqueness_of 
>> ...
>>
>> validates_each
>>
>>
>> What fires in what order?
>>
>
> the way you order them in your model file. so validates_presence_of 
> goes first,
> uniqueness next then validates_each.
>  
>
>>  -- 
>> You received this message because you are subscribed to the Google 
>> Groups "Ruby on Rails: Talk" group.
>> To post to this group, send email to ruby...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> rubyo...@googlegroups.com.
>>
>> For more options, visit this group at 
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> -- 
> -
> visit my blog at http://jimlabs.heroku.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 rubyo...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonra...@googlegroups.com.
 For more options, visit this group at 
 http://groups.google.com/group/rubyonrails-talk?hl=en.

>>>
>>>
>>>
>>> -- 
>>> -
>>> visit my blog at http://jimlabs.heroku.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 rubyonra...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> rubyonrails-ta...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> -- 
> -
> visit my blog at http://jimlabs.heroku.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.



Re: [Rails] Windows /RailsInstaller- Webrick starts but welcome page doesn't load

2011-03-08 Thread Jazmin
Thanks for your help.

I finally found the issue, mysql2 is causing the server to hang, I can run
migrations and get to the console just fine but for some reason the server
just hangs.

Using mysql for now.

The fact that it hangs and then (I assume) says host not available
> when you stop the server means that in some sense it has 'got through'
> to the server and rules out basic access to localhost problems (such
> as one might get with a misconfigured firewall).
>
> Colin
>

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



Re: [Rails] validation order firing

2011-03-08 Thread Jim Ruther Nill
On Wed, Mar 9, 2011 at 11:36 AM, Me  wrote:

> But is the validates_presence_of supposed to catch that first?
>
>
ah ok, now i see what you mean.

validations don't work that way. all validations are run even when the
previous
validations fail.  that's why you need to add :if and :except arguments so
that
some validations are run only when some conditions are met.


> On Tuesday, March 8, 2011 9:33:40 PM UTC-6, jim wrote:
>>
>>
>>
>> On Wed, Mar 9, 2011 at 10:34 AM, Me  wrote:
>>
>>> Ok, well the value in the validates_each is giving me nil, not sure why.
>>> Error is:
>>>
>>> The error occurred while evaluating nil.>=):
>>>
>>> validates_presence_of :code
>>> validates_uniqueness_of :code
>>> validates_presence_of :valid_from_date, :expiry_date
>>> validates_each :expiry_date do |record, attribute, value|
>>>   record.errors.add(:expiry_date, 'must be after or the same as valid
>>> from date') unless value >= record.valid_from_date
>>> end
>>>
>>>
>> the error says that value is nil so check first if it's nil or not.
>>
>> validates_each :expiry_date do |record, attribute, value|
>>   record.errors.add(:expiry_date, 'must be after or the same as valid from
>> date') if value && !(value >= record.valid_from_date)
>> end
>>
>>
>>> On Tuesday, March 8, 2011 8:28:21 PM UTC-6, jim wrote:
>>>


 On Wed, Mar 9, 2011 at 10:19 AM, Me  wrote:

> If you have:
>
> validates_presence_of
> validates_uniqueness_of
> ...
>
> validates_each
>
>
> What fires in what order?
>

 the way you order them in your model file. so validates_presence_of goes
 first,
 uniqueness next then validates_each.


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



 --
 -
 visit my blog at http://jimlabs.heroku.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 rubyonra...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> rubyonrails-ta...@googlegroups.com.
>>> For more options, visit this group at
>>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>>
>>
>>
>>
>> --
>> -
>> visit my blog at http://jimlabs.heroku.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.
>



-- 
-
visit my blog at http://jimlabs.heroku.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.



Re: [Rails] validation order firing

2011-03-08 Thread Me
But is the validates_presence_of supposed to catch that first?

On Tuesday, March 8, 2011 9:33:40 PM UTC-6, jim wrote:
>
>
>
> On Wed, Mar 9, 2011 at 10:34 AM, Me  wrote:
>
>> Ok, well the value in the validates_each is giving me nil, not sure why.  
>> Error is:
>>
>> The error occurred while evaluating nil.>=):
>>
>> validates_presence_of :code
>> validates_uniqueness_of :code
>> validates_presence_of :valid_from_date, :expiry_date
>> validates_each :expiry_date do |record, attribute, value|
>>   record.errors.add(:expiry_date, 'must be after or the same as valid from 
>> date') unless value >= record.valid_from_date
>> end
>>
>>
> the error says that value is nil so check first if it's nil or not.
>
> validates_each :expiry_date do |record, attribute, value|
>   record.errors.add(:expiry_date, 'must be after or the same as valid from 
> date') if value && !(value >= record.valid_from_date)
> end
>  
>
>> On Tuesday, March 8, 2011 8:28:21 PM UTC-6, jim wrote:
>>>
>>>
>>>
>>> On Wed, Mar 9, 2011 at 10:19 AM, Me  wrote:
>>>
 If you have:

 validates_presence_of
 validates_uniqueness_of 
 ...

 validates_each


 What fires in what order?

>>>
>>> the way you order them in your model file. so validates_presence_of goes 
>>> first,
>>> uniqueness next then validates_each.
>>>  
>>>
  -- 
 You received this message because you are subscribed to the Google 
 Groups "Ruby on Rails: Talk" group.
 To post to this group, send email to rubyo...@googlegroups.com.
 To unsubscribe from this group, send email to 
 rubyonra...@googlegroups.com.

 For more options, visit this group at 
 http://groups.google.com/group/rubyonrails-talk?hl=en.

>>>
>>>
>>>
>>> -- 
>>> -
>>> visit my blog at http://jimlabs.heroku.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 rubyonra...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> rubyonrails-ta...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> -- 
> -
> visit my blog at http://jimlabs.heroku.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.



Re: [Rails] validation order firing

2011-03-08 Thread Jim Ruther Nill
On Wed, Mar 9, 2011 at 10:34 AM, Me  wrote:

> Ok, well the value in the validates_each is giving me nil, not sure why.
> Error is:
>
> The error occurred while evaluating nil.>=):
>
> validates_presence_of :code
> validates_uniqueness_of :code
> validates_presence_of :valid_from_date, :expiry_date
> validates_each :expiry_date do |record, attribute, value|
>   record.errors.add(:expiry_date, 'must be after or the same as valid from
> date') unless value >= record.valid_from_date
> end
>
>
the error says that value is nil so check first if it's nil or not.

validates_each :expiry_date do |record, attribute, value|
  record.errors.add(:expiry_date, 'must be after or the same as valid from
date') if value && !(value >= record.valid_from_date)
end


> On Tuesday, March 8, 2011 8:28:21 PM UTC-6, jim wrote:
>>
>>
>>
>> On Wed, Mar 9, 2011 at 10:19 AM, Me  wrote:
>>
>>> If you have:
>>>
>>> validates_presence_of
>>> validates_uniqueness_of
>>> ...
>>>
>>> validates_each
>>>
>>>
>>> What fires in what order?
>>>
>>
>> the way you order them in your model file. so validates_presence_of goes
>> first,
>> uniqueness next then validates_each.
>>
>>
>>>  --
>>> You received this message because you are subscribed to the Google Groups
>>> "Ruby on Rails: Talk" group.
>>> To post to this group, send email to rubyonra...@googlegroups.com.
>>> To unsubscribe from this group, send email to
>>> rubyonrails-ta...@googlegroups.com.
>>>
>>> For more options, visit this group at
>>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>>
>>
>>
>>
>> --
>> -
>> visit my blog at http://jimlabs.heroku.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.
>



-- 
-
visit my blog at http://jimlabs.heroku.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] error in GET 'show'

2011-03-08 Thread Gaba Luschi
Hi,

I'm running rspec and get a failure based on a user spec in the
controller section:

describe "GET 'show'" do

 it "should have the right title" do
  get :show, :id => @user
  response.should have_selector("title", :content => @user.name)
end


Do you know how to correct this error?  Would it be in the controller
section or view?

-- 
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.



Re: [Rails] validation order firing

2011-03-08 Thread Me
Ok, well the value in the validates_each is giving me nil, not sure why.  
Error is:

The error occurred while evaluating nil.>=):

validates_presence_of :code
validates_uniqueness_of :code
validates_presence_of :valid_from_date, :expiry_date
validates_each :expiry_date do |record, attribute, value|
  record.errors.add(:expiry_date, 'must be after or the same as valid from 
date') unless value >= record.valid_from_date
end

On Tuesday, March 8, 2011 8:28:21 PM UTC-6, jim wrote:
>
>
>
> On Wed, Mar 9, 2011 at 10:19 AM, Me  wrote:
>
>> If you have:
>>
>> validates_presence_of
>> validates_uniqueness_of 
>> ...
>>
>> validates_each
>>
>>
>> What fires in what order?
>>
>
> the way you order them in your model file. so validates_presence_of goes 
> first,
> uniqueness next then validates_each.
>  
>
>>  -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonra...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> rubyonrails-ta...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> -- 
> -
> visit my blog at http://jimlabs.heroku.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.



Re: [Rails] validation order firing

2011-03-08 Thread Jim Ruther Nill
On Wed, Mar 9, 2011 at 10:19 AM, Me  wrote:

> If you have:
>
> validates_presence_of
> validates_uniqueness_of
> ...
>
> validates_each
>
>
> What fires in what order?
>

the way you order them in your model file. so validates_presence_of goes
first,
uniqueness next then validates_each.


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



-- 
-
visit my blog at http://jimlabs.heroku.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.



Re: [Rails] error: action 'index' could not be found for Userscontroller

2011-03-08 Thread Jim Ruther Nill
On Wed, Mar 9, 2011 at 10:17 AM, Gaba Luschi  wrote:

> When I go to my localhost:3000/users page, I get:
>
> Unknown action
> The action 'index' could not be found for UsersController
>
> What does this mean?  That I need to define "index" in my controller?
>
>
yup. define the action or just create an index.html.erb template in
app/views/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.
>
>


-- 
-
visit my blog at http://jimlabs.heroku.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: error: action 'index' could not be found for Userscontroller

2011-03-08 Thread Kleber Shimabuku
Yes, you have to create the action "index" in your controller (Users)

def index
end

And then, need to create respective view for it.


On 9 mar, 11:17, Gaba Luschi  wrote:
> When I go to my localhost:3000/users page, I get:
>
> Unknown action
> The action 'index' could not be found for UsersController
>
> What does this mean?  That I need to define "index" in my controller?
>
> --
> 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] validation order firing

2011-03-08 Thread Me
If you have:

validates_presence_of
validates_uniqueness_of 
...

validates_each


What fires in what order?

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



[Rails] error: action 'index' could not be found for Userscontroller

2011-03-08 Thread Gaba Luschi
When I go to my localhost:3000/users page, I get:

Unknown action
The action 'index' could not be found for UsersController

What does this mean?  That I need to define "index" in my controller?

-- 
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 streamline this a bit of code

2011-03-08 Thread Kleber Shimabuku
What about using an CRUD controller?


On 9 mar, 07:51, Manny 777  wrote:
> Hi,
>  I'm new in RoR and i wrote this mini-app, which can to add, edit and
> delete the item in/from database. I think the edit and add item isn't
> solve very good. I'm making both operations during one form.
>
> CONTROLLER:
>   def create
>     if params[:name].length > 0 then
>
>       if params[:id_obj].length > 1 then #editing of current record
>         @update=Person.find(params[:id_obj])
>
>         if @update.update_attributes(:name=>params[:name])
>           flash[:notice] = 'Your record was succesfly edited.'
>           redirect_to :action => 'index'
>         else
>           flash[:warning] = 'ERROR: your record was not edited (no
> input)!'
>           redirect_to :action => 'index'
>         end
>
>       else #creating the new record
>         @haha=Person.new(:name=>params[:name])
>
>         if @haha.save
>           flash[:notice] = 'Your record was succesfly saved.'
>           redirect_to :action => 'index'
>         else
>           flash[:warning] = 'ERROR: your record was not succesfly
> saved.'
>           redirect_to :action => 'index'
>         end
>       end
>
>   else #input for name is empty
>       flash[:warning] = 'ERROR: your record was not succesfly saved (no
> input).'
>       redirect_to :action => 'index'
>   end
>   end
>
> VIEW:
> <%= form_tag({ :action => 'create' }, { :method => 'post' }) do %>
> 
>     
>       Here put your own idea! :)
>     
>     
>       <%= hidden_field_tag 'id_obj', if @update then
> @update.id else '' end %>
>     
>     
>       Name: 
>       <%= text_field_tag 'name', if @update then @update.name else
> '' end %>
>     
>     
>       Text of message: 
>       
>     
>     
>       
>        />
>     
>   
> <% end %>
>
> So I would to ask you about help, how to make this code more effective
> -- this solve is not much nice...
>
> Thanks, M.
>
> --
> 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.



Re: [Rails] How to streamline this a bit of code

2011-03-08 Thread Jim Ruther Nill
On Wed, Mar 9, 2011 at 6:51 AM, Manny 777  wrote:

> Hi,
>  I'm new in RoR and i wrote this mini-app, which can to add, edit and
> delete the item in/from database. I think the edit and add item isn't
> solve very good. I'm making both operations during one form.
>
>
try generating a model using a scaffold and see how the view and
controller actions talk with each other.  there you'll see what you need
to change in your mini app. good luck!


> CONTROLLER:
>  def create
>if params[:name].length > 0 then
>
>  if params[:id_obj].length > 1 then #editing of current record
>@update=Person.find(params[:id_obj])
>
>if @update.update_attributes(:name=>params[:name])
>  flash[:notice] = 'Your record was succesfly edited.'
>  redirect_to :action => 'index'
>else
>  flash[:warning] = 'ERROR: your record was not edited (no
> input)!'
>  redirect_to :action => 'index'
>end
>
>  else #creating the new record
>@haha=Person.new(:name=>params[:name])
>
>if @haha.save
>  flash[:notice] = 'Your record was succesfly saved.'
>  redirect_to :action => 'index'
>else
>  flash[:warning] = 'ERROR: your record was not succesfly
> saved.'
>  redirect_to :action => 'index'
>end
>  end
>
>  else #input for name is empty
>  flash[:warning] = 'ERROR: your record was not succesfly saved (no
> input).'
>  redirect_to :action => 'index'
>  end
>  end
>
> VIEW:
> <%= form_tag({ :action => 'create' }, { :method => 'post' }) do %>
> 
>
>  Here put your own idea! :)
>
>
>  <%= hidden_field_tag 'id_obj', if @update then
> @update.id else '' end %>
>
>
>  Name: 
>  <%= text_field_tag 'name', if @update then @update.name else
> '' end %>
>
>
>  Text of message: 
>  
>
>
>  
>   />
>
>  
> <% end %>
>
> So I would to ask you about help, how to make this code more effective
> -- this solve is not much nice...
>
> Thanks, M.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
-
visit my blog at http://jimlabs.heroku.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.



Re: [Rails] Fragment caching and not accessing model from view

2011-03-08 Thread Jim Ruther Nill
On Wed, Mar 9, 2011 at 12:06 AM, Colin Law  wrote:

> I am using fragment caching to render a select box where the contents
> of the select box comes from a lengthy db query.  A simplified example
> showing the problem is
> <% cache 'select_box' do %>
> <%= f.collection_select :variety_id, @varieties, :id, :name %>
> <% end %>
> where @varieties is setup in the controller.  Unfortunately this does
> not achieve the desired result as the query is run even when the
> select is picked up from the cache.
>
>
are you just using .all or a complex query?  Because if you're using a
complex
query and you're using rails3, then just remove the .all in the complex
query
in the controller so that it won't run the query.  I think it just saves
the
relation to the @varieties variable and won't run the query until a method
is
called on the variable such .each or .collect.


> To get the full benefit I have to remove @varieties = Variety.all from
> the controller and use
> <% cache 'select_box' do %>
> <%= f.collection_select :variety_id, Variety.all, :id, :name %>
> <% end %>
> but this breaks the rule that one should not access the model from the
> view.  Is there a good solution to this problem?
>
> Colin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
-
visit my blog at http://jimlabs.heroku.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 3 routes alias

2011-03-08 Thread Kleber Shimabuku
Hi all,

In older version 2.x I was doing something like:

map.resources :jobs, :as => 'vagas'

and this way, I can use jobs_path to create a link to.

But in rails 3, I still can use :as to define an alias, but I cannot
use jobs_path anymore, because it forces me to use vagas_path.

So I was wondering if have any way to define an alias and still use
the original resource name to create a link.

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



Re: [Rails] Seeking resources to help do external image preview (scraping) like FB and subsequent full-size image capture

2011-03-08 Thread Jim Ruther Nill
On Wed, Mar 9, 2011 at 2:48 AM, Philip Hallstrom  wrote:

> > Non-technical founder doing some research to try and help point my
> > developer in the right direction.
> >
> > Seeking resources or guidance to help generate an image preview from a
> > link, similar to the one used in Facebook's UI, and then subsequently
> > also allow a user to display / grab the full size image of the preview
> > as well. Not looking to necessarily create a bookmarklet a la
> > svpply.com or the like, but interested in figuring out a way whereby a
> > user can enter a link, select the image they want on the page they've
> > linked to, and then have that image added to a post or submission to a
> > web page.
> >
>

you can do this using a simple ajax process.

submit the link via ajax then in the controller, get the html page through
the HTTP::Net library or use a gem like httparty.  Parse the page with
nokogiri and save all the images in an array.  Use the array to show the
user the images found on that link.



> > Any help, guidance, or anything would be greatly appreciated!!
>
>
> http://www.pageglimpse.com/
>
> Maybe... I did a project using alexa thumbnail service, but looks like that
> got shut down.  One article pointed to the above as a replacement. I've
> never used it though...
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
-
visit my blog at http://jimlabs.heroku.com

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



[Rails] How to streamline this a bit of code

2011-03-08 Thread Manny 777
Hi,
 I'm new in RoR and i wrote this mini-app, which can to add, edit and
delete the item in/from database. I think the edit and add item isn't
solve very good. I'm making both operations during one form.

CONTROLLER:
  def create
if params[:name].length > 0 then

  if params[:id_obj].length > 1 then #editing of current record
@update=Person.find(params[:id_obj])

if @update.update_attributes(:name=>params[:name])
  flash[:notice] = 'Your record was succesfly edited.'
  redirect_to :action => 'index'
else
  flash[:warning] = 'ERROR: your record was not edited (no
input)!'
  redirect_to :action => 'index'
end

  else #creating the new record
@haha=Person.new(:name=>params[:name])

if @haha.save
  flash[:notice] = 'Your record was succesfly saved.'
  redirect_to :action => 'index'
else
  flash[:warning] = 'ERROR: your record was not succesfly
saved.'
  redirect_to :action => 'index'
end
  end

  else #input for name is empty
  flash[:warning] = 'ERROR: your record was not succesfly saved (no
input).'
  redirect_to :action => 'index'
  end
  end

VIEW:
<%= form_tag({ :action => 'create' }, { :method => 'post' }) do %>


  Here put your own idea! :)


  <%= hidden_field_tag 'id_obj', if @update then
@update.id else '' end %>


  Name: 
  <%= text_field_tag 'name', if @update then @update.name else
'' end %>


  Text of message: 
  


  
  

  
<% end %>

So I would to ask you about help, how to make this code more effective
-- this solve is not much nice...

Thanks, M.

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

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



Re: [Rails] Re: Weird error in webrick on windows xp when accessing through IE 6

2011-03-08 Thread David Kahn
On Tue, Mar 8, 2011 at 4:04 PM, elitwin  wrote:

> On Mar 8, 1:15 pm, Nick Gorbikoff  wrote:
> > Hello All.
> >
> > I'm developing and an app on my Windows XP machine using ruby 1.9.2 &
> > Rails 3.0.5
> > Everything is running along just fine, unless I try to open my app
> > under IE 6 - everything works fine under Chrome, FF, Safari, IE 7 & 8.
> > I tried accessing from multiple computers to make sure it's not my IE
> > setup ( I'm using Utilu IE Collection for multiple IE setup) . I am
> > using pie.htc hack, but not sure why would it cause a problem.
> >
>
> Not sure if this will solve your problem, but I would try the
> following:
>
> 1. Use Passenger instead of Webrick. You won't be using Webrick in
> production, right? I've never configured it on Windows XP, which leads
> to the next point.
> 2. Don't use Windows XP - Setup a Linux VM.
>
>
Do tell.. seems that even machines don't like IE 6 either

And yes, do go on a vm. In fact I am at this moment resolving a deployment
difference between my OSX dev env and my Ubuntu server. Was just thinking a
few minutes ago that maybe I will switch to linux to develop to avoid these
little deployment surprises.


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

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



[Rails] Re: Weird error in webrick on windows xp when accessing through IE 6

2011-03-08 Thread elitwin
On Mar 8, 1:15 pm, Nick Gorbikoff  wrote:
> Hello All.
>
> I'm developing and an app on my Windows XP machine using ruby 1.9.2 &
> Rails 3.0.5
> Everything is running along just fine, unless I try to open my app
> under IE 6 - everything works fine under Chrome, FF, Safari, IE 7 & 8.
> I tried accessing from multiple computers to make sure it's not my IE
> setup ( I'm using Utilu IE Collection for multiple IE setup) . I am
> using pie.htc hack, but not sure why would it cause a problem.
>

Not sure if this will solve your problem, but I would try the
following:

1. Use Passenger instead of Webrick. You won't be using Webrick in
production, right? I've never configured it on Windows XP, which leads
to the next point.
2. Don't use Windows XP - Setup a Linux VM.

Eric

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



Re: [Rails] tengo un problema

2011-03-08 Thread Jazmin
Ve la siguiente linea:
@cliente = Cliente.new
tu tienes una clase llamada Cliente(cliente.rb)


al parecer en la siguiente linea, estas llamando a una clase que no existe
@co1=contactos_co1.find_all

tienes una classe llamada contactos_co1.rb?? si es asi entonces usa
@co1 = ContactosCo1.all

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



Re: [Rails] Translate (internationalize) entire pages - best practice?

2011-03-08 Thread Walter Lee Davis


On Mar 8, 2011, at 1:48 PM, Stefano wrote:


Hi guys

I am working on a webpage for a company and one of the requirements is
that the entire webpage is capable of supporting multiple languages.

Now stop before you start writing because yes, I am aware of i18n, but
I am not entirely convinced that it would be the best thing to put the
content into one particular locale file... So the options are:

1) Store content in database has advantages that it would be easy to
modify existing pages using the CMS. Drawback is that every time the
page is loaded it has to query the database and fields like 'content'
or whatever could get potentially very large if there is a lot of text
on the page.

2) Content storage in locale files. Seems like the 'nicer' solution
because you can give these files to an external business to translate
or whatever but does have the disadvantage that it would be harder to
write a CMS for this. Also it seems a little strange to make pages
that have placeholder locales for the content? content_1: "foobar"
content_2: "foobar2" ? Just looks strange...

So I was a little surprised about the lack of good advice on the
internet. Surely this is done everywhere, all the time but I couldnt
find a book about it (yes, tried the obvious stuff, agile web
development, recipes, etc.) or any good webpage discussing the
problem.

Thanks and looking forward to hearing your response
Stefano



Ryan Bates' ears must be burning right now. He just covered this in  
Monday's Railscast. http://railscasts.com


Walter

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



[Rails] Weird error in webrick on windows xp when accessing through IE 6

2011-03-08 Thread Nick Gorbikoff
Hello All.

I'm developing and an app on my Windows XP machine using ruby 1.9.2 &
Rails 3.0.5
Everything is running along just fine, unless I try to open my app
under IE 6 - everything works fine under Chrome, FF, Safari, IE 7 & 8.
I tried accessing from multiple computers to make sure it's not my IE
setup ( I'm using Utilu IE Collection for multiple IE setup) . I am
using pie.htc hack, but not sure why would it cause a problem.

I'm getting the strangest error:

[2011-03-08 15:11:53] ERROR Errno::ECONNABORTED: An established
connection was aborted by the software in your host machine.
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:56:in
`eof?'
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:56:in
`run'
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block
in start_thread'
[2011-03-08 15:11:53] ERROR Errno::ECONNABORTED: An established
connection was aborted by the software in your host machine.
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:56:in
`eof?'
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:56:in
`run'
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block
in start_thread'
[2011-03-08 15:11:53] ERROR Errno::ECONNABORTED: An established
connection was aborted by the software in your host machine.
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:56:in
`eof?'
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:56:in
`run'
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block
in start_thread'
[2011-03-08 15:11:53] ERROR Errno::ECONNRESET: An existing connection
was forcibly closed by the remote host.
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:56:in
`eof?'
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:56:in
`run'
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block
in start_thread'
[2011-03-08 15:11:53] ERROR Errno::ECONNABORTED: An established
connection was aborted by the software in your host machine.
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:56:in
`eof?'
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/httpserver.rb:56:in
`run'
C:/ruby/Ruby192/lib/ruby/1.9.1/webrick/server.rb:183:in `block
in start_thread'


Does anyone know what might be causing it?

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.



Re: [Rails] Rails 3 routing problem

2011-03-08 Thread David J . Hamilton
Excerpts from Leonardo Mateo's message of Tue Feb 22 17:12:06 -0800 2011:
> On Mon, Feb 21, 2011 at 2:15 PM, David J. Hamilton  wrote:
> > Excerpts from Phil Crissman's message of Sun Feb 20 15:14:45 -0800 2011:
> >> > Started POST "/items/28/price" for 127.0.0.1 at 2011-02-20 18:52:10 -0300
> >> >
> >> > ActionController::RoutingError (No route matches "/items/28/price"):
> >> First check: is this route listed when you do `rake routes | grep price` ?
> >
> > Second check: Confirm that your form really does have method=POST.
> Yes, it does. Anyway, I've just changed it to use the update action,
> it makes more sense anyway.
> However, I still don't understand why it is happening.

Something I should have been more clear about:  you want to make sure that your
form element has its method attribute set to post, but you will also need to
check that it does not have a hidden parameter generated by rails named _method
with a value of, e.g. put.

Unfortunately when you make this mistake of specifying a post route in
config/routes but accidentally submitting to a synthetic "put" (very easy to do
if using +form_for+), the log will still read “Started POST” and you will be
given no indication of the problem.
-- 
med vänlig hälsning
David J. Hamilton

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



[Rails] Translate (internationalize) entire pages - best practice?

2011-03-08 Thread Stefano
Hi guys

I am working on a webpage for a company and one of the requirements is
that the entire webpage is capable of supporting multiple languages.

Now stop before you start writing because yes, I am aware of i18n, but
I am not entirely convinced that it would be the best thing to put the
content into one particular locale file... So the options are:

1) Store content in database has advantages that it would be easy to
modify existing pages using the CMS. Drawback is that every time the
page is loaded it has to query the database and fields like 'content'
or whatever could get potentially very large if there is a lot of text
on the page.

2) Content storage in locale files. Seems like the 'nicer' solution
because you can give these files to an external business to translate
or whatever but does have the disadvantage that it would be harder to
write a CMS for this. Also it seems a little strange to make pages
that have placeholder locales for the content? content_1: "foobar"
content_2: "foobar2" ? Just looks strange...

So I was a little surprised about the lack of good advice on the
internet. Surely this is done everywhere, all the time but I couldnt
find a book about it (yes, tried the obvious stuff, agile web
development, recipes, etc.) or any good webpage discussing the
problem.

Thanks and looking forward to hearing your response
Stefano

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



[Rails] DELL is looking for great/rock start Ruby on Rails 3 engineers

2011-03-08 Thread jrc
Please apply directly at 
https://dell.taleo.net/careersection/2/jobdetail.ftl?lang=en&job=744598

Job Description
Dell is an industry leader providing technology solution to small and
medium businesses on a global scale. We are recruiting for the
position of Senior Ruby/Rails Software Engineer to build Dell’s brand
new Software-as-a-Service (SaaS) product offering targeting these
customers. We are a rapidly growing, fast paced and technology driven
team where each individual's contribution directly impacts our
success.
This role will be architecting and designing key features in our core
offerings and architecture. The person we are seeking is a self-
motivated team player, result-oriented and customer focused.

Job Responsibilities:

• Responsible for architecture, design, implementation and unit
testing of core components

• Research new technologies that will make Dell SaaS solutions
innovative and competitive

• Work closely with quality engineering and technical operations to
test and deploy product enhancements and issue resolutions

• Work with engineers, Product Management, QA, and Operations teams to
develop products that meet functional and non-functional requirements
on schedule

Qualifications:

• A Bachelors or Masters degree in Computer Science

• Extensive experience in Ruby on Rails development

• Extensive experience in Object Oriented Design and Programming using
Java (Servlets and/or JDBC/Hibernate and/or XML and/or REST web
services)

• Extensive experience designing and building large scale enterprise
SaaS or consumer web applications with particular attention to
scalability and high performance, is required

• Extensive experience with SQL and relational database modeling

• Experience with Linux/Unix as a development platform

• Experience with Enterprise Application Integration, Data
Warehousing, Business Intelligence a plus

• Good written and oral communication skills

• Experience developing frameworks or other infrastructure code that
others will use is a plus

• Experience with JRuby is a strong plus

• Start-up experience is a plus

About Dell Inc.:
Want to work in an environment where each day is focused on delivering
solutions that make a real difference in people’s lives? Where teams
are constantly curious, and different perspectives and experiences are
valued? At Dell, we believe technology is essential for human success
and that it should be accessible to everyone. We are constantly
evolving to better serve our customers, seize new opportunities and
drive growth. Together we can change the world. Come join us.
Dell offers a competitive Salary and Bonus plan as well as a great
Benefit Package. For more information, visit us on the web at www.dell.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.



Re: [Rails] Re: purpose of Factory girl?

2011-03-08 Thread Carlos Galdino
You can get an idea about fixtures here:
http://guides.rubyonrails.org/testing.html#the-low-down-on-fixtures

And the
guides are a great resource to understand the basics about Rails.

Factory Girl and Machinist serve the same purpose but in my opinion it's
easier to generate data for your tests using them.

Check their pages to see more: https://github.com/notahat/machinist and
https://github.com/thoughtbot/factory_girl_rails

--
Carlos Galdino
codecleaning.com



On Tue, Mar 8, 2011 at 12:47, Gaba Luschi  wrote:

> Thanks - what exactly are fixtures?  And do Factory Girl and Machinist
> serve the same purpose?
>
> --
> 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.
>
>

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



Re: [Rails] Re: Question on Data Modeling

2011-03-08 Thread Bryan Crossland
On Tue, Mar 8, 2011 at 9:27 AM, J. Rodrigo Fuentes <
joserodrigofuen...@gmail.com> wrote:

>
> Suppose I want to let a user choose different languages when filling out a
> form, like English, Spanish, and Other, where Other is user-specified.
>
> What is the best way to model this in a RoR database?  Is it better to have
> a string or an integer that is converted with case-statements to mean
> 1=English, 2=Spanish, 3=Other...?
>
>
If the requirement is as limited as you say than either way is fine. I would
just stick with the string in this case because maintaining which number
equals what language is a maintenance hassle unless you have that stored in
a database.

B.

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



Re: [Rails] tengo un problema

2011-03-08 Thread Michael Pavling
On 8 March 2011 20:12, Jonathan A.  wrote:
>  def new
>    @cliente = Cliente.new
>    @co1=contactos_co1.find_all
>    respond_to do |format|
>      format.html # new.html.erb
>      format.xml  { render :xml => @cliente }
>    end
>  end

Where does "contactos_co1" get set? What's the model? Is it "ContactosCo1"?
If so, try:
@co1=ContactosCo1.find_all

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



[Rails] ActiveRecord and NULL in RoR-3

2011-03-08 Thread James Byrne
I have a situation where I am encountering a fragmented edi transaction.
What results is that I attempt to INSERT a row for which I am missing
some data. The columns affected all have sensible DEFAULT values but
most also have a NOT NULL constraint.

My problem is that notwithstanding I am not initializing those columns
in my program, ActiveRecord is nonetheless setting them to NULL for the
generated INSERT statement.  I can see that this is the case because I
initialize from a hash and the hash contents displayed immediately
before the failing INSERT does not contain the attribute that is causing
the exception.  Because that column is explicitly set to NULL in the
INSERT statement its DEFAULT value is not used and the NOT NULL
constraint is triggered.

Now, it is possible that I am misinterpreting what I am seeing.  My
question is: Does ActiveRecord, or some other part of the RoR DBMS
interface, actually explicitly set missing attributes to NULL on INSERT
rather than simply ignoring them?

-- 
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] tengo un problema

2011-03-08 Thread Jonathan A.
saludos
hago las cosas de acuerdo al libro

pero no me deja crear una lista de valores, basandose en otra
controlador

( no se si es el termino correcto)

se las pongo asi

tengo que hacer una aplicacion que maneja clientes
cada cliente tiene 4 contactos

entonces hay una tabla de clientes y otra de contactos

cuando le digo al cliente que tome el valor de contacto 1
de la lista de contacto
me aparece este error

undefined local variable or method `contactos_co1' for
#

aqui les va mo definicion de new

 def new
@cliente = Cliente.new
@co1=contactos_co1.find_all
respond_to do |format|
  format.html # new.html.erb
  format.xml  { render :xml => @cliente }
end
  end


y qui la definicion de create

def create
@cliente = Cliente.new(params[:cliente])
@con1.contactos_id=(params[:nombre])
   respond_to do |format|
  if @cliente.save
flash[:notice] = 'El Cliente ha sido creado corectamente.'
format.html { redirect_to(@cliente) }
format.xml  { render :xml => @cliente, :status => :created,
:location => @cliente }
  else
format.html { render :action => "new" }
format.xml  { render :xml => @cliente.errors, :status =>
:unprocessable_entity }
  end
end
  end




pls

que estoy haciend mal ???

-- 
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: Devise and Ajax

2011-03-08 Thread John Merlino
Resolved. I had to post to user model, which triggers registration 
controller.

-- 
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.



Re: [Rails] Fragment caching and not accessing model from view

2011-03-08 Thread Colin Law
On 8 March 2011 18:22, Chris Mear  wrote:
> On 8 Mar 2011, at 16:06, Colin Law  wrote:
>
>> I am using fragment caching to render a select box where the contents
>> of the select box comes from a lengthy db query.  A simplified example
>> showing the problem is
>> <% cache 'select_box' do %>
>> <%= f.collection_select :variety_id, @varieties, :id, :name %>
>> <% end %>
>> where @varieties is setup in the controller.  Unfortunately this does
>> not achieve the desired result as the query is run even when the
>> select is picked up from the cache.
>>
>> To get the full benefit I have to remove @varieties = Variety.all from
>> the controller and use
>> <% cache 'select_box' do %>
>> <%= f.collection_select :variety_id, Variety.all, :id, :name %>
>> <% end %>
>> but this breaks the rule that one should not access the model from the
>> view.  Is there a good solution to this problem?
>
> In the controller, you can check for the presence of the cached fragment 
> using the read_fragment method. Then, only run the database query if the 
> fragment isn't cached yet.

That's a great idea, in fact it is probably
fragment_exists?('select_box') that I want to use.  I will give it a
go.

Thanks

Colin

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



Re: [Rails] Re: One Mailer for all

2011-03-08 Thread David Kahn
On Tue, Mar 8, 2011 at 12:37 PM, Matt Jones  wrote:

>
>
> On Mar 7, 11:53 am, Paul Bergstrom  wrote:
> > Can I have one mailer for all? Would that be called
> > application_mailer.rb
> >
>
> Mailer names are pretty much arbitrary - even the _mailer extension is
> just a convention. The biggest downside to "put everything in one
> mailer" is the same one any "kitchen sink" file develops, namely a
> lack of structure. But there's no *technical* impediment to doing
> so...
>

Yeah, I even went further and just parameteized one mailer method so that I
could just pass in whatever text I wanted it to send to who I wanted to send
it so not pretty but for internal stuff does the job.


>
> --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.
>
>

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



[Rails] Re: Devise and Ajax

2011-03-08 Thread John Merlino
I modified the routes to point to controller. But now I get this:

Started POST "/users/create" for 127.0.0.1 at 2011-03-08 14:21:21 -0500
  Processing by UsersController#create as JSON
  SQL (177.7ms)  BEGIN
  SQL (1.6ms)  ROLLBACK
Rendered text template (0.0ms)
Completed 422 Unprocessable Entity in 290ms (Views: 47.3ms | 
ActiveRecord: 179.3ms)

this is create method:

  def create
@user = User.new(params[:user])

if @user.save
  respond_to do |format|
format.json { render :json => @user.to_json, :status => 200 }
format.xml  { head :ok }
format.html { redirect_to :action => :index }
  end
else
  respond_to do |format|
format.json { render :text => "Could not create user", :status 
=> :unprocessable_entity } # placeholder
format.xml  { head :ok }
format.html { render :action => :new, :status => 
:unprocessable_entity }
  end
end


end

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

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



[Rails] Re: Devise and Ajax

2011-03-08 Thread John Merlino
I actually now hard code the create method I want to invoke:

var options = {
type: 'POST',
url: "users/create",
dataType: 'json',
data: $('#sign-in form:first').serialize(),
error: function(xhr, textStatus, errorThrown) {
alert('An error occurred! ' + errorThrown);
},
success: function(data, textStatus) {
$('body').append( data );
}
};
$.ajax( options );

The server output is this:

Started POST "/users/create" for 127.0.0.1 at 2011-03-08 14:01:30 -0500

ActionController::RoutingError (No route matches "/users/create"):

The JavaScript allert triggers:
"An eror occurred! undefined"


I have this in routes:

   devise_for :user
  resources :users

Any idea what's going on?

-- 
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.



Re: [Rails] Seeking resources to help do external image preview (scraping) like FB and subsequent full-size image capture

2011-03-08 Thread Philip Hallstrom
> Non-technical founder doing some research to try and help point my
> developer in the right direction.
> 
> Seeking resources or guidance to help generate an image preview from a
> link, similar to the one used in Facebook's UI, and then subsequently
> also allow a user to display / grab the full size image of the preview
> as well. Not looking to necessarily create a bookmarklet a la
> svpply.com or the like, but interested in figuring out a way whereby a
> user can enter a link, select the image they want on the page they've
> linked to, and then have that image added to a post or submission to a
> web page.
> 
> Any help, guidance, or anything would be greatly appreciated!!


http://www.pageglimpse.com/

Maybe... I did a project using alexa thumbnail service, but looks like that got 
shut down.  One article pointed to the above as a replacement. I've never used 
it though...

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



[Rails] Seeking resources to help do external image preview (scraping) like FB and subsequent full-size image capture

2011-03-08 Thread ECP
Hi,

Non-technical founder doing some research to try and help point my
developer in the right direction.

Seeking resources or guidance to help generate an image preview from a
link, similar to the one used in Facebook's UI, and then subsequently
also allow a user to display / grab the full size image of the preview
as well. Not looking to necessarily create a bookmarklet a la
svpply.com or the like, but interested in figuring out a way whereby a
user can enter a link, select the image they want on the page they've
linked to, and then have that image added to a post or submission to a
web page.

Any help, guidance, or anything would be greatly appreciated!!

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: obfuscating sensitive data

2011-03-08 Thread Matt Jones


On Mar 7, 1:44 pm, Fearless Fool  wrote:
> In our app, users give us sensitive information (credentials for
> logging into a third party site).  At some point, we need those
> credentials in cleartext in order to access the third party site, but
> while they're in our database, we want to make best effort for
> protecting them.
>
> What techniques have people used for this?  I find myself asking "WWMD
> (What Would Mint.com Do?) -- any suggestions?
>

I've used Strongbox (https://github.com/spikex/strongbox) to protect
sensitive data before, but that was for an application where the
private key password wasn't stored on the server at all (requests for
the data were user-initiated and prompted for the password). Your case
sounds like it might be considerably more automated, which
substantially weakens the protection of 99% of systems - if you're
storing the keys with the data, then an attack which gets one will
likely get the other.

--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] Re: One Mailer for all

2011-03-08 Thread Matt Jones


On Mar 7, 11:53 am, Paul Bergstrom  wrote:
> Can I have one mailer for all? Would that be called
> application_mailer.rb
>

Mailer names are pretty much arbitrary - even the _mailer extension is
just a convention. The biggest downside to "put everything in one
mailer" is the same one any "kitchen sink" file develops, namely a
lack of structure. But there's no *technical* impediment to doing
so...

--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] Re: Comment creer un formulaire maitre-detail

2011-03-08 Thread Pepe Sanchez
Sorry! I made a mistake, I should write this post in the French  forum.


Please remove it from this group!!!

-- 
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: Noob Question about params in my controller

2011-03-08 Thread A. Mcbomb
thanks alot for all the help!

-- 
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.



Re: [Rails] Fragment caching and not accessing model from view

2011-03-08 Thread Chris Mear
On 8 Mar 2011, at 16:06, Colin Law  wrote:

> I am using fragment caching to render a select box where the contents
> of the select box comes from a lengthy db query.  A simplified example
> showing the problem is
> <% cache 'select_box' do %>
> <%= f.collection_select :variety_id, @varieties, :id, :name %>
> <% end %>
> where @varieties is setup in the controller.  Unfortunately this does
> not achieve the desired result as the query is run even when the
> select is picked up from the cache.
> 
> To get the full benefit I have to remove @varieties = Variety.all from
> the controller and use
> <% cache 'select_box' do %>
> <%= f.collection_select :variety_id, Variety.all, :id, :name %>
> <% end %>
> but this breaks the rule that one should not access the model from the
> view.  Is there a good solution to this problem?

In the controller, you can check for the presence of the cached fragment using 
the read_fragment method. Then, only run the database query if the fragment 
isn't cached yet.

Chris

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

2011-03-08 Thread Ben Perry
Thanks for that, very useful :)

On Mar 8, 3:10 pm, Frederick Cheung 
wrote:
> On Mar 8, 2:59 pm, Ben Perry  wrote:> To anyone who finds 
> this.
>
> > Bundler does install the rails gem, however. What bundler doesn't do
> > is setup the Windows shortcuts in the ruby\bin directory to allow the
> > rails command to work. If you 'gem install rails', those shortcuts are
> > setup and then you can run the rails command.
>
> if rails is in your bundle then
>
> bundle exec rails
>
> should run it for you even if there is no shortcut in place
>
> Fred
>
> > On Feb 14, 4:35 pm, Ben Perry  wrote:
>
> > > bundle show rails
> > > C:/system/Ruby/lib/ruby/gems/1.9.1/gems/rails-3.0.3
>
> > > which is what I'd expect because its what I have specifically
> > > installed, however. When I just ran bundle install, if I'd run this
> > > command I wouldn't have expected to see similar output as the gem
> > > wasn't there at all.
>
> > > On Feb 10, 1:46 am, kaizenfury7  wrote:
>
> > > > What happens when you run bundle install on your production machine?
> > > > What do you see when you run:
>
> > > > bundle show rails

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



[Rails] [PR] #PgEast schedule up!

2011-03-08 Thread Joshua D. Drake
The PostgreSQL Conference East is in NYC this year and the schedule has
just been published. As a note there is a full day RoR class happening
at the conference.

March 08, 2011: Celebrating 15 years of PostgreSQL, early.

Following on the smashing success of PostgreSQL Conference West,
The PostgreSQL Conference for Developers, End Users and Decision Makers,
is being held at the Hotel Pennsylvania, in New York City from March
22nd through 25th 2011. Please join us in continuing to make this the
largest PostgreSQL Conference series! 

Register: https://www.postgresqlconference.org/register
Schedule: https://www.postgresqlconference.org/

Media Registration:
https://www.postgresqlconference.org/content/press-registration

Thank you to our sponsors:

EnterpriseDB : http://www.enterprisedb.com/
10Gen : http://www.10gen.com/
Braintree : http://www.braintreepaymentsolutions.com/
Continuent  : http://www.continuent.com/
Credativ: http://www.credativ.com/
Enova Financial : http://www.enovafinancial.com
OpenSCG : http://www.openscg.com/
2ndQuadrant : http://www.2ndquadrant.com/
OmniTI  : http://www.omniti.com/
OpenHosting : http://www.openhosting.com/
SQL Manager : http://www.sqlmanager.net
 
This year we will be continuing our trend of covering the entire
PostgreSQL ecosystem as well as bringing in some friends from a slightly
different world, NoSQL. 10gen, the creators of MongoDB are running a
track through the entire three days and also hosting a full day training
on their database!

"MongoDB is emerging as an alternative and complementary database to
established technologies like PostgreSQL. We are very excited to be
hosting the MongoDB track at Pg East, and hope that our respective
open source communities can learn from one another," stated Roger
Bodamer EVP, Products and Engineering at 10gen. 

We look forward to seeing you there!

-- 
PostgreSQL.org Major Contributor
Command Prompt, Inc: http://www.commandprompt.com/ - 509.416.6579
Consulting, Training, Support, Custom Development, Engineering
http://twitter.com/cmdpromptinc | http://identi.ca/commandprompt

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



Re: [Rails] Noob Question about params in my controller

2011-03-08 Thread radhames brito
On Tue, Mar 8, 2011 at 12:07 PM, A. Mcbomb  wrote:

> I am passing several params from my view but need to put some logic
> behind one of them. I pass a value of either "Yes" or "No" from my view
> to the controller with the param known as "completed" under "update".
>
> Here is my controller and view which works fine:
>
> view->
>
> <%= form_tag :action => 'update', :id => @project %>
> <% form_for :project do |f| -%>
> 
> 
> Project Name
> <%= f.text_field :name %>
> 
> <%= f.label :completed %>
> <%= f.select(:completed, ["No", "Yes"] )%>
> 
> <%= submit_tag 'Submit' %>
> <%= form_tag %>
> <% end -%>
>
> controller->
>
> def update
>  @project = Project.find(params[:id])
>  if @project.update_attributes(params[:project])
>   redirect_to :action => 'index', :id => @project
>  else
>  render :action => 'edit'
>  end
> end
>
> I would like to add some logic to do something if the "completed" param
> is equal to "Yes". Here is my attempt but it doesn't work:
>
> def update
>  @project = Project.find(params[:id])
>  if @project.update_attributes(params[:project])
>if params[:completed] == "Yes" do "something here" end
>   redirect_to :action => 'index', :id => @project
>  else
>  render :action => 'edit'
>  end
> end
>
> Can anyone help me put some logic in for just the value of the completed
> param?
>
>
you have a form inside another form. change it to



<% form_for @project do |f| -%>


Project Name
<%= f.text_field :name %>

<%= f.label :completed %>
<%= f.select(:completed, ["No", "Yes"] )%>

<%= submit_tag 'Submit' %>
<%= form_tag %>
<% end -%>


catch what you want like this params[:project][:completed]

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



[Rails] Re: Rails3 Model without ActiveRecord

2011-03-08 Thread lix
So just to answer my question:


 def self.find(key)
return @h[key]
  end

Where h is the hash I have created from the file.

Thanks all,

I.


On Mar 8, 1:58 pm, lix  wrote:
> Hi,
>
> I was reading about ActiveModel to ride rails without ActiveRecord,
> but the documentation doesn't include info about find, and how to
> implement search functionality.
>
> I need to do the following:
>
> - i have a simple controller which get 2 parameters (:country, :city)
> - i would like to implement a simple search which returns the
> population of the city
>
> Controller code:
>
> @country =  params[:country]
> @city = params[:city]
> @population = Population.find(:country => @country, :city => @city)
>
> How should I implement find in the model? The data is in plain text
> files(don't ask), and I can look up in it using country_city as key
> and the population as value (simple hash).
>
> Thank you in advance,
> Istvan

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



[Rails] jw_player_helper, IE8, no full screen

2011-03-08 Thread Ralph Shnelvar
I have some code that displays flash (flv) video. This code runs
perfectly in FireFox, Chrome, and Safari.

IE8 plays the video but I am unable to get IE8 to get the video to go
full screen by pressing the "full screen" button.

I am using jw_player_helper.

Some of the relevant HAML code follows:

- - - - -

  - javascript('swfobject.js')


  = player( {:file =>
 '/videolib//UltraDedup-Server-Suspend-Put-002.flv'},
 {:width => '100%'} )

- - - - -


Anyone know how to get full screen for a flash video under IE8?

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

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



[Rails] Can I disable Observers from a single controller method?

2011-03-08 Thread Walter Lee Davis
I need to stop an after_update Observer method from running, but only  
in one method of a related controller. I want to be able to change the  
sort order in acts_as_list without triggering the whole after_update  
business, since nothing that that Observer was interested in has  
actually happened.


Alternatively, is there a finer-grained way to call the Observer?  
Something like Prototype.js's synthetic events as defined in  
Event.fire()?


Thanks,

Walter

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



[Rails] Re: implementation feedback appreciated

2011-03-08 Thread Jeff Lewis
Hi Erwin,

What you're wanting to do really should be done using asynchronous
processing.  Progress monitoring has two simultaneous things going on:
the potentially long-running work being performed; and the monitoring
of that work's progress.  Synchronous processing implies that only one
thing can be done at a time (thus no work being performed at the same
time as monitoring of that work).

Typically such process monitoring is done by firing the long-running
work in a background process, and then rendering in the ui that that
(async) process has started.  From then on, until the work is
completed, on some periodic basis you check on the status of that work
and update the progress in the ui (and possibly provide a way to kill
the process and/or undo/rollback if taking too long, or too many
errors, or ...).

I guess if you really didn't want to go with async processing/
monitoring for your particular project, an alternative strategy would
be to break down the total work into incremental bits of work that
could be performed one at a time synchronously, ie display the list of
items of work that need to be done to the admin, and then have the
admin fire them one at a time, so that that item alone is processed
and when done updates the ui, in order until all work is completed.

Note that this type of strategy may not really be possible, nor
preferable really compared to just doing it the right way ...
async'ly.

Jeff

On Mar 7, 1:50 pm, Erwin  wrote:
> I'll appreciate any feedback on how to implement the following
> scenario :
>
> As an authenticated administrator
> When I follow "Reload the collections"
> Then the reloading page is displayed
> And for each collection N read from an external file N
>    - When the collection is processed (reloaded into the database or
> failure)
>    - I can see a sequential status line displayed on the reloading
> page
> And when all collection files are processed
> I can see a final status line displayed on the reloading page
>
> Its basically a workflow followup on the displayed on a page
> the admin see the progress of this workflow ( new line added after
> each collection is processed)
> the admin can cancel the processing by clicking on a Cancel button
>
> the collection processing is not  a lengthy process, so starting a
> background process would not be necessary, my concern (and
> questioning) is more about synchronizing the processes and the display
> of the workflow...
>
> any suggestion will be appreciated 

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



Re: [Rails] Re: purpose of Factory girl?

2011-03-08 Thread Colin Law
On 8 March 2011 15:47, Gaba Luschi  wrote:
> Thanks - what exactly are fixtures?

Have a look through the Rails Guides.

Work through the free tutorial at railstutorial.org and many of the
basic things that you have been asking about will become clear.  Other
things may become less clear of course :)

Colin

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



Re: [Rails] Comment creer un formulaire maitre-detail

2011-03-08 Thread Mickael Gerard
Salut,

Oui tu peux tout à fait gérer un formulaire maitre esclave sur une page.

Je t'invite à regarder la vidéo suivante pour t'inspirer de la méthode afin
de l'adapter à ta version de rails :
http://railscasts.com/episodes/75-complex-forms-part-3

Petite remarque, les post rubyonrails-talk sont généralement en anglais,
pour les post en français, il y a railsfra...@googlegroups.com

Mickael

ps : For the english spoken guys, I just told Pepe that the rubyonrails-talk
posts are generally written in english and that there is a french one
railsfrance.



2011/3/8 Pepe Sanchez 

> Salut a tous!
>
> Est-il possible de creer un formulaire maitre-detail?
>
> J'ai besoin de creer une fenetre ou l'utilisateur rentre un commande et
> les differents produits associaes a cette commande.
>
> Puis-je afficher le tout dans une seule page? Faut-il un minimum de 2
> pages
>
> Comment  visualiser le detail de la commande avec tous les produits
> commandes, et l'imprimer si necessaire.
>
> Merci
>
> --
> 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.
>
>

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



[Rails] Re: purpose of Factory girl?

2011-03-08 Thread Gaba Luschi
Thanks Carlos!

-- 
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.



Re: [Rails] purpose of Factory girl?

2011-03-08 Thread radhames brito
First read about testing. Once you know what testing is all will be clear.

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



Re: [Rails] Rails 3.03 Database from sqlite3 to MySQL

2011-03-08 Thread radhames brito
1- if you want to recreate the schema use

RAILS_ENV=production rake db:load:schema

2- if you want to load initial data do

RAILS_ENV=production rake db:seed

but first fill the seeds.rb file properly



all this should be automatic with Capistrano by creating the proper recipe

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



Re: [Rails] Noob Question about params in my controller

2011-03-08 Thread Tim Harding
Hi,

You can remove the form_tag. form_for will create that for you.

Then use something like:

f.label :completed
f.select(:completed, [['Yes', true],['No', false]])

Presumably Project has a boolean field called 'completed' with probably a
:default => false on the migration.

Once you've updated your attributes you should probably just use:

if @project.completed?
  # do something clever here...
end



On 8 March 2011 16:07, A. Mcbomb  wrote:

> I am passing several params from my view but need to put some logic
> behind one of them. I pass a value of either "Yes" or "No" from my view
> to the controller with the param known as "completed" under "update".
>
> Here is my controller and view which works fine:
>
> view->
>
> <%= form_tag :action => 'update', :id => @project %>
> <% form_for :project do |f| -%>
> 
> 
> Project Name
> <%= f.text_field :name %>
> 
> <%= f.label :completed %>
> <%= f.select(:completed, ["No", "Yes"] )%>
> 
> <%= submit_tag 'Submit' %>
> <%= form_tag %>
> <% end -%>
>
> controller->
>
> def update
>  @project = Project.find(params[:id])
>  if @project.update_attributes(params[:project])
>   redirect_to :action => 'index', :id => @project
>  else
>  render :action => 'edit'
>  end
> end
>
> I would like to add some logic to do something if the "completed" param
> is equal to "Yes". Here is my attempt but it doesn't work:
>
> def update
>  @project = Project.find(params[:id])
>  if @project.update_attributes(params[:project])
>if params[:completed] == "Yes" do "something here" end
>   redirect_to :action => 'index', :id => @project
>  else
>  render :action => 'edit'
>  end
> end
>
> Can anyone help me put some logic in for just the value of the completed
> param?
>
> 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.
>
>


-- 
Tim Harding

Well Informed Ltd
Registered in England & Wales
Company number 06707839
Registered office: Suite 235, 77 Beak St, London, W1F 9DB

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



Re: [Rails] Noob Question about params in my controller

2011-03-08 Thread Colin Law
On 8 March 2011 16:07, A. Mcbomb  wrote:
> I am passing several params from my view but need to put some logic
> behind one of them. I pass a value of either "Yes" or "No" from my view
> to the controller with the param known as "completed" under "update".
>
> Here is my controller and view which works fine:
>
> view->
>
> <%= form_tag :action => 'update', :id => @project %>
> <% form_for :project do |f| -%>
> 
> 
> Project Name
> <%= f.text_field :name %>
> 
> <%= f.label :completed %>
> <%= f.select(:completed, ["No", "Yes"] )%>
> 
> <%= submit_tag 'Submit' %>
> <%= form_tag %>
> <% end -%>
>
> controller->
>
> def update
>  @project = Project.find(params[:id])
>  if @project.update_attributes(params[:project])
>   redirect_to :action => 'index', :id => @project
>  else
>  render :action => 'edit'
>  end
> end
>
> I would like to add some logic to do something if the "completed" param
> is equal to "Yes". Here is my attempt but it doesn't work:
>
> def update
>  @project = Project.find(params[:id])
>  if @project.update_attributes(params[:project])
>    if params[:completed] == "Yes" do "something here" end

When you say it does not work what do you mean?  If it is just a
syntax error that is because you have not got the syntax for 'if'
right, it should be
if params[:completed] == "Yes"
  .
end
Note however that you are doing it *after* the record is saved, which
happens in update_attributes.  If you are trying to do it before the
save then move it up to before the update.

Colin

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



Re: [Rails] Windows /RailsInstaller- Webrick starts but welcome page doesn't load

2011-03-08 Thread Colin Law
On 8 March 2011 15:37, Jazmin  wrote:
> Good idea, I will carefully compare it against a working one tonight.
> The browser just hangs, trying to load until I stop the server.

The fact that it hangs and then (I assume) says host not available
when you stop the server means that in some sense it has 'got through'
to the server and rules out basic access to localhost problems (such
as one might get with a misconfigured firewall).

Colin

> Thanks for your help.. I will take a look later..
> I just thought somebody might have had this problem before ;)
>
> On Tue, Mar 8, 2011 at 9:31 AM, Colin Law  wrote:
>>
>> On 8 March 2011 15:20, Jazmin  wrote:
>> > I don't have the actual output right now but it doesn't show anything
>> > out of
>> > the normal
>> > Booting webrick
>> > pid start port 3000 etc
>>
>> Have you compared it carefully against a working run of webrick?
>>
>> > I simply go to http://localhost:3000/ and then nothing.. the server
>> > doesn't
>> > show anything, the logs don't show anything either. I tried removing the
>> > index page expecting to get a route error but nothing..
>> > Just looking for ideas of what should I look at..
>>
>> Does the browser hang forever or say that it cannot access localhost:3000?
>>
>> Colin
>>
>> > Thanks!
>> >
>> > On Tue, Mar 8, 2011 at 8:37 AM, Colin Law 
>> > wrote:
>> >>
>> >> On 8 March 2011 14:11, Jazmin  wrote:
>> >> > I'm trying the RailsInstaller to get ROR installed on Windows..
>> >> > everything
>> >> > was going great(rake db:create/migrate and console working as
>> >> > expected)
>> >> > until I started the server, webrick starts but the welcome page never
>> >> > loads,
>> >> > no errors are displayed at all it just sits there forever, I looked
>> >> > at
>> >> > the
>> >> > logs and there are no errors there either
>> >> > Here is my configuration
>> >> > Windows 7
>> >> > Rails 3.0.4
>> >> > Ruby 1.8.7
>> >> > Mysql2
>> >> >
>> >>
>> >> Post the terminal output when you start webrick.
>> >> How are you attempting to view the welcome page?
>> >>
>> >> Colin
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "Ruby on Rails: Talk" group.
>> >> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> >> To unsubscribe from this group, send email to
>> >> rubyonrails-talk+unsubscr...@googlegroups.com.
>> >> For more options, visit this group at
>> >> http://groups.google.com/group/rubyonrails-talk?hl=en.
>> >>
>> >
>> >
>> >
>> > --
>> > Jazmin
>> >
>> > --
>> > You received this message because you are subscribed to the Google
>> > Groups
>> > "Ruby on Rails: Talk" group.
>> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> > To unsubscribe from this group, send email to
>> > rubyonrails-talk+unsubscr...@googlegroups.com.
>> > For more options, visit this group at
>> > http://groups.google.com/group/rubyonrails-talk?hl=en.
>> >
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> --
> Jazmin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>

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



[Rails] Noob Question about params in my controller

2011-03-08 Thread A. Mcbomb
I am passing several params from my view but need to put some logic
behind one of them. I pass a value of either "Yes" or "No" from my view
to the controller with the param known as "completed" under "update".

Here is my controller and view which works fine:

view->

<%= form_tag :action => 'update', :id => @project %>
<% form_for :project do |f| -%>


Project Name
<%= f.text_field :name %>

<%= f.label :completed %>
<%= f.select(:completed, ["No", "Yes"] )%>

<%= submit_tag 'Submit' %>
<%= form_tag %>
<% end -%>

controller->

def update
 @project = Project.find(params[:id])
  if @project.update_attributes(params[:project])
   redirect_to :action => 'index', :id => @project
 else
  render :action => 'edit'
 end
end

I would like to add some logic to do something if the "completed" param
is equal to "Yes". Here is my attempt but it doesn't work:

def update
 @project = Project.find(params[:id])
  if @project.update_attributes(params[:project])
if params[:completed] == "Yes" do "something here" end
   redirect_to :action => 'index', :id => @project
 else
  render :action => 'edit'
 end
end

Can anyone help me put some logic in for just the value of the completed
param?

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] Fragment caching and not accessing model from view

2011-03-08 Thread Colin Law
I am using fragment caching to render a select box where the contents
of the select box comes from a lengthy db query.  A simplified example
showing the problem is
<% cache 'select_box' do %>
<%= f.collection_select :variety_id, @varieties, :id, :name %>
<% end %>
where @varieties is setup in the controller.  Unfortunately this does
not achieve the desired result as the query is run even when the
select is picked up from the cache.

To get the full benefit I have to remove @varieties = Variety.all from
the controller and use
<% cache 'select_box' do %>
<%= f.collection_select :variety_id, Variety.all, :id, :name %>
<% end %>
but this breaks the rule that one should not access the model from the
view.  Is there a good solution to this problem?

Colin

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



Re: [Rails] Re: purpose of Factory girl?

2011-03-08 Thread Peter Bell
Come on man - that's what google is for. Check out some of the 101 stuff so we 
can help with anything you can't get in 2 mind on google.

Best Wishes,
Peter

On Mar 8, 2011, at 10:47 AM, Gaba Luschi wrote:

> Thanks - what exactly are fixtures?  And do Factory Girl and Machinist 
> serve the same purpose?
> 
> -- 
> 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.
> 

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



[Rails] Comment creer un formulaire maitre-detail

2011-03-08 Thread Pepe Sanchez
Salut a tous!

Est-il possible de creer un formulaire maitre-detail?

J'ai besoin de creer une fenetre ou l'utilisateur rentre un commande et
les differents produits associaes a cette commande.

Puis-je afficher le tout dans une seule page? Faut-il un minimum de 2
pages

Comment  visualiser le detail de la commande avec tous les produits
commandes, et l'imprimer si necessaire.

Merci

-- 
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.



Re: [Rails] Rails 3.03 Database from sqlite3 to MySQL

2011-03-08 Thread Hassan Schroeder
On Tue, Mar 8, 2011 at 5:25 AM, ubique  wrote:
> I have created a shopping cart using the AWD 4 book and now want to
> upload it to a server. Is there a straight forward way for me to
> export my current sqlite3 database (and its tables and data) into a
> MySQL database?

There are others (GIYF) but I've used this one:

http://blog.heroku.com/archives/2007/11/23/yamldb_for_databaseindependent_data_dumps/

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

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



Re: [Rails] Rails3 Model without ActiveRecord

2011-03-08 Thread Xavier Noria
On Tue, Mar 8, 2011 at 2:58 PM, lix  wrote:

> I was reading about ActiveModel to ride rails without ActiveRecord,
> but the documentation doesn't include info about find, and how to
> implement search functionality.
>
> I need to do the following:
>
> - i have a simple controller which get 2 parameters (:country, :city)
> - i would like to implement a simple search which returns the
> population of the city
>
> Controller code:
>
> @country =  params[:country]
> @city = params[:city]
> @population = Population.find(:country => @country, :city => @city)
>
> How should I implement find in the model? The data is in plain text
> files(don't ask), and I can look up in it using country_city as key
> and the population as value (simple hash).

Perhaps you don't even need Active Model?

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



[Rails] Re: purpose of Factory girl?

2011-03-08 Thread Gaba Luschi
Thanks - what exactly are fixtures?  And do Factory Girl and Machinist 
serve the same purpose?

-- 
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: Question on Data Modeling

2011-03-08 Thread J. Rodrigo Fuentes
Suppose I want to let a user choose different languages when filling out a
form, like English, Spanish, and Other, where Other is user-specified.

What is the best way to model this in a RoR database?  Is it better to have
a string or an integer that is converted with case-statements to mean
1=English, 2=Spanish, 3=Other...?

Thanks,
Rodrigo

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



Re: [Rails] Windows /RailsInstaller- Webrick starts but welcome page doesn't load

2011-03-08 Thread Jazmin
Good idea, I will carefully compare it against a working one tonight.
The browser just hangs, trying to load until I stop the server.

Thanks for your help.. I will take a look later..
I just thought somebody might have had this problem before ;)


On Tue, Mar 8, 2011 at 9:31 AM, Colin Law  wrote:

> On 8 March 2011 15:20, Jazmin  wrote:
> > I don't have the actual output right now but it doesn't show anything out
> of
> > the normal
> > Booting webrick
> > pid start port 3000 etc
>
> Have you compared it carefully against a working run of webrick?
>
> > I simply go to http://localhost:3000/ and then nothing.. the server
> doesn't
> > show anything, the logs don't show anything either. I tried removing the
> > index page expecting to get a route error but nothing..
> > Just looking for ideas of what should I look at..
>
> Does the browser hang forever or say that it cannot access localhost:3000?
>
> Colin
>
> > Thanks!
> >
> > On Tue, Mar 8, 2011 at 8:37 AM, Colin Law 
> wrote:
> >>
> >> On 8 March 2011 14:11, Jazmin  wrote:
> >> > I'm trying the RailsInstaller to get ROR installed on Windows..
> >> > everything
> >> > was going great(rake db:create/migrate and console working as
> expected)
> >> > until I started the server, webrick starts but the welcome page never
> >> > loads,
> >> > no errors are displayed at all it just sits there forever, I looked at
> >> > the
> >> > logs and there are no errors there either
> >> > Here is my configuration
> >> > Windows 7
> >> > Rails 3.0.4
> >> > Ruby 1.8.7
> >> > Mysql2
> >> >
> >>
> >> Post the terminal output when you start webrick.
> >> How are you attempting to view the welcome page?
> >>
> >> Colin
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "Ruby on Rails: Talk" group.
> >> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> >> To unsubscribe from this group, send email to
> >> rubyonrails-talk+unsubscr...@googlegroups.com.
> >> For more options, visit this group at
> >> http://groups.google.com/group/rubyonrails-talk?hl=en.
> >>
> >
> >
> >
> > --
> > Jazmin
> >
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscr...@googlegroups.com.
> > For more options, visit this group at
> > http://groups.google.com/group/rubyonrails-talk?hl=en.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
Jazmin

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



Re: [Rails] Bulk file upload in rails through paperclip

2011-03-08 Thread Walter Lee Davis


On Mar 8, 2011, at 12:38 AM, Amit Tomar wrote:


Hi all,
   I have a rails application running and in my application am
uploading some very large file (SAY 2GB) ,as of now am doing one  
file at
time ,but i would like to do bulk file upload in my appliaction ,I  
came

to know about Paperclip as one of plug-in for bulk file upload

 But is it possible to have bulk upload of  
very

large file (SAY 2GB) through papeclip???

My environment:

ruby 1.8.6
rails 2.2.2
mongrel 1.2.3


Could you clarify what you mean by bulk upload? Are you talking about  
individual file size? (2GB is enormous, and hard to push up an  
asymmetrical connection unless you have fiber to the curb.) Or are you  
referring to multiple files in a single upload? (Which you'd have to  
send using a Flash or Java uploader, or nightly versions of Webkit and  
the "multiple" attribute on your file input.) If the latter, are you  
possibly talking about multiple 2GB files, or a bunch of files which  
add up to 2GB?


Walter



--
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- 
t...@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscr...@googlegroups.com 
.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en 
.




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



Re: [Rails] Windows /RailsInstaller- Webrick starts but welcome page doesn't load

2011-03-08 Thread Colin Law
On 8 March 2011 15:20, Jazmin  wrote:
> I don't have the actual output right now but it doesn't show anything out of
> the normal
> Booting webrick
> pid start port 3000 etc

Have you compared it carefully against a working run of webrick?

> I simply go to http://localhost:3000/ and then nothing.. the server doesn't
> show anything, the logs don't show anything either. I tried removing the
> index page expecting to get a route error but nothing..
> Just looking for ideas of what should I look at..

Does the browser hang forever or say that it cannot access localhost:3000?

Colin

> Thanks!
>
> On Tue, Mar 8, 2011 at 8:37 AM, Colin Law  wrote:
>>
>> On 8 March 2011 14:11, Jazmin  wrote:
>> > I'm trying the RailsInstaller to get ROR installed on Windows..
>> > everything
>> > was going great(rake db:create/migrate and console working as expected)
>> > until I started the server, webrick starts but the welcome page never
>> > loads,
>> > no errors are displayed at all it just sits there forever, I looked at
>> > the
>> > logs and there are no errors there either
>> > Here is my configuration
>> > Windows 7
>> > Rails 3.0.4
>> > Ruby 1.8.7
>> > Mysql2
>> >
>>
>> Post the terminal output when you start webrick.
>> How are you attempting to view the welcome page?
>>
>> Colin
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>
>
>
> --
> Jazmin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>

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



Re: [Rails] Windows /RailsInstaller- Webrick starts but welcome page doesn't load

2011-03-08 Thread Jazmin
I don't have the actual output right now but it doesn't show anything out of
the normal
Booting webrick
pid start port 3000 etc

I simply go to http://localhost:3000/ and then nothing.. the server doesn't
show anything, the logs don't show anything either. I tried removing the
index page expecting to get a route error but nothing..

Just looking for ideas of what should I look at..

Thanks!


On Tue, Mar 8, 2011 at 8:37 AM, Colin Law  wrote:

> On 8 March 2011 14:11, Jazmin  wrote:
> > I'm trying the RailsInstaller to get ROR installed on Windows..
> everything
> > was going great(rake db:create/migrate and console working as expected)
> > until I started the server, webrick starts but the welcome page never
> loads,
> > no errors are displayed at all it just sits there forever, I looked at
> the
> > logs and there are no errors there either
> > Here is my configuration
> > Windows 7
> > Rails 3.0.4
> > Ruby 1.8.7
> > Mysql2
> >
>
> Post the terminal output when you start webrick.
> How are you attempting to view the welcome page?
>
> Colin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>


-- 
Jazmin

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



Re: [Rails] purpose of Factory girl?

2011-03-08 Thread Peter Bell
Replace fixtures for creating data for your tests. As app gets bigger, fixtures 
become brittle. With Factory Girl (or Machinist) you can create just the test 
data you need for a given test.

Best Wishes,
Peter

On Mar 8, 2011, at 10:13 AM, Gaba Luschi wrote:

> What's the purpose of using Factory girl?
> 
> -- 
> 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.
> 

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



[Rails] purpose of Factory girl?

2011-03-08 Thread Gaba Luschi
What's the purpose of using Factory girl?

-- 
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 gem not installing when running 'bundle install'

2011-03-08 Thread Frederick Cheung


On Mar 8, 2:59 pm, Ben Perry  wrote:
> To anyone who finds this.
>
> Bundler does install the rails gem, however. What bundler doesn't do
> is setup the Windows shortcuts in the ruby\bin directory to allow the
> rails command to work. If you 'gem install rails', those shortcuts are
> setup and then you can run the rails command.
>
if rails is in your bundle then

bundle exec rails

should run it for you even if there is no shortcut in place

Fred

> On Feb 14, 4:35 pm, Ben Perry  wrote:
>
>
>
> > bundle show rails
> > C:/system/Ruby/lib/ruby/gems/1.9.1/gems/rails-3.0.3
>
> > which is what I'd expect because its what I have specifically
> > installed, however. When I just ran bundle install, if I'd run this
> > command I wouldn't have expected to see similar output as the gem
> > wasn't there at all.
>
> > On Feb 10, 1:46 am, kaizenfury7  wrote:
>
> > > What happens when you run bundle install on your production machine?
> > > What do you see when you run:
>
> > > bundle show rails

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

2011-03-08 Thread ubique
I have created a shopping cart using the AWD 4 book and now want to
upload it to a server. Is there a straight forward way for me to
export my current sqlite3 database (and its tables and data) into a
MySQL database?

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



Re: [Rails] Rails3 Model without ActiveRecord

2011-03-08 Thread Walter Lee Davis


On Mar 8, 2011, at 8:58 AM, lix wrote:


Hi,

I was reading about ActiveModel to ride rails without ActiveRecord,
but the documentation doesn't include info about find, and how to
implement search functionality.

I need to do the following:

- i have a simple controller which get 2 parameters (:country, :city)
- i would like to implement a simple search which returns the
population of the city

Controller code:

@country =  params[:country]
@city = params[:city]
@population = Population.find(:country => @country, :city => @city)

How should I implement find in the model? The data is in plain text
files(don't ask), and I can look up in it using country_city as key
and the population as value (simple hash).


The fetch method will return the value from a given key in a hash. 
http://corelib.rubyonrails.org/classes/Hash.html#M000689

Walter



Thank you in advance,
Istvan

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




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

2011-03-08 Thread Ben Perry
To anyone who finds this.

Bundler does install the rails gem, however. What bundler doesn't do
is setup the Windows shortcuts in the ruby\bin directory to allow the
rails command to work. If you 'gem install rails', those shortcuts are
setup and then you can run the rails command.

On Feb 14, 4:35 pm, Ben Perry  wrote:
> bundle show rails
> C:/system/Ruby/lib/ruby/gems/1.9.1/gems/rails-3.0.3
>
> which is what I'd expect because its what I have specifically
> installed, however. When I just ran bundle install, if I'd run this
> command I wouldn't have expected to see similar output as the gem
> wasn't there at all.
>
> On Feb 10, 1:46 am, kaizenfury7  wrote:
>
> > What happens when you run bundle install on your production machine?
> > What do you see when you run:
>
> > bundle show rails

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



Re: [Rails] Windows /RailsInstaller- Webrick starts but welcome page doesn't load

2011-03-08 Thread Colin Law
On 8 March 2011 14:11, Jazmin  wrote:
> I'm trying the RailsInstaller to get ROR installed on Windows.. everything
> was going great(rake db:create/migrate and console working as expected)
> until I started the server, webrick starts but the welcome page never loads,
> no errors are displayed at all it just sits there forever, I looked at the
> logs and there are no errors there either
> Here is my configuration
> Windows 7
> Rails 3.0.4
> Ruby 1.8.7
> Mysql2
>

Post the terminal output when you start webrick.
How are you attempting to view the welcome page?

Colin

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



[Rails] Windows /RailsInstaller- Webrick starts but welcome page doesn't load

2011-03-08 Thread Jazmin
I'm trying the RailsInstaller to get ROR installed on Windows.. everything
was going great(rake db:create/migrate and console working as expected)
until I started the server, webrick starts but the welcome page never loads,
no errors are displayed at all it just sits there forever, I looked at the
logs and there are no errors there either

Here is my configuration
Windows 7
Rails 3.0.4
Ruby 1.8.7
Mysql2


Do any of you have any ideas or suggestions

Thanks in advance!

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



[Rails] Rails3 Model without ActiveRecord

2011-03-08 Thread lix
Hi,

I was reading about ActiveModel to ride rails without ActiveRecord,
but the documentation doesn't include info about find, and how to
implement search functionality.

I need to do the following:

- i have a simple controller which get 2 parameters (:country, :city)
- i would like to implement a simple search which returns the
population of the city

Controller code:

@country =  params[:country]
@city = params[:city]
@population = Population.find(:country => @country, :city => @city)

How should I implement find in the model? The data is in plain text
files(don't ask), and I can look up in it using country_city as key
and the population as value (simple hash).

Thank you in advance,
Istvan

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



Re: [Rails] Query Regarding Rspec

2011-03-08 Thread nishant nigam
Thanks Peter
In that link , i have found the chapter on Rspec but i have`nt found out a
chapter on Cucumber



On 8 March 2011 19:14, Peter Bell  wrote:

> Both the rspec book and rails testing prescriptions have chapters on
> cucumber. I'd thoroughly recommend them.
>
> Best Wishes,
> Peter
>
> On Mar 8, 2011, at 6:29 AM, nishant nigam wrote:
>
> Colin Thanks ...
> That link that you guys gave me is really awesome helped me a lot in rspec
> Colin if you have any such links in cucumber please send me ..
>
>
>
> thanks
> nishant
>
> On 8 March 2011 14:45, Colin Law  wrote:
>
>> On 8 March 2011 07:03, nishant  wrote:
>> > hello guys,
>> > I would like to know how to run the rspec files to test the
>> > functionality code which is written?
>> > actually i am working on a project which is currently which was
>> > previously handled by someone else and he has written some rspec code
>> > i would like to test weather the project is correctly configured on my
>> > system or not? and i would also like some help regarding rspec and
>> > cucumber??
>>
>> You were given loads of suggestions in your last post on this issue,
>> why are you asking the same question again?
>>
>> Have you worked right through some tutorials such as railstutorial.orgyet?
>>
>> Colin
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: Talk" group.
>> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> To unsubscribe from this group, send email to
>> rubyonrails-talk+unsubscr...@googlegroups.com.
>> For more options, visit this group at
>> http://groups.google.com/group/rubyonrails-talk?hl=en.
>>
>>
>
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>
>  --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>



-- 
*T**hanks and Regards*
Nishant Nigam
"Destiny is not a matter of chance,
it is a matter of choice;
it is not a thing to be waited for,
it is a thing to be achieved."

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



Re: [Rails] Query Regarding Rspec

2011-03-08 Thread Peter Bell
Both the rspec book and rails testing prescriptions have chapters on cucumber. 
I'd thoroughly recommend them.

Best Wishes,
Peter

On Mar 8, 2011, at 6:29 AM, nishant nigam wrote:

> Colin Thanks ...
> That link that you guys gave me is really awesome helped me a lot in rspec
> Colin if you have any such links in cucumber please send me ..
> 
> 
> 
> thanks
> nishant 
> 
> On 8 March 2011 14:45, Colin Law  wrote:
> On 8 March 2011 07:03, nishant  wrote:
> > hello guys,
> > I would like to know how to run the rspec files to test the
> > functionality code which is written?
> > actually i am working on a project which is currently which was
> > previously handled by someone else and he has written some rspec code
> > i would like to test weather the project is correctly configured on my
> > system or not? and i would also like some help regarding rspec and
> > cucumber??
> 
> You were given loads of suggestions in your last post on this issue,
> why are you asking the same question again?
> 
> Have you worked right through some tutorials such as railstutorial.org yet?
> 
> Colin
> 
> --
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.
> 
> 
> 
> 
> 
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to 
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/rubyonrails-talk?hl=en.

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



[Rails] Re: Error: uninitialized constant MysqlCompat::MysqlRes

2011-03-08 Thread Mariusz Nowak
Hi,

I've found the way to install gem with mysql 5.5x on Snow Leopard.
Solution is described at:
http://lightyearsoftware.com/2011/02/mysql-5-5-on-mac-os-x/

So just modify DYLD_LIBRARY_PATH and it will work - at least it fixed
issue on my side

Hope that helps.

Mariusz Nowak

guilherme p. wrote in post #985453:
> Hi,
>
> After all attempts. I simply uninstall mysql 5.5.9 (64 bits) and all
> mysql gems.
>
> Then install Mysql 5.1.55 (64 bits) and
>
> "sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-
> config=/usr/local/mysql/bin/mysql_config"
>
> and it works on MAC...
>
> Hope it helps.
>
>
> Matthew Werner wrote in post #982105:
>> Hi All,
>>
>> This has been the most thorough discussion of the topic I've found. I've
>> spent far too much time trying to get this stupid gem to work. I'm going
>> to post the information i've got and I'm praying someone out there will
>> be able to help me.
>>
>>> ruby -v
>> ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
>>> mysql --version
>> mysql  Ver 14.14 Distrib 5.5.9, for osx10.6 (i386) using readline 5.1
>>> rails -v
>> Rails 2.3.5
>>> sudo gem uninstall mysql
>> Successfully uninstalled mysql-2.8.1
>>
>> Here is where I've seen so so (SO) many different recommendations on
>> what to do. I've tried damn near everything, both sudo and not,
>> specifying my arch flags and not. I'll just go with the most thorough:
>>
>>> export ARCHFLAGS="-arch i386" ; sudo gem install --no-rdoc --no-ri mysql --
>> --with-mysql-dir=/usr/local
>> --with-mysql-config=/usr/local/mysql/bin/mysql_config
>> Building native extensions.  This could take a while...
>> Successfully installed mysql-2.8.1
>> 1 gem installed
>>
>>> rake db:migrate --trace
>> ** Invoke db:migrate (first_time)
>> ** Invoke environment (first_time)
>> ** Execute environment
>> => Environment: Development
>> ** Execute db:migrate
>> rake aborted!
>> uninitialized constant MysqlCompat::MysqlRes
>>
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:440:in
>> `load_missing_constant'
>>
>
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:80:in
>> `const_missing'
>>
>
/Library/Ruby/Gems/1.8/gems/activerecord-2.3.4/lib/active_record/connection_adapters/mysql_adapter.rb:9:in
>> `define_all_hashes_method!'
>>
>> I'm lost on what else it could be. I feel like I've tried every
>> combination. I've tried reinstalling ruby, 64bit of mysql, please help.
>> I'm out of ideas.

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

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



[Rails] Re: Writing acceptance tests is enough? Are controller/model/view tests necessary?

2011-03-08 Thread Adam Solove
The general rule is: acceptance tests are for your customers, unit and
functional tests are for you.

Well-written acceptance tests prove that users can complete entire,
potentially-complicated interactions and see the right thing on the
screen. If you are developing for a customer or with a project
manager, acceptance tests should correspond to the requirements or
user stories, and if they all pass that should prove that you have
done your job.

Well-written unit tests prove that small pieces of your code are
modular and behave correctly. A customer is not interested in them, as
they likely specify behavior about which objects send which messages
to each other.

Why have unit tests if acceptance tests prove your application works?
Well, let's say something goes wrong in an acceptance test and the
user account can't be created. You now have a fun list of things to
check:

1. Maybe the test is just written wrong.

2. Maybe the html is just getting rendered wrong.

3. Maybe the controller just isn't sending the right redirect.

4. Maybe the model validations are failing?

5. Maybe the model internal logic isn't working?

6. Maybe the controller isn't getting the right params?

7. Maybe the form isn't displaying the fields correctly?

Unit tests should cover points 4&5, functional tests would cover 3&6.
When something goes wrong in the acceptance tests, you look at the
results from the unit and functional tests to tell you where it is
going wrong.

You also use unit and functional tests to prove the behavior of your
objects in order to change your code to be better but without breaking
anything.

On Mar 8, 2:38 am, apocalyptiq  wrote:
> I'm new in BDD, i'm writing now my first app in BDD way. I'm using
> RSpec with Steak for acceptance tests (https://github.com/cavalle/steak
> ).
>
> I wrote first acceptance test for user signuping:
>
> user clicks sign up link on homepage
> fills all fields in sign up form
> clicks submit button
> checks for activation email
>
> Should I test views here? Homepage to contain Sign up link with good
> href and new user form for contain all fields and good action= and
> method="post"?
>
> Is views testing practiced in BDD at all? Or, are in BDD accteptance
> tests enough and there is no need for model/controller/view tests?
> Becouse if we test all the features, all behaviour which we want from
> our app in acceptance tests, what for would be other tests? For
> example, if we have scenario when user goes to homepage, clicks sign
> up and signs up, there is no need to even write 'should be success'
> for home controller and users controller, becouse we already test it
> in that scenario. Similar with models - if signing up and validating
> works well, there is no need for model tests.
>
> What are you think about it? What are real-life practices of BDD?

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



Re: [Rails] Re: Unicorn server works for 2 minutes, then crashes?

2011-03-08 Thread Peter De Berdt


On 08 Mar 2011, at 11:14, mattyh88 wrote:


The hosts you've listed look great, but the problem is that none of
them offer unlimited data traffic.
We have started a pretty big project, but we don't know how much data
traffic we will generate and we wouldn't like to put our site offline
when we reached our data traffic or pay expensive bills.

The host we use at the moment offers unlimited space and bandwidth,
just not enough support for rails 3 unfortunately.
So we're stuck at choosing the right host. What would be the smart
thing to do here?


Ah, the great myth of unlimited bandwidth and space. There is no such  
thing. A shared host hosts hundreds of sites from the same server or  
cluster, if one (like yours) takes too many resources in any way,  
you'll very soon discover that unlimited is not so unlimited (one of  
our customers experienced this first hand). There's always fineprint  
that clearly defines what unlimited is. Just like ISPs use a fair use  
policy and advertise it as unlimited internet.


I always find it hard to believe how people see through a $3 pure gold  
necklace scam and fall for an unlimited shared hosting solution at $5/ 
month. You always get what you pay for, and if unlimited traffic with  
an unlimited crappy service is your thing, then by all means...


You're much better off going for a more expensive scalable service. If  
your traffic increases, it usually means your income also increases  
and you can just scale your service accordingly. It will save you the  
frustrations like you have now.


As for CPanel and mongrel, cpanel basically starts the mongrel in a  
confined (and very memory limited) user shell. As soon as you exceed  
the treshold (which usually is about 60MB of RAM), they kill off your  
mongrel (best case scenario kill and restart). Rails support comes  
with cpanel these days, but it's what cpanel provides and don't expect  
the sysadmins to know or want to do anything about that all-in-one  
package they install on the server. Top that off with an outsourced  
support center that won't be able to help you out with anything Ruby  
or Rails related and you're in for a very wild and frustrating  
experience.


Previous replies have recommended some scalable VPS services, go for  
one of those, it's worth the extra buck.



Best regards

Peter De Berdt

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



Re: [Rails] Query Regarding Rspec

2011-03-08 Thread nishant nigam
Colin Thanks ...
That link that you guys gave me is really awesome helped me a lot in rspec
Colin if you have any such links in cucumber please send me ..



thanks
nishant

On 8 March 2011 14:45, Colin Law  wrote:

> On 8 March 2011 07:03, nishant  wrote:
> > hello guys,
> > I would like to know how to run the rspec files to test the
> > functionality code which is written?
> > actually i am working on a project which is currently which was
> > previously handled by someone else and he has written some rspec code
> > i would like to test weather the project is correctly configured on my
> > system or not? and i would also like some help regarding rspec and
> > cucumber??
>
> You were given loads of suggestions in your last post on this issue,
> why are you asking the same question again?
>
> Have you worked right through some tutorials such as railstutorial.orgyet?
>
> Colin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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



[Rails] Re: form_tag for search bar with Rails 3.0.5

2011-03-08 Thread Frederick Cheung


On Mar 8, 10:44 am, "Todd A. Jacobs" 
wrote:
> I have a controller and view that should be providing a search bar
> that brings up that brings up a selected record on submission. I have
> tried several variations, including just specifying the assets_path,
> but usually end up with either an error or a submission to the index
> action, rather than the show action. Currently, I have the following
> in my index.html.haml:
>
> = form_tag({:controller => 'assets', :action => 'show'}, :method
> => :GET) do
>   .field
>     =label_tag('Job
> Number').titleize
>
> %br/
>
> =number_field_tag :id
>   .actions
>     =submit_tag 'Search', :name => nil
>
> This gives me the following error:
>
>   No route matches {:controller=>"assets", :action=>"show"}

Routing happens based on the url, not on form parameters. You might
try posting to a search action that would bounce them to the
appropriate show action. Equally you could wire up some javascript to
craft the correct url client side.

Fred

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



[Rails] form_tag for search bar with Rails 3.0.5

2011-03-08 Thread Todd A. Jacobs
I have a controller and view that should be providing a search bar
that brings up that brings up a selected record on submission. I have
tried several variations, including just specifying the assets_path,
but usually end up with either an error or a submission to the index
action, rather than the show action. Currently, I have the following
in my index.html.haml:

= form_tag({:controller => 'assets', :action => 'show'}, :method
=> :GET) do
  .field
=label_tag('Job
Number').titleize
 
%br/
 
=number_field_tag :id
  .actions
=submit_tag 'Search', :name => nil

This gives me the following error:

  No route matches {:controller=>"assets", :action=>"show"}

$ rake routes | fgrep asset)
  assets GET/
assets(.:format)
{:action=>"index", :controller=>"assets"}
 POST   /
assets(.:format)
{:action=>"create", :controller=>"assets"}
   new_asset GET/assets/
new(.:format)
{:action=>"new", :controller=>"assets"}
  edit_asset GET/assets/:id/
edit(.:format)
{:action=>"edit", :controller=>"assets"}
   asset GET/
assets/:id(.:format)
{:action=>"show", :controller=>"assets"}
 PUT/
assets/:id(.:format)
{:action=>"update", :controller=>"assets"}
 DELETE /
assets/:id(.:format)
{:action=>"destroy", :controller=>"assets"}

How can I get a form_tag to take the user to /asset/123 (or whatever)
as intended?

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



[Rails] Re: Unicorn server works for 2 minutes, then crashes?

2011-03-08 Thread mattyh88
Thanks for another quick reply Phoenix :)

The hosts you've listed look great, but the problem is that none of
them offer unlimited data traffic.
We have started a pretty big project, but we don't know how much data
traffic we will generate and we wouldn't like to put our site offline
when we reached our data traffic or pay expensive bills.

The host we use at the moment offers unlimited space and bandwidth,
just not enough support for rails 3 unfortunately.
So we're stuck at choosing the right host. What would be the smart
thing to do here?

Thanks,
Mathew

On Mar 8, 9:38 am, Phoenix Rising  wrote:
> Another option for you would be to switch hosts.  Depending on your
> experience with *nix administration, you could fire up your own Amazon
> EC2 instance.  I'm not sure what you're paying your present host now,
> but generally speaking you get what you pay for.  I find that Rails
> hosting tends to be a bit more expensive, but that's probably because
> it's still relatively "new" in the marketplace (as opposed to PHP,
> Python, Perl, etc.) and have some more involved setups and needs.
>
> Some options to consider if you're looking to switch:
>  - Slicehost
>  - Linode
>  - Amazon EC2
>  - Rackspace Cloud
>  - Heroku
>  - EngineYard
>
> Some quick details to hook you up:
>  - Slicehost, Linode, Amazon EC2 and Rackspace Cloud are essentially
> the same thing: virtualized private servers that install a base OS for
> you, and it's up to you to take it from there, including installation
> and configuration of database and web server.  While you get maximum
> control, you also have the full responsibility of keeping your system
> up to date (patched against vulnerabilities, etc.).
>  - Heroku is a beast unto itself.  Both it and EngineYard are
> ultimately based on Amazon EC2, but they have special workflows and
> setups defined for hosting Rails apps.  Heroku has a no-write file
> system, so you'll have to use something like an Amazon S3 bucket to
> store uploads (like avatars, photos, etc.).  Check out Heroku's
> explanation on how things work at heroku.com for more details.
>  - EngineYard is different from Heroku in that it has some different
> tools and concepts for setting up an application, and seems to be a
> little more flexible/capable, but appears (to me, anyway) a little
> more expensive (though not by much) for smaller setups, but cheaper
> for larger ones, compared to Heroku.  As with Heroku, check out
> EngineYard's site at engineyard.com to find out how their system
> works.
>
> Good luck!
>
> On Mar 8, 1:14 am, mattyh88  wrote:
>
>
>
>
>
>
>
> > Thanks for the replies guys.
> > It appears the background process im trying to run gets killed as
> > mentioned in the above reply. I've asked if they could do something
> > about this but it isnt possible on a shared webhosting package. I
> > wonder why they can let a mongrel server run (cpanel) and not a thin,
> > passenger or unicorn ... server. I cant use mongrel cuz its only fully
> > compatible with rails 2.
>
> > Mathew
>
> > On 8 mrt, 04:21, Phoenix Rising  wrote:
>
> > > One other thing, in addition to the port issue Bryan mentioned, could
> > > be process monitoring.  The web host may have something that monitors
> > > processes by a whitelist, and terminates anything not on said list.
> > > It's a way of trying to prevent security issues such as keyloggers and/
> > > or other rogue processes from running.
>
> > > Another possibility could be some form of compilation issue, such as a
> > > missing library or something that didn't get checked during
> > > compilation (not sure how that would happen, it's just a theory).
> > > Your Unicorn process could be segfaulting after a certain amount of
> > > time due to some kind of system incompatibility.
>
> > > In any event, I think you'll need to contact a sysadmin at your host
> > > company to get to the bottom of this.  Wish I was more help man!  Good
> > > luck!
>
> > > On Mar 7, 3:12 pm, Bryan Crossland  wrote:
>
> > > > On Mon, Mar 7, 2011 at 9:18 AM, mattyh88  wrote:
> > > > > Hi,
>
> > > > > I'm trying to run my rails 3 application with webrick or unicorn. I
> > > > > have ssh access so I can start the server that way, instead of doing
> > > > > it with cPanel (which uses Mongrel).
>
> > > > > When I type 'rails s -p 12003 -d' for webrick or 'unicorn_rails -p
> > > > > 12003 -D' for unicorn, I can access my rails app at domainname/
> > > > > rails_app_name. I get the rails standard index page.
> > > > > This only works for about 2 minutes. After that, the server is
> > > > > offline.
>
> > > > > I have a deployment server here, in my local network. And when doing
> > > > > the exact same command 'rails s -D' (so on the default port) the site
> > > > > just keeps running for hours. Works like a charm.
>
> > > > > So what could be the problem? Is the application server crashing on my
> > > > > webhost? When I open the log files it's just blank.
>
> > > > Is port 12003 a valid port for listening o

Re: [Rails] Re: gem error: (Errno::EACCES) Permission denied

2011-03-08 Thread Norbert Melzer
Are you AN admin or are you THE admin? Gem tries to install in a directory
of the user named admin, if your logged in user is named mahendra and has
admin rights that is probably not enough.

Also please check if the directory exists and check the permissions on that
directory.

Top posted from android

Am 26.02.2011 09:47 schrieb "mahendra Somavarapu R." :
> I am using microsoft XP Pro-SP3 and I am facing this problem.
>
> C:\Ruby192>gem install rails --include-dependencies
> INFO: `gem install -y` is now default and will be removed
> INFO: use --ignore-dependencies to install only the gems you list
> ERROR: While executing gem ... (Errno::EACCES)
> Permission denied - C:/Documents and Settings/admin/.gem/specs
>
> Please help to complete with any idea.
>
> i am already an admin in my system?
>
> And I also tried with ctrl+shift+enter ... no use. :(
>
> --
> 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.
>

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



Re: [Rails] Query Regarding Rspec

2011-03-08 Thread Colin Law
On 8 March 2011 07:03, nishant  wrote:
> hello guys,
> I would like to know how to run the rspec files to test the
> functionality code which is written?
> actually i am working on a project which is currently which was
> previously handled by someone else and he has written some rspec code
> i would like to test weather the project is correctly configured on my
> system or not? and i would also like some help regarding rspec and
> cucumber??

You were given loads of suggestions in your last post on this issue,
why are you asking the same question again?

Have you worked right through some tutorials such as railstutorial.org yet?

Colin

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



[Rails] Re: Unicorn server works for 2 minutes, then crashes?

2011-03-08 Thread Phoenix Rising
Another option for you would be to switch hosts.  Depending on your
experience with *nix administration, you could fire up your own Amazon
EC2 instance.  I'm not sure what you're paying your present host now,
but generally speaking you get what you pay for.  I find that Rails
hosting tends to be a bit more expensive, but that's probably because
it's still relatively "new" in the marketplace (as opposed to PHP,
Python, Perl, etc.) and have some more involved setups and needs.

Some options to consider if you're looking to switch:
 - Slicehost
 - Linode
 - Amazon EC2
 - Rackspace Cloud
 - Heroku
 - EngineYard

Some quick details to hook you up:
 - Slicehost, Linode, Amazon EC2 and Rackspace Cloud are essentially
the same thing: virtualized private servers that install a base OS for
you, and it's up to you to take it from there, including installation
and configuration of database and web server.  While you get maximum
control, you also have the full responsibility of keeping your system
up to date (patched against vulnerabilities, etc.).
 - Heroku is a beast unto itself.  Both it and EngineYard are
ultimately based on Amazon EC2, but they have special workflows and
setups defined for hosting Rails apps.  Heroku has a no-write file
system, so you'll have to use something like an Amazon S3 bucket to
store uploads (like avatars, photos, etc.).  Check out Heroku's
explanation on how things work at heroku.com for more details.
 - EngineYard is different from Heroku in that it has some different
tools and concepts for setting up an application, and seems to be a
little more flexible/capable, but appears (to me, anyway) a little
more expensive (though not by much) for smaller setups, but cheaper
for larger ones, compared to Heroku.  As with Heroku, check out
EngineYard's site at engineyard.com to find out how their system
works.

Good luck!

On Mar 8, 1:14 am, mattyh88  wrote:
> Thanks for the replies guys.
> It appears the background process im trying to run gets killed as
> mentioned in the above reply. I've asked if they could do something
> about this but it isnt possible on a shared webhosting package. I
> wonder why they can let a mongrel server run (cpanel) and not a thin,
> passenger or unicorn ... server. I cant use mongrel cuz its only fully
> compatible with rails 2.
>
> Mathew
>
> On 8 mrt, 04:21, Phoenix Rising  wrote:
>
>
>
>
>
>
>
> > One other thing, in addition to the port issue Bryan mentioned, could
> > be process monitoring.  The web host may have something that monitors
> > processes by a whitelist, and terminates anything not on said list.
> > It's a way of trying to prevent security issues such as keyloggers and/
> > or other rogue processes from running.
>
> > Another possibility could be some form of compilation issue, such as a
> > missing library or something that didn't get checked during
> > compilation (not sure how that would happen, it's just a theory).
> > Your Unicorn process could be segfaulting after a certain amount of
> > time due to some kind of system incompatibility.
>
> > In any event, I think you'll need to contact a sysadmin at your host
> > company to get to the bottom of this.  Wish I was more help man!  Good
> > luck!
>
> > On Mar 7, 3:12 pm, Bryan Crossland  wrote:
>
> > > On Mon, Mar 7, 2011 at 9:18 AM, mattyh88  wrote:
> > > > Hi,
>
> > > > I'm trying to run my rails 3 application with webrick or unicorn. I
> > > > have ssh access so I can start the server that way, instead of doing
> > > > it with cPanel (which uses Mongrel).
>
> > > > When I type 'rails s -p 12003 -d' for webrick or 'unicorn_rails -p
> > > > 12003 -D' for unicorn, I can access my rails app at domainname/
> > > > rails_app_name. I get the rails standard index page.
> > > > This only works for about 2 minutes. After that, the server is
> > > > offline.
>
> > > > I have a deployment server here, in my local network. And when doing
> > > > the exact same command 'rails s -D' (so on the default port) the site
> > > > just keeps running for hours. Works like a charm.
>
> > > > So what could be the problem? Is the application server crashing on my
> > > > webhost? When I open the log files it's just blank.
>
> > > Is port 12003 a valid port for listening on with your webhost? They may be
> > > killing it after you start it.
>
> > > B.

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



[Rails] Re: Unicorn server works for 2 minutes, then crashes?

2011-03-08 Thread mattyh88
Thanks for the replies guys.
It appears the background process im trying to run gets killed as
mentioned in the above reply. I've asked if they could do something
about this but it isnt possible on a shared webhosting package. I
wonder why they can let a mongrel server run (cpanel) and not a thin,
passenger or unicorn ... server. I cant use mongrel cuz its only fully
compatible with rails 2.

Mathew

On 8 mrt, 04:21, Phoenix Rising  wrote:
> One other thing, in addition to the port issue Bryan mentioned, could
> be process monitoring.  The web host may have something that monitors
> processes by a whitelist, and terminates anything not on said list.
> It's a way of trying to prevent security issues such as keyloggers and/
> or other rogue processes from running.
>
> Another possibility could be some form of compilation issue, such as a
> missing library or something that didn't get checked during
> compilation (not sure how that would happen, it's just a theory).
> Your Unicorn process could be segfaulting after a certain amount of
> time due to some kind of system incompatibility.
>
> In any event, I think you'll need to contact a sysadmin at your host
> company to get to the bottom of this.  Wish I was more help man!  Good
> luck!
>
> On Mar 7, 3:12 pm, Bryan Crossland  wrote:
>
>
>
> > On Mon, Mar 7, 2011 at 9:18 AM, mattyh88  wrote:
> > > Hi,
>
> > > I'm trying to run my rails 3 application with webrick or unicorn. I
> > > have ssh access so I can start the server that way, instead of doing
> > > it with cPanel (which uses Mongrel).
>
> > > When I type 'rails s -p 12003 -d' for webrick or 'unicorn_rails -p
> > > 12003 -D' for unicorn, I can access my rails app at domainname/
> > > rails_app_name. I get the rails standard index page.
> > > This only works for about 2 minutes. After that, the server is
> > > offline.
>
> > > I have a deployment server here, in my local network. And when doing
> > > the exact same command 'rails s -D' (so on the default port) the site
> > > just keeps running for hours. Works like a charm.
>
> > > So what could be the problem? Is the application server crashing on my
> > > webhost? When I open the log files it's just blank.
>
> > Is port 12003 a valid port for listening on with your webhost? They may be
> > killing it after you start it.
>
> > B.

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



Re: [Rails] Re: Noob Question

2011-03-08 Thread Chris Kottom
Loves me some puzzles.

OK, I think I have the answer.  ActiveRecord::Base has a line in it:

delegate :select, :group, :order, :reorder, :except, :limit, :offset,
:joins, :where, :preload, :eager_load, :includes, :from, :lock, :readonly,
:having, :create_with, :to => :scoped

The method scoped() is defined in ActiveRecord::NamedScope::ClassMethods,
and ActiveRecord::NamedScope is included in ActiveRecord::Base.

Far from obvious, but there it is.

On Tue, Mar 8, 2011 at 7:00 AM, tinkerer13  wrote:

> On Mar 7, 10:12 pm, Bryan Crossland  wrote:
> > Exit the console and edit the class to inherit ActiveRecord::Base.
> >
> > class Foo < ActiveRecord::Base
> >
> > end
> >
> > Start the console again and re-run the command. In the bottom of that
> list
> > you will find the method "where", inherited from ActiveRecord::Base.
> >
> > B.
>
> Ok, now we're getting somewhere...
>
> Looking at the source code for ActiveRecord::Base, I do NOT see
> "where" defined on ActiveRecord::Base. Nor is it defined in any
> superclass (Object). Nor do I see it defined in the docs (under
> methods).
>
> So where the heck is it coming from?  And if it's not defined in the
> docs, how would I know about it?
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to
> rubyonrails-talk+unsubscr...@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.
>
>

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