[Rails] Re: before filter question

2011-09-02 Thread 7stud --
Frederick Cheung wrote in post #1019805:
> On Sep 2, 1:49pm, 7stud --  wrote:
>>
>>  User.find(params[:id]) will return user1
>>
>> I really don't care what happens in that case, and I don't understand
>> why that would cause my tests to fail.
>
> You're missing the point.
>

Apparently.

> The point is that in your tests params[:id]
> isn't a string

The term params[:id]  doesn't appear in my tests, so I have no idea what
you are talking about.  And in the before filter, I've showed that
params[:id] is a string:

Session id: 1
Sesssion id class: Fixnum
Params id: 3
Params id class: String

-- 
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: You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3.

2011-09-02 Thread coolesting
Both of good answers, thanks a lot.

2011/9/2 Jeremiah Dodds 

>
>
> On Fri, Sep 2, 2011 at 11:37 AM, Luis Lavena  wrote:
>
>>
>> That happens because you have rackup 1.3.2 installed and your
>> application is "locked" at rack 1.2.3
>>
>> You can use "bundle exec rackup config.ru" to workaround that.
>>
>>
> Alternatively, run "bundle install --binstubs", and then run your various
> commands with "./bin/$COMMAND"
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, 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: Issue with asset pipeline helper with Rails 3.1 final release.

2011-09-02 Thread Jim Morris
I could deploy that way although the latest capistrano does seem to have a 
builtin for assets if you load 'deploy/assets', however I want to precompile 
locally and upload the resulting public/assets. I don't want to have to 
deploy all the assets stuff to my production server and precompile on the 
server, it makes more sense to me to precompile locally.

So I'll have to write a bunch of custom stuff for capistrano to do that.

There is a discussion thread on the capistrano ML about 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/-/0Z_LzZm8WPYJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send 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: Re: rspec error: `inherited': You cannot have more than one Rails::Application (RuntimeError)

2011-09-02 Thread 7stud --
Jim ruther Nill wrote in post #1019886:
> On Sat, Sep 3, 2011 at 7:55 AM, 7stud --  wrote:
>
>> cross posted here:
>>
>>
>> http://stackoverflow.com/questions/7290186/rspec-runs-the-tests-in-another-app
>>
>>
> Haven't encountered that error before.  But googling the error message
> gives
> quite a few useful results (i think) :D
>

Nope.  Google returns no information about the error.

I have come to the conclusion that my problem has to do with the name of 
my app--it's test_app.  I created another app and after running through 
the extensive setup, I can now run rspec tests on it.  For my test_app, 
I tried deleting the gemset and reinstalling rails and all the gems, but 
I could never get the tests to work.

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

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



Re: [Rails] Re: rspec error: `inherited': You cannot have more than one Rails::Application (RuntimeError)

2011-09-02 Thread Jim Ruther Nill
On Sat, Sep 3, 2011 at 7:55 AM, 7stud --  wrote:

> cross posted here:
>
>
> http://stackoverflow.com/questions/7290186/rspec-runs-the-tests-in-another-app
>
>
Haven't encountered that error before.  But googling the error message gives
quite a few useful results (i think) :D


> --
> 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: Encoding error in sent mails

