[Rails] Recommend an image gallery with shopping cart

2012-06-10 Thread Pepe Sanchez
Hi all


Anyone can recommend a web applicaiton or a CMS to manage images and
videos that :
•  Accepts payments, needs a shopping cart based on PayPal
•  Mobilized, displays properly on Android, iPhone, Nokia, and others
•  Handles security access

-- 
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] rake about > Environment staging

2012-06-10 Thread tom
inline

On Sun, Jun 10, 2012 at 12:30 PM, Colin Law  wrote:

> On 10 June 2012 11:19, tom  wrote:
>
> Top posting still :(
>
> > yes, thats correct
> >
> > RAILS_ENV=development rake db:migrate
> >>> runs in staging env.
>
> I don't understand why you then went on to ask
> >> > where does rake get the environment info if i ommit  'RAILS_ENV' when
> >> > executing a rake command?
>
> Two points (please reply inline so that it makes it easier to follow
> the thread.  Thanks
>
> 1. How do you know that rake db:migrate is running in staging environment?
> > because the migrations are being executed on the staging-db (eg adding a
> new colum)
> 2. Please post database.yml here.
>

>> database.yml is pretty much standard:

staging:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: myproject_staging
  pool: 5
  username: myproject_dbuser
  password: myproject_dbuser
  socket: /var/run/mysqld/mysqld.sock
development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: myproject_development
  pool: 5
  username: myproject_dbuser
  password: myproject_dbuser
  socket: /var/run/mysqld/mysqld.sock
test:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: myproject_test
  pool: 5
  username: myproject_dbuser
  password: myproject_dbuser
  socket: /var/run/mysqld/mysqld.sock
production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: myproject_production
  pool: 5
  username: myproject_dbuser
  password: myproject_dbuser
  socket: /var/run/mysqld/mysqld.sock


>> as i said, starting webrick works fine in different environments,
whereas rake tasks always use "staging", no matter what specify. here a
sample of a migration:
rails g migration add name_to_testbooks name:string
/home/tom/.rvm/gems/ruby-1.9.3-p194@mygemset/gems/railties-3.2.1/lib/rails/script_rails_loader.rb:11:
warning: Insecure world writable dir /home/tom in PATH, mode 040777
/home/tom/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:211:
warning: Insecure world writable dir /home/tom in PATH, mode 040777
  invoke  active_record
  createdb/migrate/20120610111033_add.rb
tom@debian6ror3:~/rails3/myproject$ RAILS_ENV=development rake db:migrate
--trace
/home/tom/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.4/lib/bundler/runtime.rb:211:
warning: Insecure world writable dir /home/tom in PATH, mode 040777
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:migrate
==  Add: migrating

-- add_column(:testbooks, :name, :string)
   -> 0.3212s
==  Add: migrated (0.3216s)
===

** Invoke db:_dump (first_time)
** Execute db:_dump
** Invoke db:schema:dump (first_time)
** Invoke environment
** Invoke db:load_config
** Execute db:schema:dump


furthermore, removing staging from the database.yml results in rake telling
me that it doesnt find a staging adapter - even though when i run in ''dev
mode"

@rvm i installed a user-rvm, straight from the docs. does that interfere?

@ill setup a new user and rvm  again, then reusing the GEMFILE/rvmrc







> 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] custom_require.rb:36:in `require': 193: %1 is not a valid Win32 application

2012-06-10 Thread Aravind Kumar


I just installed rails using Rails installer.

and when I ran the following code:

> rails new blog
>
I got the following errors:


F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubygems/custom_re
quire.rb:36:in `require': 193: %1 is not a valid Win32 application.   - F:/dev/r
uby/RailsInstaller/Ruby1.9.3/lib/ruby/1.9.1/i386-mingw32/digest/md5.so (LoadErro
r)
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubyg
ems/custom_require.rb:36:in `require'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railt
ies-3.2.1/lib/rails/generators/app_base.rb:1:in `'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubyg
ems/custom_require.rb:36:in `require'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubyg
ems/custom_require.rb:36:in `require'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railt
ies-3.2.1/lib/rails/generators/rails/app/app_generator.rb:1:in `
'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubyg
ems/custom_require.rb:36:in `require'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubyg
ems/custom_require.rb:36:in `require'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railt
ies-3.2.1/lib/rails/commands/application.rb:24:in `'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubyg
ems/custom_require.rb:36:in `require'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubyg
ems/custom_require.rb:36:in `require'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railt
ies-3.2.1/lib/rails/cli.rb:15:in `'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubyg
ems/custom_require.rb:36:in `require'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/site_ruby/1.9.1/rubyg
ems/custom_require.rb:36:in `require'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/railt
ies-3.2.1/bin/rails:7:in `'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/bin/rails:19:in `load'
from F:/dev/ruby/RailsInstaller/Ruby1.9.3/bin/rails:19:in `'

Any thoughts on how to solve this ? 
 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/cChJUHz8TvEJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, 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: Play! 2.0 (Scala) or RubyOnRail (Ruby)?

2012-06-10 Thread Scott Eisenberg
Well put. 


On Jun 10, 2012, at 3:08 PM, Matt Jones  wrote:

> 
> 
> On Saturday, 9 June 2012 23:21:44 UTC-4, johnCode wrote:
> I'm surprise Ruby community look so quiet that most have left? 
> 
> No, but you'll find that most of us don't have time to respond to trolls. You 
> haven't made an argument, you've just stated a personal preference for Play / 
> Scala and begged others to flame you.
> 
> --Matt Jones 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/rubyonrails-talk/-/Ds6f7loUK9gJ.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, 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: Play! 2.0 (Scala) or RubyOnRail (Ruby)?

2012-06-10 Thread Matt Jones


On Saturday, 9 June 2012 23:21:44 UTC-4, johnCode wrote:
>
> I'm surprise Ruby community look so quiet that most have left? 
>

No, but you'll find that most of us don't have time to respond to trolls. 
You haven't made an argument, you've just stated a personal preference for 
Play / Scala and begged others to flame you.

--Matt Jones 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/Ds6f7loUK9gJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, 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] rake about > Environment staging

2012-06-10 Thread Colin Law
On 10 June 2012 14:25, Rick  wrote:
> How about running: "export RAILS_ENV=development ; rake about"
>
> What does rake report for Environment in this case?

I had forgotten rake about, what does rake about show without setting RAILS_ENV?

Colin

>
>
> On Sunday, June 10, 2012 6:30:39 AM UTC-4, Colin Law wrote:
>>
>> On 10 June 2012 11:19, tom  wrote:
>>
>> Top posting still :(
>>
>> > yes, thats correct
>> >
>> > RAILS_ENV=development rake db:migrate
>> >>> runs in staging env.
>>
>> I don't understand why you then went on to ask
>> >> > where does rake get the environment info if i ommit  'RAILS_ENV' when
>> >> > executing a rake command?
>>
>> Two points (please reply inline so that it makes it easier to follow
>> the thread.  Thanks
>>
>> 1. How do you know that rake db:migrate is running in staging environment?
>>
>> 2. Please post database.yml here.
>>
>> Colin
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To view this discussion on the web visit
> https://groups.google.com/d/msg/rubyonrails-talk/-/xFP2wgVxtEAJ.
>
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, 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] rake about > Environment staging

2012-06-10 Thread Rick
How about running: "export RAILS_ENV=development ; rake about"

What does rake report for Environment in this case?

On Sunday, June 10, 2012 6:30:39 AM UTC-4, Colin Law wrote:
>
> On 10 June 2012 11:19, tom  wrote: 
>
> Top posting still :( 
>
> > yes, thats correct 
> > 
> > RAILS_ENV=development rake db:migrate 
> >>> runs in staging env. 
>
> I don't understand why you then went on to ask 
> >> > where does rake get the environment info if i ommit  'RAILS_ENV' when 
> >> > executing a rake command? 
>
> Two points (please reply inline so that it makes it easier to follow 
> the thread.  Thanks 
>
> 1. How do you know that rake db:migrate is running in staging environment? 
>
> 2. Please post database.yml here. 
>
> Colin 
>

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



[Rails] Re: A simple csv import function to my Rails application

2012-06-10 Thread Linus Pettersson
Have you added

*require* 'csv'

?


Den lördagen den 9:e juni 2012 kl. 19:07:49 UTC+2 skrev Ruby-Forum.com User:
>
> Colin Law wrote in post #1063851: 
> > On 9 June 2012 16:42, Anders Andrew  wrote: 
> >> I am quite new to Rails, so nothing fancy. Preferably some basic code 
> in 
> >> View, Controller and Model. 
> >> 
> >> My sqlite3 database has a table that contains the corresponding 
> columns. 
> > 
> > Which bit do you need help with, the upload or parsing the data?  If 
> > the upload have you tried googling for rails upload? 
> > 
> > Colin 
>
> Hi Colin. 
>
> I think that what I am looking for is something this: 
>
> http://stdlib.rubyonrails.org/libdoc/csv/rdoc/classes/CSV/Reader.html 
>
> I have tryed implementing the one from this article: 
>
>
> http://satishonrails.wordpress.com/2007/07/18/how-to-import-csv-file-in-rails/
>  
>
> But get this error message: "uninitialized constant CSV::Reader". 
>
> -- 
> 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 view this discussion on the web visit 
https://groups.google.com/d/msg/rubyonrails-talk/-/HU3c-ndtz4cJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, 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] rake about > Environment staging

2012-06-10 Thread Colin Law
On 10 June 2012 11:19, tom  wrote:

Top posting still :(

> yes, thats correct
>
> RAILS_ENV=development rake db:migrate
>>> runs in staging env.

I don't understand why you then went on to ask
>> > where does rake get the environment info if i ommit  'RAILS_ENV' when
>> > executing a rake command?

Two points (please reply inline so that it makes it easier to follow
the thread.  Thanks

1. How do you know that rake db:migrate is running in staging environment?

2. Please post database.yml here.

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] rake about > Environment staging

2012-06-10 Thread tom
yes, thats correct

RAILS_ENV=development rake db:migrate
>> runs in staging env.

thx




On Sun, Jun 10, 2012 at 9:36 AM, Colin Law  wrote:

> On 9 June 2012 23:10, tom  wrote:
> > no, it executes eg the migrations on the staging-db, but if i start up
> > webrick via "rails s" it comes up the standard development environment
>
> Since you have top posted (rather than inline) I am not certain what
> you are saying no to.  Are you saying that if you do
> RAILS_ENV=development rake db:migrate
> that it runs on the staging environment and not development?
>
> Colin
>
> >
> > where does rake get the environment info if i ommit  'RAILS_ENV' when
> > executing a rake command?
> >
> > thx
> >
> >
> > On Sat, Jun 9, 2012 at 10:21 PM, Colin Law 
> wrote:
> >>
> >> On 9 June 2012 20:11, tom  wrote:
> >> > hi,
> >> > its just a simple rake import tasks (using :environment, but all my
> rake
> >> > commands are affected, even a migration goes straight to staging...
> >> >
> >> > namespace :import do
> >> >   desc "import automobiles step1"
> >> >   task :automobiles => :environment do
> >> > .
> >> > 
> >> >
> >> >> i've checked everything for staging, but i dont see what could point
> >> >> towards staging. ill try to setup a new system-user and rerun rvm
> setup
> >> >> with
> >> >> the same rvmrc file...
> >>
> >> Does it run ok if you do something like
> >> RAILS_ENV=development rake .
> >>
> >> >
> >> > thx for any pointers
> >> >
> >> >
> >> >
> >> >
> >> > On Sat, Jun 9, 2012 at 8:51 PM, Oscar Del Ben
> >> > 
> >> > wrote:
> >> >>
> >> >> what's the content of Rakefile?
> >> >>
> >> >> --
> >> >> Oscar Del Ben
> >> >> Sent with Sparrow
> >> >>
> >> >> On Friday, June 8, 2012 at 12:14 PM, tom wrote:
> >> >>
> >> >> its empty
> >> >>
> >> >> here are some values from 'env'
> >> >>
> >> >> MY_RUBY_HOME=/home/tom/.rvm/rubies/ruby-1.9.3-p194
> >> >> rvm_bin_path=/home/tom/.rvm/bin
> >> >> GEM_HOME=/home/tom/.rvm/gems/ruby-1.9.3-p194@mygemset
> >> >> TERM=xterm
> >> >> SHELL=/bin/bash
> >> >> IRBRC=/home/tom/.rvm/rubies/ruby-1.9.3-p194/.irbrc
> >> >> rvm_path=/home/tom/.rvm
> >> >> escape_flag=1
> >> >> rvm_prefix=/home/tom
> >> >> MAIL=/var/mail/tom
> >> >>
> >> >>
> >> >> PATH=/home/tom/.rvm/gems/ruby-1.9.3-p194@mygemset
> /bin:/home/tom/.rvm/gems/ruby-1.9.3-p194@global
> /bin:/home/tom/.rvm/rubies/ruby-1.9.3-p194/bin:/home/tom/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/var/lib/gems/1.8/bin
> >> >> LANG=en_US.UTF-8
> >> >> _second=1
> >> >> rvm_version=1.14.1 (stable)
> >> >> SHLVL=1
> >> >> HOME=/home/tom
> >> >> _first=0
> >> >> LOGNAME=tom
> >> >>
> >> >>
> >> >> GEM_PATH=/home/tom/.rvm/gems/ruby-1.9.3-p194@mygemset
> :/home/tom/.rvm/gems/ruby-1.9.3-p194@global
> >> >> install_flag=1
> >> >> RUBY_VERSION=ruby-1.9.3-p194
> >> >> _=/usr/bin/env
> >> >>
> >> >>
> >> >> i did delete all rvm stuff, rebooted and reinstalled rvm. this is my
> >> >> rvmrc
> >> >> file:
> >> >> rvm_trust_rvmrcs_flag=1
> >> >> rvm use ruby-1.9.3-p194@mygemset --create
> >> >>
> >> >> thx
> >> >>
> >> >>
> >> >> On Fri, Jun 8, 2012 at 6:32 PM, Oscar Del Ben
> >> >>  wrote:
> >> >>
> >> >> What's the output of echo $RAILS_ENV ?
> >> >>
> >> >> --
> >> >> Oscar Del Ben
> >> >> Sent with Sparrow
> >> >>
> >> >> On Friday, June 8, 2012 at 8:10 AM, tom wrote:
> >> >>
> >> >> hi,
> >> >> im using rvm + gemsets, but i dont know why rake always picks staging
> >> >> environment. i did not set this anywhere manually. any ideas?
> >> >> thx
> >> >>
> >> >> --
> >> >> You received this message because you are subscribed to the Google
> >> >> Groups
> >> >> "Ruby on Rails: Talk" group.
> >> >> To post to this group, send email to
> rubyonrails-talk@googlegroups.com.
> >> >> To unsubscribe from this group, 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.
> >> >>
> >> >>
> >> >> --
> >> >> You received this message because you are subscribed to the Google
> >> >> Groups
> >

Re: [Rails] Re: if else statement

2012-06-10 Thread Michael Pavling
On 10 June 2012 01:12, Paul McGuane  wrote:
> Hi  Michael,
> I have tried the code you suggested, though all i seem to get is every
> result as a tie. this is what I have in my
>
> #model
> def win_lose_tie
>    return :tie
>    if if schedule.for.to_i == schedule.against.to_i
>         schedule.for.to_i > schedule.against.to_i ? :win : :lose
>       end
>    end
>
>  end

Hiya,

The code I posted was a rough, un-run, first draft typed straight into
the email client, but even so, I did a little re-arrangement and
DRYing while composing, and left an extraneous "if" on the first line
of win_lose_tie. This is what it should look like (the if condition at
the end of the line is a modifier, or "guard" - not a construct that
PHP supports AFAIK ;-)

  def win_lose_tie
return :tie if schedule.for.to_i == schedule.against.to_i
schedule.for.to_i > schedule.against.to_i ? :win : :lose
  end

Bear in mind that I haven't run it - so it may need a little
debugging. The intention of my post is that you see more clearly the
direction the code should be heading towards (rather than having huge
logical constructs in your views).

> i even tried what you would do in php and had a variable set us :result

To be honest, I don't really see how "trying in PHP" is going to go
any way to solving a problem you have in Ruby - it's certainly not one
of the first debugging steps I would recommend :-/

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

2012-06-10 Thread Colin Law
On 10 June 2012 01:12, Paul McGuane  wrote:
> Hi  Michael,
> I have tried the code you suggested, though all i seem to get is every
> result as a tie. this is what I have in my
>
> #model
> def win_lose_tie
>    return :tie

It is not surprising that you always get :tie if this is the first
line in the method.  Go back and look at Michaels code again and pay
attention to newlines.  There should be only one 'if' however which
may have confused you.  It is important to make sure you understand
code that someone suggests rather than just using it.  If you cannot
understand it then work through some Ruby tutorials and if you still
cannot understand it then ask for clarification.

Also both Michael and myself suggested looking at the Rails Guide on
debugging, did you do this?  If so what did you learn when you used
those techniques to debug your code?

Colin

>    if if schedule.for.to_i == schedule.against.to_i
>         schedule.for.to_i > schedule.against.to_i ? :win : :lose
>       end
>    end
>
>  end
>
> #view
> <%= win_lose_tie_display(schedule.win_lose_tie) %>
>
> #helper
> def win_lose_tie_display(value)
>    case value
>      when :win
>        "W"
>      when :lose
>        "L"
>      when :tie
>        "T"
>      else
>        "unknown win/lose/tie value"
>    end
>  end
>
> i even tried what you would do in php and had a variable set us :result
> to return though it gave me a value of unknown win/lost
>
> 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.
>

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

2012-06-10 Thread Colin Law
On 9 June 2012 23:10, tom  wrote:
> no, it executes eg the migrations on the staging-db, but if i start up
> webrick via "rails s" it comes up the standard development environment

Since you have top posted (rather than inline) I am not certain what
you are saying no to.  Are you saying that if you do
RAILS_ENV=development rake db:migrate
that it runs on the staging environment and not development?

Colin

>
> where does rake get the environment info if i ommit  'RAILS_ENV' when
> executing a rake command?
>
> thx
>
>
> On Sat, Jun 9, 2012 at 10:21 PM, Colin Law  wrote:
>>
>> On 9 June 2012 20:11, tom  wrote:
>> > hi,
>> > its just a simple rake import tasks (using :environment, but all my rake
>> > commands are affected, even a migration goes straight to staging...
>> >
>> > namespace :import do
>> >   desc "import automobiles step1"
>> >   task :automobiles => :environment do
>> >     .
>> >     
>> >
>> >> i've checked everything for staging, but i dont see what could point
>> >> towards staging. ill try to setup a new system-user and rerun rvm setup
>> >> with
>> >> the same rvmrc file...
>>
>> Does it run ok if you do something like
>> RAILS_ENV=development rake .
>>
>> >
>> > thx for any pointers
>> >
>> >
>> >
>> >
>> > On Sat, Jun 9, 2012 at 8:51 PM, Oscar Del Ben
>> > 
>> > wrote:
>> >>
>> >> what's the content of Rakefile?
>> >>
>> >> --
>> >> Oscar Del Ben
>> >> Sent with Sparrow
>> >>
>> >> On Friday, June 8, 2012 at 12:14 PM, tom wrote:
>> >>
>> >> its empty
>> >>
>> >> here are some values from 'env'
>> >>
>> >> MY_RUBY_HOME=/home/tom/.rvm/rubies/ruby-1.9.3-p194
>> >> rvm_bin_path=/home/tom/.rvm/bin
>> >> GEM_HOME=/home/tom/.rvm/gems/ruby-1.9.3-p194@mygemset
>> >> TERM=xterm
>> >> SHELL=/bin/bash
>> >> IRBRC=/home/tom/.rvm/rubies/ruby-1.9.3-p194/.irbrc
>> >> rvm_path=/home/tom/.rvm
>> >> escape_flag=1
>> >> rvm_prefix=/home/tom
>> >> MAIL=/var/mail/tom
>> >>
>> >>
>> >> PATH=/home/tom/.rvm/gems/ruby-1.9.3-p194@mygemset/bin:/home/tom/.rvm/gems/ruby-1.9.3-p194@global/bin:/home/tom/.rvm/rubies/ruby-1.9.3-p194/bin:/home/tom/.rvm/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/var/lib/gems/1.8/bin
>> >> LANG=en_US.UTF-8
>> >> _second=1
>> >> rvm_version=1.14.1 (stable)
>> >> SHLVL=1
>> >> HOME=/home/tom
>> >> _first=0
>> >> LOGNAME=tom
>> >>
>> >>
>> >> GEM_PATH=/home/tom/.rvm/gems/ruby-1.9.3-p194@mygemset:/home/tom/.rvm/gems/ruby-1.9.3-p194@global
>> >> install_flag=1
>> >> RUBY_VERSION=ruby-1.9.3-p194
>> >> _=/usr/bin/env
>> >>
>> >>
>> >> i did delete all rvm stuff, rebooted and reinstalled rvm. this is my
>> >> rvmrc
>> >> file:
>> >> rvm_trust_rvmrcs_flag=1
>> >> rvm use ruby-1.9.3-p194@mygemset --create
>> >>
>> >> thx
>> >>
>> >>
>> >> On Fri, Jun 8, 2012 at 6:32 PM, Oscar Del Ben
>> >>  wrote:
>> >>
>> >> What's the output of echo $RAILS_ENV ?
>> >>
>> >> --
>> >> Oscar Del Ben
>> >> Sent with Sparrow
>> >>
>> >> On Friday, June 8, 2012 at 8:10 AM, tom wrote:
>> >>
>> >> hi,
>> >> im using rvm + gemsets, but i dont know why rake always picks staging
>> >> environment. i did not set this anywhere manually. any ideas?
>> >> thx
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "Ruby on Rails: Talk" group.
>> >> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> >> To unsubscribe from this group, 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.
>> >>
>> >>
>> >> --
>> >> You received this message because you are subscribed to the Google
>> >> Groups
>> >> "Ruby on Rails: Talk" group.
>> >> To post to this group, send email to rubyonrails-talk@googlegroups.com.
>> >> To unsubscribe from this group, 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.
>> >