2011-09-02 Thread Nathan Le Ray
I did not have tried to display it in my mails client because I'm still in 
development.
You think the client will not be disturbed by 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/-/mZng3d6-IjgJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send 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: rspec error: `inherited': You cannot have more than one Rails::Application (RuntimeError)

2011-09-02 Thread 7stud --
cross posted here:

http://stackoverflow.com/questions/7290186/rspec-runs-the-tests-in-another-app

-- 
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: Issue with asset pipeline helper with Rails 3.1 final release.

2011-09-02 Thread Nicolas Buduroi
On Fri, Sep 2, 2011 at 6:50 PM, Jim Morris  wrote:

> the error you are getting running rake assets:precompile locally is that
> you probably do npt have the production database setup locally and for some
> reason it tries to connect to the production database, I fixed this error by
> simply creating the production database locally.
>

Well, that seems to make some sense, though I don't see why the assets
precompilation would hit the database. This is working flawlessly using rc5,
so something must have changed in Rails.

I can't help with the other problem as I am still trying to figure out how
> to deploy these assets, they really seem more trouble than they are worth ;)
>

Should be relatively easy if you're starting with 3.1, I just added this:

after('deploy:symlink', 'assets:precompile')

namespace :assets do
  desc 'Precompile assets'
  task :precompile, :roles => :app do
run "cd #{current_path}; RAILS_ENV=#{stage} rake assets:precompile"
  end
end

to the deploy.rb file, pretty standard Capistrano stuff. Never had any
problem with the RCs!

But for existing project, it's another story. One coworker tried to convert
a big project and gave up after a while as this project already used many
complex scss files with lots of @include statements.

I'm eagerly awaiting 3.1.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.



Re: [Rails] problems with oracle xe server connection

2011-09-02 Thread Hassan Schroeder
On Fri, Sep 2, 2011 at 10:24 AM, Ilya Boltnev  wrote:

> i installed:  ruby 1.9.2, rails 3.1, oracle 10g XE, rubu-oci8 2.0.6,
> gem 'activerecord-oracle_enhanced-adapter', create database user named
> 'orak' with password 'orakpass' through 127.0.0.1:8080/apex, i maked
> new application 'orak' with database.yml parameters

> ORA-12514: TNS:listener does not currently know of service requested
> in connect descriptor
> Tasks: TOP => db:create
> (See full trace by running task with --trace)

The full trace would probably be useful, and -- disclaimer: I haven't
done anything with Rails 3.1 yet *at all* -- but try something like e.g.

> development:
>  database: 127.0.0.1/orak

database: oracle:thin:@127.0.0.1:8080:xe

just for grins and see what that produces.

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

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



[Rails] Re: Issue with asset pipeline helper with Rails 3.1 final release.

2011-09-02 Thread Jim Morris
the error you are getting running rake assets:precompile locally is that you 
probably do npt have the production database setup locally and for some 
reason it tries to connect to the production database, I fixed this error by 
simply creating the production database locally.

I can't help with the other problem as I am still trying to figure out how 
to deploy these assets, they really seem more trouble than they are worth ;)


-- 
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/-/0mE3l9krLbQJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, 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] Need help with radio buttons.. Never seen this before

2011-09-02 Thread Hassan Schroeder
On Fri, Sep 2, 2011 at 2:29 PM, Bob Smith  wrote:

> What I want to do is to have a list of radio buttons, each pointing to
> that person's hoh field with only one in the list selected at a time.
> I will set a name in the household model based on the value found in
> the person model
>
> Can't find a way to do this with different variables referenced in the
> radio_button call.

So generate the radio button set using a common "name" attribute.

Have you read the radio_button doc? What part isn't clear?

-- 
Hassan Schroeder  hassan.schroe...@gmail.com
http://about.me/hassanschroeder
twitter: @hassan

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



[Rails] Re: Encoding error in sent mails

2011-09-02 Thread Frederick Cheung


On Sep 2, 7:22 pm, Nathan Le Ray  wrote:
> I'm trying to send an HTML email with Rails so I have a mailer's view with
> the format .html.haml.
>
> My email is written in French so it contains accentuated characters.
>
> In the terminal, the server shows me the following:
>
> ---
>
> Message-ID: <4e61088339572_467e3ffda3c5c818...@nelson4.home.mail>
> Subject: =?UTF-8?Q?R=C3=A9ponse_=C3=A0_un_de_vos_commentaires_sur_Syrinxoon?=
>  Tuts
> Mime-Version: 1.0
> Content-Type: text/html;
>  charset=UTF-8
> Content-Transfer-Encoding: quoted-printable
>
> 
> 
>   
>     R=C3=A9ponse =C3=A0 un de vos commentaires sur Syrinxoon Tuts<=

This actually looks normal, given that the Content-Transfer encoding
is quoted-printable.
=C3=A9 is quoted printable speak for the pair of bytes 0xC3, 0xA9,
which is the utf8 sequence for acute. Because = is special in this
encoding scheme, any literal = has to be encoded as =3D. Is your mail
client not displaying this properly?

Fred



> /title>
>     http://localhost:3000/assets/application.css'media=3D'=
> all' rel=3D'stylesheet' type=3D'text/css'>
>   
>   
>     
>       
>         
>           
>             Syrinxoon Tuts
>           
>         
>       
>     
> ...
>
> --
>
> As you can see, all special characters are replaced with weird stuff and =
> is replaced with =3D.
>
> I've read in my searches that = is a special character for the
> quoted-printable enconding so I've tried to replace the encoding with base64
> but when I did it, my email was just a little string of weird characters
> (little string = ~20-30 characters)
>
> So someone could help me to solve this issue?
>
> I'm using Rails 3.1.
>
> 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] problems with oracle xe server connection

2011-09-02 Thread Ilya Boltnev
i'm working on ubuntu 11.04; i need to create some rails application
with oracle database on local computer.
i installed:  ruby 1.9.2, rails 3.1, oracle 10g XE, rubu-oci8 2.0.6,
gem 'activerecord-oracle_enhanced-adapter', create database user named
'orak' with password 'orakpass' through 127.0.0.1:8080/apex, i maked
new application 'orak' with database.yml parameters
development:
  adapter: oracle_enhanced
  database: 127.0.0.1/orak
  username: orak
  password: oraclepass
test:
  adapter: oracle_enhanced
  database: 127.0.0.1/orak
  username: orak
  password: oraclepass
production:
  adapter: oracle_enhanced
  database: 127.0.0.1/orak
  username: orak
  password: oraclepass
next i'm doing simple scaffold, and trying to rake db:create
result:
rake db:create
Please provide the SYSTEM password for your oracle installation
>oraclepass
rake aborted!
ORA-12514: TNS:listener does not currently know of service requested
in connect descriptor
Tasks: TOP => db:create
(See full trace by running task with --trace)
but I can connect with  sqlplus orak/oraclepass@127.0.0.1
i had not work with oracle before, i had search with the google hard
and not found answer.
what i'm doing wrong?

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



[Rails] Business development Query and Quote

2011-09-02 Thread sunny
Hello,

We are a start-up company (with limited resources and budget) and are
looking for a web-developers both front-end and back-end that can
develop our website.

Our website category: A dating Website

What we are looking for: Following Pages (More details can be provided
in our product spec. upon request)

Home Page with Facebook Integration to Sign In for Users
User Registration Page/Activation Link in Email/Forgot Password
Profile Completion Pages for a User (Multiple Tabs - Data Entry, Photo/
Video Upload)
My Profile Page - Page after Login into the site
Statistical Page of User – Who viewed Profile, who sent contact
options, who received contact options, whose profiles viewed, ignore
list, interests list
Other User's Profile Page showing data, photo, video, statistics and
contact options
Different Contact Options to Contact with other users - chat, private
message, one liner, virtual gifts
Discussion Board for users
Payment Integration (credit card, google pay and paypal)
Search Option (Basic and Advanced - Will provide more details later)
Static Pages like About us, Site Map, Terms of Use, Privacy Policy,
FAQs etc.
Nightly/Weekly/Monthly Jobs of Notifying Users for any contact
received, update of new profiles etc.
Custom Logic for interaction among users.



Please let us know if above requirements match your expertise and if
you would like to know more about this project.

Thanks
Sunny

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



[Rails] Encoding error in sent mails

2011-09-02 Thread Nathan Le Ray
 

I'm trying to send an HTML email with Rails so I have a mailer's view with 
the format .html.haml.

My email is written in French so it contains accentuated characters.

In the terminal, the server shows me the following:

---

Message-ID: <4e61088339572_467e3ffda3c5c818...@nelson4.home.mail>
Subject: =?UTF-8?Q?R=C3=A9ponse_=C3=A0_un_de_vos_commentaires_sur_Syrinxoon?=
 Tuts
Mime-Version: 1.0
Content-Type: text/html;
 charset=UTF-8
Content-Transfer-Encoding: quoted-printable



  
R=C3=A9ponse =C3=A0 un de vos commentaires sur Syrinxoon Tuts<=
/title>
http://localhost:3000/assets/application.css' media=3D'=
all' rel=3D'stylesheet' type=3D'text/css'>
  
  

  

  
Syrinxoon Tuts
  

  

...

--

As you can see, all special characters are replaced with weird stuff and = 
is replaced with =3D.

I've read in my searches that = is a special character for the 
quoted-printable enconding so I've tried to replace the encoding with base64 
but when I did it, my email was just a little string of weird characters 
(little string = ~20-30 characters)

So someone could help me to solve this issue?

I'm using Rails 3.1.

Thank you.

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



[Rails] Need help with radio buttons.. Never seen this before

2011-09-02 Thread Bob Smith
I have a list of people from a render partial. Each person has a field
called hoh. This is for head of household, and shows which person in
the house that mail should be addressed to. I have seen lists of radio
button pointing to the same variable that will only allow one button
to be selected at a time to show the value the variable is/will be.

What I want to do is to have a list of radio buttons, each pointing to
that person's hoh field with only one in the list selected at a time.
I will set a name in the household model based on the value found in
the person model

Can't find a way to do this with different variables referenced in the
radio_button call.
Please help with this or show me a different way to go..
By the way, I'm using Rails 2.3.9


Thanks
Bob 

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send 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't compile assets on prod due to asset_host config && SSL requirement

2011-09-02 Thread Josh
My production asset_host config looks like this:


  config.action_controller.asset_host = Proc.new { |source, request|
if request.ssl?
  "#{request.protocol}#{request.host_with_port}"
else
  "#{request.protocol}assets#{(source.length % 4) +
1}.example.com"
end
  }


...which is more or less straight from the docs:
http://api.rubyonrails.org/classes/ActionView/Helpers/AssetTagHelper.html

When I go to assets:precompile, I get this:

$ RAILS_ENV=production bundle exec rake assets:precompile
rake aborted!
This asset host cannot be computed without a request in scope. Remove
the second argument to your asset_host Proc if you do not need the
request.

except that I can't really remove the 2nd arg because I need to
know if the request is ssl or not.  That said, I understand that a
request isn't present during the rake task to generate the assets

So how do I get out of this catch 22?

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



[Rails] rspec error: `inherited': You cannot have more than one Rails::Application (RuntimeError)

2011-09-02 Thread 7stud --
Some background:

I set up my first rails app for testing with rspec, and everything
worked fine: I could run tests, etc. Then I created a second rails app
to play around with (and a third, fourth).  But I can't get testing to
work with my second rails app.  When I cd'ed to my second app's
directory
and did this:


$ bundle exec rspec spec/

it ran the tests for my first app.  My first app has about 150 tests,
and my second app has 3 tests, so it was obviously not running the
correct tests.  In an attempt to cure that problem, I did took these
steps:

1) I closed out all windows on my computer.
2) I restarted my computer.
3)  I opened a terminal window and cd'ed into my second apps directory,
and then I did this:


$ bundle exec rpsec spec/

and I got this error:


No DRb server is running. Running in local process instead ...
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/application.rb:63:in
`inherited': You cannot have more than one Rails::Application
(RuntimeError)
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/deprecation.rb:7:in
`initialize'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/deprecation.rb:7:in
`new'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/deprecation.rb:7:in
`run'
  from
/Users/me/rails_projects/test_app/app/models/generate/config/environment.rb:9:in
`'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:454:in
`load'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:454:in
`block in load_file'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:596:in
`new_constants_in'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:453:in
`load_file'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:340:in
`require_or_load'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:300:in
`depend_on'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/activesupport-3.0.9/lib/active_support/dependencies.rb:216:in
`require_dependency'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/engine.rb:138:in
`block (2 levels) in eager_load!'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/engine.rb:137:in
`each'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/engine.rb:137:in
`block in eager_load!'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/engine.rb:135:in
`each'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/engine.rb:135:in
`eager_load!'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/application.rb:108:in
`eager_load!'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/application/finisher.rb:41:in
`block in '
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/initializable.rb:25:in
`instance_exec'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/initializable.rb:25:in
`run'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/initializable.rb:50:in
`block in run_initializers'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/initializable.rb:49:in
`each'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/initializable.rb:49:in
`run_initializers'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/application.rb:134:in
`initialize!'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/railties-3.0.9/lib/rails/application.rb:77:in
`method_missing'
  from /Users/me/rails_projects/test_app/config/environment.rb:5:in
`'
  from /Users/me/rails_projects/test_app/spec/spec_helper.rb:14:in
`require'
  from /Users/me/rails_projects/test_app/spec/spec_helper.rb:14:in
`block in '
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/spork-0.9.0.rc8/lib/spork.rb:24:in
`prefork'
  from /Users/me/rails_projects/test_app/spec/spec_helper.rb:4:in `'
  from
/Users/me/rails_projects/test_app/spec/controllers/pages_controller_spec.rb:1:in
`require'
  from
/Users/me/rails_projects/test_app/spec/controllers/pages_controller_spec.rb:1:in
`'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/core/configuration.rb:419:in
`load'
  from
/Users/me/.rvm/gems/ruby-1.9.2-p180@rails3tutorial/gems/rspec-core-2.6.4/lib/rspec/co

[Rails] Re: couldn't find file 'jquery' rails 3.1 stable mountable engine

2011-09-02 Thread Timothy W.
I thought I would post here very quickly because I was having the same
problem and utilizing the google cloud resolved the issue.  Here is what
it looks like now.

// This is a manifest file that'll be compiled into including all the
files listed below.
// Add new JavaScript/Coffee code in separate files in this directory
and they'll automatically
// be included in the compiled file accessible from
http://example.com/assets/application.js
// It's not advisable to add code directly here, but if you do, it'll
appear at the bottom of the
// the compiled file.
//
//= javascript_include_tag
'//ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js', :defer
=> true, :async => true
//= require jquery_ujs
//= require_tree .

-- 
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: Unit Testing Model Validations

2011-09-02 Thread Philip Hallstrom

On Sep 1, 2011, at 9:13 AM, 7stud -- wrote:

> Philip Hallstrom wrote in post #1019611:
>> 
>> could be false for any number of reasons -- perhaps you have a
>> validation that rejects "example.com" as a valid email address.
>> 
> 
> Does he?  Here's his model:

No, he doesn't.  Sorry, I should have been more clear.  The problem with using 
valid? is that at some point he *may* add a validation that causes the user to 
be invalid even though the password is *okay*.  Now you've got a test for 
password failing even though the password is okay and that leads to madness :)


> class User < ActiveRecord::Base
>  has_many :accounts, :dependent => :destroy
> 
>  validates :email, :presence => true
>  validates :name,  :presence => true
>  validates :password,  :presence => true,  :length =>
> { :minimum => 8, :maximum => 2000, :message => 'should be between 8
> and 2000 characters' }
>  validates :security_question, :presence => true
>  validates :security_answer,   :presence => true
>  validates :mobile_phone,  :length =>
> { :minimum => 8, :maximum => 30, :message => 'should be between 8 and
> 30 characters'}
> 
> 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.
> 

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

2011-09-02 Thread Jeremiah Dodds
On Fri, Sep 2, 2011 at 11:37 AM, Luis Lavena  wrote:

>
> That happens because you have rackup 1.3.2 installed and your
> application is "locked" at rack 1.2.3
>
> You can use "bundle exec rackup config.ru" to workaround that.
>
>
Alternatively, run "bundle install --binstubs", and then run your various
commands with "./bin/$COMMAND"

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

2011-09-02 Thread pepe
Thanks a lot Fred, I'll look into that.

On Sep 2, 11:38 am, Frederick Cheung 
wrote:
> On Sep 2, 2:46 pm, pepe  wrote:
>
> > Hi,
>
> > I am working on a mobile app that sends a post with a file (a picture)
> > "embedded" in the body of the request. It is not inside a parameter,
> > it is inside of the body. A simplified example of a curl statement to
> > simulate what the request does could be this:
>
> > curl -X POST my_path --data-binary my_file
>
> > When the request gets to the controller the contents of the file can
> > be retrieved like this:
>
> > str = self.request.body.read
>
> Looking at the code in action pack, looks like you'll have to setup
> the contents of
>
> request.env['rack.input']
>
> (not entirely sure what with)
>
> Fred
>
>
>
>
>
>
>
> > I can run my tests running a server and outside of rspec and directing
> > curl requests to localhost but that slows down the tests considerably.
> > I need to reproduce what the curl statement does from within my tests
> > and using only the server that rspec starts but I don't know how.
> > Nothing that I have tried has worked and I am kind of running out of
> > time. My latest idea (not fully explored yet) is to work with the
> > request object itself before running the POST statement but I have not
> > found a way to load the body with the binary contents of a file yet
> > and I am not sure this will actually even work.
>
> > Any help 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: rspec post with file

2011-09-02 Thread Frederick Cheung


On Sep 2, 2:46 pm, pepe  wrote:
> Hi,
>
> I am working on a mobile app that sends a post with a file (a picture)
> "embedded" in the body of the request. It is not inside a parameter,
> it is inside of the body. A simplified example of a curl statement to
> simulate what the request does could be this:
>
> curl -X POST my_path --data-binary my_file
>
> When the request gets to the controller the contents of the file can
> be retrieved like this:
>
> str = self.request.body.read
>

Looking at the code in action pack, looks like you'll have to setup
the contents of

request.env['rack.input']

(not entirely sure what with)

Fred
> I can run my tests running a server and outside of rspec and directing
> curl requests to localhost but that slows down the tests considerably.
> I need to reproduce what the curl statement does from within my tests
> and using only the server that rspec starts but I don't know how.
> Nothing that I have tried has worked and I am kind of running out of
> time. My latest idea (not fully explored yet) is to work with the
> request object itself before running the POST statement but I have not
> found a way to load the body with the binary contents of a file yet
> and I am not sure this will actually even work.
>
> Any help 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: You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3.

2011-09-02 Thread Luis Lavena
On Sep 2, 12:13 pm, coolesting  wrote:
> Hi, guys,
> I got the below error message when i  typed this command in terminal "rackup
> config.ru" ,  the file config.ru is rails 's configuration file.
>
> You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3.
> Consider using bundle exec. (Gem::LoadError)
>
> So,  how should i do , thanks a lot.

That happens because you have rackup 1.3.2 installed and your
application is "locked" at rack 1.2.3

You can use "bundle exec rackup config.ru" to workaround that.

--
Luis Lavena

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

2011-09-02 Thread pepe
> What does that mean?  Are you saying that the html element for the file
> upload doesn't have a name attribute?  Well, then give it one.

There is no HTML element for the file upload The request is built by a
cell phone application, not a browser, it has parameter values (e.g.:
the file name) but the file contents don't have a name associated to
it. I don't control what the phone is sending so I can't just give it
a name.

> > I can run my tests running a server and outside of rspec and directing
> > curl requests to localhost
>
> Huh?  What are you trying to test specifically?

What I am trying to test is the upload of the file itself from within
rspec, without the use of curl. Currently I need to start a rails
server as localhost and use curl to send the request to it, instead of
using rspec's started server. I am yet to find a way to 'load' the
file in the request that I want to send to rspec's server the same way
the cell phone does.

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



[Rails] Re: rspec post with file

2011-09-02 Thread 7stud --
pepe wrote in post #1019809:
> Hi,
>
> I am working on a mobile app that sends a post with a file (a picture)
> "embedded" in the body of the request. I
>

What does that mean?  ALL post requests contain the data in the body of 
the request.


> it is not inside a parameter,
> it is inside of the body.
>

What does that mean?  Are you saying that the html element for the file 
upload doesn't have a name attribute?  Well, then give it one.


> A simplified example of a curl statement to
> simulate what the request does could be this:
>
> curl -X POST my_path --data-binary my_file
>
> When the request gets to the controller the contents of the file can
> be retrieved like this:
>
> str = self.request.body.read
>

I think that would be a raw dump of what's in the body of the request, 
which is different than what's in the file.


> I can run my tests running a server and outside of rspec and directing
> curl requests to localhost

Huh?  What are you trying to test specifically?

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

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



[Rails] Re: ActiveRecord concurrency issue getting next sequence value and inserting record

2011-09-02 Thread gsw
Was just reminded that when select foobars_seq.nextval id from dual is
called it should increment sequence number, and it does this even
within transaction without rollback of the sequence number, so in
theory it should not be reusing the same id gotten from the sequence
since there should be no way to get the same number from the sequence.
So, nevermind- it must be some other issue and will have to setup a
test to replicate it now, which should be fun.

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

2011-09-02 Thread Jim Ruther Nill
On Fri, Sep 2, 2011 at 8:08 PM, Leo M.  wrote:

> 1. No, in index.html.erb there's just the standard template.
>   in tag.html.erb I've tried to do several ways, none gives an error
> but none shows the tagged posts either.
> Right now I tried a simpler solution : a plain
> <%@posts.each do |post|   %>
> <%= post.tags.class %>
> <%= post.class %>
> <%end%>
>
> where @posts is
> def tag
> @posts = Post.tagged_with(params[:id])
> end
>
> under the PostsController.rb .
>
> but the shown view is just empty, not even NilClass.
>
> 2.  for this tag.html.erb view:
> <% debug @posts.each do |post| %>
>  <%= debug post.title%>
>  <%= debug post.tags %>
>  <%end%>
>
> I obtain :
> #
>
> which is referred to <% debug @posts.each do |post| %>
>
> if I add or delete debug on the others params, nothing changes.
>
> 3. Absolutely sure, from the console :
> >> a = Post.first
> => # beautiful", created_at: "2011-08-31 14:21:14", updated_at: "2011-08-31
> 14:21:14">
> >>a.tag_list
> => ["water", "landscape"]
> >>a.tags
> => [#,
> #]
>
>
so doing Post.tagged_with('water') should return the first Post record.
and going to /posts/tag/water gives a blank page? If the answer to this is
yes,
give me a copy of your code, I'll try to run it locally.


> --
> 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] rspec post with file

2011-09-02 Thread pepe
Hi,

I am working on a mobile app that sends a post with a file (a picture)
"embedded" in the body of the request. It is not inside a parameter,
it is inside of the body. A simplified example of a curl statement to
simulate what the request does could be this:

curl -X POST my_path --data-binary my_file

When the request gets to the controller the contents of the file can
be retrieved like this:

str = self.request.body.read

I can run my tests running a server and outside of rspec and directing
curl requests to localhost but that slows down the tests considerably.
I need to reproduce what the curl statement does from within my tests
and using only the server that rspec starts but I don't know how.
Nothing that I have tried has worked and I am kind of running out of
time. My latest idea (not fully explored yet) is to work with the
request object itself before running the POST statement but I have not
found a way to load the body with the binary contents of a file yet
and I am not sure this will actually even work.

Any help 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] ActiveRecord concurrency issue getting next sequence value and inserting record

2011-09-02 Thread gsw
Have an app using an old version of Rails (2.3.2). There are a handful
of servers running the application (and other applications) in
passenger. When a model is added at the same time on two servers,
sometimes one model that was just added by a user on the first server
causes another comment being added by a user on the second server to
fail.

Whenever a new model is added, it first gets the id for the object to
add by selecting the next sequence number, however it isn't doing this
and the insert as a transaction, nor is it having the database
autogenerate ids. Assuming the model is called Foobar, then this is
what it looks like it is doing:

  SQL (10.7ms)   select foobars_seq.nextval id from dual
  Foobar Create (40.2ms)   INSERT INTO foobars (..., id, ...)
VALUES(..., 13981, ...)
  Writable Large Object (75.4ms)   SELECT somefield FROM foobars WHERE
id = 13981 FOR UPDATE
Redirected to http://localhost:3000/...
Completed in 544ms (DB: 410) | 302 Found [http://localhost/...]

I have read about a few solutions to this including either using
version numbers on the models or having it raise an exception and then
doing a retry if it didn't work.

Is there a way instead to easily have it wrap the selection of the
next sequence value and the insert into a SQL transaction?

Or even better would be to have the DB autopopulate the id via the
sequence. We're using Oracle, and I found the following where Niranjan
Sarade monkeypatches OracleEnhanced Adapter's next_sequence_value
method to allow set_sequence_name 'autogenerated'. I don't mind
monkeypatching if needed, but I'd like to use something that is less
likely to run into issues if we upgrade Rails soon, since we have
other developers that might come in and help with the application
later:
http://niranjansarade.blogspot.com/2011/03/avoid-oracle-sequence-during.html

This seems like it has to be something thought about and solved many
times over. What would be the recommended way to handle this sort of
thing in this situation?

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

2011-09-02 Thread Frederick Cheung


On Sep 2, 4:33 am, Allen  wrote:
> I'm having this odd problem that I encountered, today. I want to check
> that when I upload a CSV file that it does import some records into a
> DB. Problem is that sometimes when I run RSpec it seems that it wants
> to read the uploaded file as a string, rather than an object that I am
> sending with a post request. Here's a gist of my code:
>
> https://gist.github.com/1187861
>
> With Rails 3.0.10 these specs ALL run without a problem. But with
> Rails 3.1.0 it seems to fail for just those 2 specs, but I am confused
> because they are basically copied and pasted with each other. So why
> is it that sometimes it wants to read this posted object as a String?

Earlier versions of rails let you put arbitrary objects in the params
hash, even though in the real world you could never get such params.
Rails 3.1 changes this. One side effect is that you need to use stuff
like fixture_file_upload if you want to send in files

Fred

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



[Rails] Re: before filter question

2011-09-02 Thread Frederick Cheung
On Sep 2, 1:49 pm, 7stud --  wrote:
>
>   User.find(params[:id]) will return user1
>
> I really don't care what happens in that case, and I don't understand
> why that would cause my tests to fail.

You're missing the point. The point is that in your tests params[:id]
isn't a string (because pre rails 3.1 rails didn't force this and
would allow you to create params that couldn't exist in the real
world)

Fred
>
> With both versions of the code, if the user changes the url from:
>
>  http://localhost:3000/users/1/edit
>
> to:
>
>  http://localhost:3000/users/4/edit
>
> then he will be redirected and not allowed to edit user4's info.
>
> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] Re: before filter question

2011-09-02 Thread 7stud --
Frederick Cheung wrote in post #1019792:
> On Sep 2, 12:58pm, 7stud --  wrote:
>>
>> >>> get_user_from_session.id.to_s # User with ID = 1
>> >>> User.find('1-user-name') # User with ID = 1
>>
>> > so comparing params[:id] with the User ID converted to string will not
>> > always be equal.
>>
>> I understand what you are saying, I just don't see how it's relevant to
>> my problem.
>>
> I suspect that if you inspected the two things you are comparing you'd
> see the relevance. I assume this is not using rails 3.1 ?
>
> Fred

rails 3.0.9

Your response does point out a difference in the two code snippets I 
posted:

case 1: get_user_from_session.id.to_s == params[:id]

***user1 signs in, which puts his id in the session***

If a malicious user goes to the edit page, and see this url in the 
address bar:

  http://localhost:3000/users/1/edit

and changes that to:

  http://localhost:300/users/1-user-name/edit

and refreshes the page, he will be **redirected** because:

  get_user_from_session.id.to_s  will equal '1'

and:

  params[:id] will equal '1-user-name'



case 2: get_user_from_session == User.find(params[:id])

***user1 signs in, which puts his id in the session***

If a malicious user goes to the edit page, and see this url in the
address bar:

  http://localhost:3000/users/1/edit

and changes that to:

  http://localhost:300/users/1-user-name/edit

and refreshes the page, he will be **shown his own edit** page
again because:

  get_user_from_session will return user1

and:

  User.find(params[:id]) will return user1


I really don't care what happens in that case, and I don't understand 
why that would cause my tests to fail.

With both versions of the code, if the user changes the url from:

  http://localhost:3000/users/1/edit

to:

  http://localhost:3000/users/4/edit

then he will be redirected and not allowed to edit user4's info.

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

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



[Rails] rails internationalization problem

2011-09-02 Thread Usman Ahmed
Hi,

It looks like its as easy as pie BUT, well I'm im sort of a noob in rails
right now and I'm following this tutorial

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

it told me to work with a simple helloworld appliction. a simple index file
and so on

So i followed the tutorial, added a yml file for a mock locale and added
translation for it in the file
es.yml in config/locales/ directory

everything is all set up and start the server and put in the url

http://localhost:3000/hello?locale=es

and what it does is, that it shows me the content for "default" locale
instead of the content in es.yml i just created

if however, I delete or remane es.yml file. the server gives error. file not
found

which means the URL IS being routed to translated text BUT its still picking
up the default locale content

:S

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

2011-09-02 Thread Allen
I'm having this odd problem that I encountered, today. I want to check
that when I upload a CSV file that it does import some records into a
DB. Problem is that sometimes when I run RSpec it seems that it wants
to read the uploaded file as a string, rather than an object that I am
sending with a post request. Here's a gist of my code:

https://gist.github.com/1187861

With Rails 3.0.10 these specs ALL run without a problem. But with
Rails 3.1.0 it seems to fail for just those 2 specs, but I am confused
because they are basically copied and pasted with each other. So why
is it that sometimes it wants to read this posted object as a String?

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

2011-09-02 Thread coolno9
I found the speed of delivering the page on the production server
improved over a week, but a few images still do not server without
bringing the building down. Strangely, favicon - yes that piece of
sh1t - in the public folder does not get served at all. This file has
nothing to do with assets pipeline man. It's just one of those
days

I am sure there is something missing to it.



On Sep 1, 2:14 pm, ad  wrote:
> You may just move all static assets to public folder.
> That would get them loaded without involving asset pipeline.
>
> Correct me, if I'm wrong.
>
> On Aug 31, 10:30 pm, Josh  wrote:
>
>
>
>
>
>
>
> > That sounds horrible.  I'm seeing this occur on every page load, not
> > just the first one.
>
> > On Aug 31, 2:26 pm, Martin Wawrusch  wrote:
>
> > > Consider yourself lucky, I had to deal with 5 mins on first load recently.
> > > Take a  look at the rails-dev-tweaks gem, it helps a lot. In addition to
> > > that make sure that you don't autoload all the models if you use mongoid.
>
> > > On Wed, Aug 31, 2011 at 11:21 AM, Josh  wrote:
> > > > I understand the difference between dev and prod.
>
> > > > The issue here is that in 3.0, a dev page load took half a second or
> > > > less.  It now takes upwards of 5 seconds.
>
> > > > On Aug 31, 2:15 pm, Dieter Lunn  wrote:
> > > > > In development it recompiles with every reload. In production it only
> > > > > compiles when the files change and serves up the cached version
> > > > > otherwise.
>
> > > > > Dieter Lunnhttp://ubiety.ca
>
> > > > > On Wed, Aug 31, 2011 at 1:12 PM, Josh  wrote:
> > > > > > With the release of 3.1, it seems that things have drastically 
> > > > > > changed
> > > > > > in the development workflow.
>
> > > > > > With the asset pipeline enabled, and the likes of this in my 
> > > > > > layouts:
>
> > > > > > = stylesheet_link_tag 'application', :debug => 
> > > > > > Rails.env.development?
> > > > > > = javascript_include_tag 'application', :debug =>
> > > > > > Rails.env.development?
>
> > > > > > ...every single css, js and image gets re-compiled on every single
> > > > > > request.  This takes forever.
>
> > > > > > My dev log is mostly comprised of this:
>
> > > > > > Started GET "/assets/jquery-ui-1.8.16.custom.css?body=1" for 
> > > > > > 127.0.0.1
> > > > > > at 2011-08-31 14:04:04 -0400
> > > > > > Served asset /jquery-ui-1.8.16.custom.css - 304 Not Modified (0ms)
>
> > > > > > It seems to me that the dev rails server (both webrick, and
> > > > > > passenger), is handling the request of every asset.  It didn't work
> > > > > > this way in 3.0.x. While it clearly says 304 (0ms) I can attest that
> > > > > > the overall time to process a page (and all its assets) is
> > > > > > *significantly* longer.
>
> > > > > > Here's my application.rb and development.rb - they're basically the
> > > > > > 3.1 defaults.
>
> > > > > >http://stackoverflow.com/questions/7248911/rails-3-1-force-developmen.
> > > > ..
>
> > > > > > So is there a solution here?  Even if I didn't have :debug => true 
> > > > > > in
> > > > > > my javascript/stylesheet tag, the JS and CSS files would still have 
> > > > > > to
> > > > > > be complied/generated as well as every image - which is still a
> > > > > > significant regression.
>
> > > > > > --
> > > > > > You received this message because you are subscribed to the Google
> > > > Groups "Ruby on Rails: Talk" group.
> > > > > > To post to this group, send email to 
> > > > > > rubyonrails-talk@googlegroups.com
> > > > .
> > > > > > To unsubscribe from this group, send email to
> > > > rubyonrails-talk+unsubscr...@googlegroups.com.
> > > > > > For more options, visit this group athttp://
> > > > 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] searching for [Beijing-based Back-end Developer (RUBY ON RAILS SENIOR ENGINEER)]

2011-09-02 Thread Henry Zhou
Kabam Asia is looking for a Beijing-based Back-end Developer(Ruby on
Rails) to join our Beijing game studio.  Our Beijing studio is a fully
functional We are well-funded and offer a competitive salary and
benefits.

Kabam is growing and we’re growing quickly.  We’re building games that
are changing how social games are played and the success of our games
has established us as a definitive leader in the strategic massively
multi-player social gaming space.  Our studio business model allows us
to sustain a startup culture that empowers you to drive change and
create and own the outcome of your contributions – contributions that
impact millions of gamers daily.

Think you have what it takes to make real games? We want to meet you.


* BRILLIANT RAILS backend senior engineer for a new Facebook game.

* Profitable, successful company
* You’re making GAMES

WHAT YOU'LL DO :

* Design and code new features and enhancements for a new game
* Participate in all aspects of a project life-cycle, from
specifications through QA
* Collaborate on finding and fixing bugs and scalability/optimization
issues


WHAT WE'RE LOOKING FOR

* Ruby
* Rails
* MySQL
* JavaScript / jQuery
* Scalability techniques


you can contact me by email(wang...@talentforest.com) or qq(836248)

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

2011-09-02 Thread Frederick Cheung
On Sep 2, 12:58 pm, 7stud --  wrote:
>
> >>> get_user_from_session.id.to_s # User with ID = 1
> >>> User.find('1-user-name') # User with ID = 1
>
> > so comparing params[:id] with the User ID converted to string will not
> > always be equal.
>
> I understand what you are saying, I just don't see how it's relevant to
> my problem.
>
I suspect that if you inspected the two things you are comparing you'd
see the relevance. I assume this is not using rails 3.1 ?

Fred

> --
> Posted viahttp://www.ruby-forum.com/.

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



[Rails] Re: New actions on command

2011-09-02 Thread Leo M.
1. No, in index.html.erb there's just the standard template.
   in tag.html.erb I've tried to do several ways, none gives an error 
but none shows the tagged posts either.
Right now I tried a simpler solution : a plain
<%@posts.each do |post|   %>
<%= post.tags.class %>
<%= post.class %>
<%end%>

where @posts is
def tag
@posts = Post.tagged_with(params[:id])
end

under the PostsController.rb .

but the shown view is just empty, not even NilClass.

2.  for this tag.html.erb view:
<% debug @posts.each do |post| %>
  <%= debug post.title%>
  <%= debug post.tags %>
  <%end%>

I obtain :
#

which is referred to <% debug @posts.each do |post| %>

if I add or delete debug on the others params, nothing changes.

3. Absolutely sure, from the console :
>> a = Post.first
=> #
>>a.tag_list
=> ["water", "landscape"]
>>a.tags
=> [#, 
#]

-- 
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: Re: before filter question

2011-09-02 Thread 7stud --
Jim ruther Nill wrote in post #1019785:
> On Fri, Sep 2, 2011 at 7:26 PM, 7stud --  wrote:
>
>> to the id in the url:
>>
>>  params[:id]
>>
>>
> i'm assuming that get_user_from_session returns a User object.
>

Yes.

>>> get_user_from_session.id.to_s # User with ID = 1
>>> User.find('1-user-name') # User with ID = 1
>
> so comparing params[:id] with the User ID converted to string will not
> always be equal.
>

I understand what you are saying, I just don't see how it's relevant to 
my problem.

-- 
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: before filter question

2011-09-02 Thread Jim Ruther Nill
On Fri, Sep 2, 2011 at 7:26 PM, 7stud --  wrote:

> My logic in the correct_user() before filter is: why should I have to
> search the database for the user:
>
>  user = User.find(params[:id])
>
>
> when I can just compare the id of the user in the session:
>
>  get_user_from_session.id.to_s
>
> to the id in the url:
>
>  params[:id]
>
>
i'm assuming that get_user_from_session returns a User object.

>> get_user_from_session.id.to_s # User with ID = 1
>> User.find('1-user-name') # User with ID = 1

so comparing params[:id] with the User ID converted to string will not
always be equal.


> --
> 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] Re: undefined method `model_name' for NilClass:Class in rails 3.0.0

2011-09-02 Thread Jim Ruther Nill
On Fri, Sep 2, 2011 at 7:00 PM, Pab  wrote:

> Hi,
>
>  in @employee = Employee.new, what .new describes about? and i gave
> @employee = Employee.search
> instead of that, which result in error
>
>  undefined method `search' for #
>
>
I suggest you read some tutorials first Pab


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

2011-09-02 Thread Mauro
I've created a new app with rails 3.1
Run rake db:migrate and:

==  DeviseCreateUsers: migrating ==
==  DeviseCreateUsers: migrated (0.s) =

rake aborted!
An error has occurred, this and all later migrations canceled:

private method `split' called for #

What's the problem?

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

2011-09-02 Thread 7stud --
My logic in the correct_user() before filter is: why should I have to 
search the database for the user:

  user = User.find(params[:id])


when I can just compare the id of the user in the session:

  get_user_from_session.id.to_s

to the id in the url:

  params[:id]

-- 
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: before filter question

2011-09-02 Thread 7stud --
Jim ruther Nill wrote in post #1019766:
>>
> params[:id] may not always be an integer, it can be '123-user'
>

I don't understand how that is relevant.

-- 
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: undefined method `model_name' for NilClass:Class in rails 3.0.0

2011-09-02 Thread Pab
Hi,

 in @employee = Employee.new, what .new describes about? and i gave
@employee = Employee.search
instead of that, which result in error

  undefined method `search' for #


thanks,
-pab

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, 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: undefined method `model_name' for NilClass:Class in rails 3.0.0

2011-09-02 Thread Jim Ruther Nill
On Fri, Sep 2, 2011 at 6:31 PM, Pab  wrote:

> hi
>
> def search
>  @employee
> end
>
> i have done the above, but it shows following error
>
> undefined method `model_name' for NilClass:Class
>
> Extracted source (around line #1):
>
> 1: <%= form_for(@employee) do |e| %>
> 2: <%= e.error_msg %>
> 3: EMP ID<%= e.text_field :id %>
> 4: <%= e.submit 'search', :controller => 'employees', :action =>
> 'search1' %>
>
>
you need to set @employee to something, not just declare it like that in the
controller.

@employee = Employee.new #or some other model


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

2011-09-02 Thread Jim Ruther Nill
On Fri, Sep 2, 2011 at 6:15 PM, Leo M.  wrote:

> 1. Nope. There's the main index:
>0.0.0.0:3000/posts #which is placed in =>
> /views/posts/index.html.erb
>
>   and there's the tag action:
>   0.0.0.0:3000/posts/tag/TAG_NAME #which is placed in
> /views/posts/tag.html.erb
>
>
what i'm asking is if they have the same code.


> 2. Nope. But I didn't get the right post neither before. Changing from
> (params[:name]) to (params[:id]) didn't change big things. Even though
> the url 0.0.0.0:3000/posts/tag/TAG_NAME or also
> 0.0.0.0:3000/posts/tag/TAG_ID are recognized and loaded, they don't
> display the relatives posts.
>
>
can you put a debugger inside the tag action and paste the output of
params.inspect


> 3. In routes.rb there's this line that should be sufficient as
> instruction, but maybe I'm missing something :
>   resources :posts
>match ':controller(/:action(/:id(.:format)))'
>
>
so the route that matches the url is the last one, so params[:id] should
have the tag name
in the tag action.  are you sure you have posts in your database that are
properly tagged?


> Thanks for your 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.
>
>


-- 
-
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: undefined method `model_name' for NilClass:Class in rails 3.0.0

2011-09-02 Thread Pab
hi

def search
 @employee
end

i have done the above, but it shows following error

undefined method `model_name' for NilClass:Class

Extracted source (around line #1):

1: <%= form_for(@employee) do |e| %>
2: <%= e.error_msg %>
3: EMP ID<%= e.text_field :id %>
4: <%= e.submit 'search', :controller => 'employees', :action =>
'search1' %>


thanks,
-pab

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



[Rails] Re: New actions on command

2011-09-02 Thread Leo M.
1. Nope. There's the main index:
0.0.0.0:3000/posts #which is placed in => 
/views/posts/index.html.erb

   and there's the tag action:
   0.0.0.0:3000/posts/tag/TAG_NAME #which is placed in 
/views/posts/tag.html.erb

2. Nope. But I didn't get the right post neither before. Changing from 
(params[:name]) to (params[:id]) didn't change big things. Even though 
the url 0.0.0.0:3000/posts/tag/TAG_NAME or also 
0.0.0.0:3000/posts/tag/TAG_ID are recognized and loaded, they don't 
display the relatives posts.

3. In routes.rb there's this line that should be sufficient as 
instruction, but maybe I'm missing something :
   resources :posts
   match ':controller(/:action(/:id(.:format)))'

Thanks for your 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] Re: undefined method `model_name' for NilClass:Class in rails 3.0.0

2011-09-02 Thread Jim Ruther Nill
On Fri, Sep 2, 2011 at 5:30 PM, Pab  wrote:

> Hi,
>
>
> def search
>
> end
>
>
>
>  def search1
>
>@employee = Employee.find(params[:id])
>respond_to do |format|
>  format.html{render :partial => 'show'}
>  format.xml
>end
>
>  end
>
>
>
>
>
> search.html is
>  <%= form_for(@employee) do |e| %>
>  EMP ID<%= e.text_field :id %>
>  <%= e.submit 'search', :controller => 'employees', :action =>
> 'search1' %>
>  <% end %>
>
>
the search method doesn't declare any instance variable but in the view
template,
you want to use @employee.  form_for expects @employee to be declared so
that form_for can form the url and the input field names.  so the solution
to your
problem is to just declare an @employee in the search action.


>
>
> problem is its not showing up search page itself
>
>
> thanks,
> -pab
>
> --
> You received this message because you are subscribed to the Google Groups
> "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, 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] before filter question

2011-09-02 Thread Jim Ruther Nill
On Fri, Sep 2, 2011 at 4:35 PM, 7stud --  wrote:

> I have a correct_user() before filter that passes all my tests:
>
> class UsersController < ApplicationController
>  before_filter :authenticate, :only => [:edit, :update]
>  before_filter :correct_user, :only => [:edit, :update]
>
> ...
> ...
>
>  private
>def correct_user
>  user = User.find(params[:id])
>  redirect_to(root_path) unless get_user_from_session == user
>end
>
>
> But if I change the before filter to this:
>
>   def correct_user
>  redirect_to(root_path) unless get_user_from_session.id.to_s ==
> params[:id]
>end
>
> all kinds of things start failing.  Here's an example:
>
>  1) UsersController GET edit should be successful
> Failure/Error: response.should be_success
>   expected success? to return true, got false
> # ./spec/controllers/users_controller_spec.rb:15:in `block (3
> levels) in '
>
>
> and the test:
>
>
> describe UsersController do
>  render_views
>
>  describe "GET edit" do
>before(:each) do
>  @user = Factory(:user)
>  test_sign_in(@user)
>end
>
>it "should be successful" do
>  get :edit, :id => @user
>  response.should be_success
>end
>
>
> What is the difference between:
>
>def correct_user
>  user = User.find(params[:id])
>  redirect_to(root_path) unless get_user_from_session == user
>end
>
> and:
>
>   def correct_user
>  redirect_to(root_path) unless get_user_from_session.id.to_s ==
> params[:id]
>end
>
>
params[:id] may not always be an integer, it can be '123-user'


> --
> 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] Rails 3.1 asset pipeline

2011-09-02 Thread Everaldo Gomes
Hi!

I'm a newbie, but I found this article yesterday (someone retweeted it to
me).

Take a look, maybe it would be useful:

http://merbist.com/2011/08/30/deploying-a-rails-3-1-app-gotchas/

Best Regards,
Everaldo

On Fri, Sep 2, 2011 at 6:15 AM, Michael Rigart  wrote:

> Hi,
>
> I just upgraded my existing rails 3.0.10 app to 3.1 where I wanted to
> try the new asset pipeline.
>
> Everything seemed to work fine in development, all the assets are served
> correctly.
>
> But when I wanted to test in production, the paths to the assets changed
> back to the old format without the digest ( /images/image.png) . Even
> though I precompiled the assets.
>
> The asset pipeline is enabled and everything runs on the default rails
> 3.1 settings.
>
> Anyone has a clue on what the problem might be? I ran rake rails:update
> several times to make sure I didn't miss anything.
>
> --
> 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: undefined method `model_name' for NilClass:Class in rails 3.0.0

2011-09-02 Thread Pab
Hi,


def search

end



  def search1

@employee = Employee.find(params[:id])
respond_to do |format|
  format.html{render :partial => 'show'}
  format.xml
end

  end





search.html is
 <%= form_for(@employee) do |e| %>
 EMP ID<%= e.text_field :id %>
 <%= e.submit 'search', :controller => 'employees', :action =>
'search1' %>
 <% end %>



problem is its not showing up search page itself


thanks,
-pab

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

2011-09-02 Thread Michael Rigart
Hi,

I just upgraded my existing rails 3.0.10 app to 3.1 where I wanted to
try the new asset pipeline.

Everything seemed to work fine in development, all the assets are served
correctly.

But when I wanted to test in production, the paths to the assets changed
back to the old format without the digest ( /images/image.png) . Even
though I precompiled the assets.

The asset pipeline is enabled and everything runs on the default rails
3.1 settings.

Anyone has a clue on what the problem might be? I ran rake rails:update
several times to make sure I didn't miss anything.

-- 
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] before filter question

2011-09-02 Thread 7stud --
I have a correct_user() before filter that passes all my tests:

class UsersController < ApplicationController
  before_filter :authenticate, :only => [:edit, :update]
  before_filter :correct_user, :only => [:edit, :update]

...
...

  private
def correct_user
  user = User.find(params[:id])
  redirect_to(root_path) unless get_user_from_session == user
end


But if I change the before filter to this:

   def correct_user
  redirect_to(root_path) unless get_user_from_session.id.to_s ==
params[:id]
end

all kinds of things start failing.  Here's an example:

  1) UsersController GET edit should be successful
 Failure/Error: response.should be_success
   expected success? to return true, got false
 # ./spec/controllers/users_controller_spec.rb:15:in `block (3
levels) in '


and the test:


describe UsersController do
  render_views

  describe "GET edit" do
before(:each) do
  @user = Factory(:user)
  test_sign_in(@user)
end

it "should be successful" do
  get :edit, :id => @user
  response.should be_success
end


What is the difference between:

def correct_user
  user = User.find(params[:id])
  redirect_to(root_path) unless get_user_from_session == user
end

and:

   def correct_user
  redirect_to(root_path) unless get_user_from_session.id.to_s ==
params[:id]
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: Git Issue for change repository

2011-09-02 Thread Nicolas Sebrecht
The 02/09/11, Chirag Shah wrote:
> Hello All,
> 
> I have one git issue which is as below
> On My server i am using one repo for pull code is abc/myproject.git
> Now i have fork one repo from abc/myproject.git to chirag/myproject.git
> and now i want to use chirag/myproject.git instead of abc/myproject.git
> for pull code on server
> Is there any good way for do this ?

You may use 'git remote' to change/add/del the declared remote
repository of your local git repository.

You may want to manually edit .git/config to fix your upstream branches
to the new remote repository.

-- 
Nicolas Sebrecht

-- 
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, 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: couldn't find file 'jquery' rails 3.1 stable mountable engine

2011-09-02 Thread Kurtis Rainbolt-Greene
At the very least it could be a good idea to include in the issue:
It'd be nice to know where Sprockets was looking for the file.

On Thu, Sep 1, 2011 at 11:46 PM, Jorgen Nilsson  wrote:
> Hi Kurtis,
>
> Thanks for your answer. I was thinking the same thing and I'll just
> start developing without javascript all together since I don't need it
> in the initial phase.
>
> I've also tried using and creating the engine with Rails 3.1.0rc5 and
> 3.1.0rc8 and I get the same error. Surely I can't be alone with geting
> this error?
>
> I think I'll post an issue on Github.
>
> --
> 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.
>
>



-- 
Kurtis Rainbolt-Greene:
 title: "Hacker, Designer, Author, & Father"
 address: "718 Mill Street, Springfield, OR 97477"
 phone: "(202) 643-2263"

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

2011-09-02 Thread Priyanka Pathak
Hello,
   I have used the SimpleXlsx::Serializer to create .xlsx file in
ruby.
There are 2 questions:

1. How to set format and style of cell through SimpleXlsx?
2. When i set the hyperlink in cell it shows normal text as
=HYPERLINK("http://google.com","click here") instead of Hyperlink. but
when i manually change the cell format to All then it works as per
requirement.

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