Ruby on Rails Wednesday, November 30, 2011

You should probably be using sessions, check http://apidock.com/rails/ActionController/Integration/Session    for version 2.3.8 and older (I don’t think there is a version 2.3.9?).

 

Fra: rubyonrails-talk@googlegroups.com [mailto:rubyonrails-talk@googlegroups.com] På vegne af Annapoorna R
Sendt: 1. december 2011 07:02
Til: rubyonrails-talk@googlegroups.com
Emne: [Rails] file upload

 

hello,
using rails2.3.9 ruby 1.8.7 paperclip
how to keep the file uploaded path or name of the file in the field after the page gets refreshed.so that user no need to reupload the file(It gets deleted after refresh) 

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

 

Ruby on Rails

hello,
using rails2.3.9 ruby 1.8.7 paperclip
how to keep the file uploaded path or name of the file in the field after the page gets refreshed.so that user no need to reupload the file(It gets deleted after refresh) 

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

Ruby on Rails

1. I wander why the standard way of keeping the user data in the
session does not fit you.
2. scope "(:username)", :username => /[-a-zA-Z]/ do <other routes>
end should help

On Nov 30, 11:07 pm, Dave Aronson <googlegroups2d...@davearonson.com>
wrote:
> On Wed, Nov 30, 2011 at 04:00, johnnybutler7 <johnnybutl...@gmail.com> wrote:
> > What im trying to do at the moment is have the client name after
> > the .com/ so its always presentwww.myurl.com/client_nameso i can
> > grab who the client is and use that throughout their session.
>
> > localhost:3000/{client_1}/news
> > localhost:3000/{client_2}/news
>
> Sounds like a job for Superman, er, I mean, a custom route.  Maybe
> something like:
>
>   match ':client(/:controller(/:action(/:id(.:format))))'
>
> based on the old wildcard router (adding :client at the front).  Note
> that, as advised in the modern default route.cfg files, this will make
> ALL your controllers and actions accessible via GET!  If you're OK
> with that, go for it.  Also depending on how the rest of your normal
> routes look (in particular whether you're using nested resources,
> renamed routes, etc.), you may need more such lines, which could get
> to be a pain.
>
> If you decide to try it, let me know how it works.  :-)
>
> -Dave
>
> --
> LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages.
> Where: Northern Virginia, Washington DC (near Orange Line), and remote work.
> See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence).
> Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson)

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

Ruby on Rails

Hi all

I am using four models user, member, unit, society
I have linked member, unit and society through member_property table
user has one to one association with member while all other models
have many to many association.

How do I link user to member, and user to unit through member

i wanted something like

<%= @user.member.unit.unit_number %></p>

Can someone guide how to achieve this

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

Ruby on Rails

Thank you! I was missing the difference between stubbing a method on
the Twitter::Client class vs. instantiating an object via doubling.
Once I figured this out, I fixed my tests.

On Nov 29, 3:29 pm, Frederick Cheung <frederick.che...@gmail.com>
wrote:
> On Nov 29, 6:05 pm, spinlock <atomicbroadc...@gmail.com> wrote:
>
> > Hi everyone,
>
> > I'm trying to write integration tests for my sample twitter app and
> > I'm having trouble mocking out objects in the Twitter namespace.
> > Here's the function that's giving me trouble:
>
> >   def build_twitter(omniauth)
> >     Twitter.configure do |config|
> >       config.consumer_key = TWITTER_KEY
> >       config.consumer_secret = TWITTER_SECRET
> >       config.oauth_token = omniauth['credentials']['token']
> >       config.oauth_token_secret = omniauth['credentials']['secret']
> >     end
> >     client = Twitter::Client.new
> >     user = client.current_user
> >     self.name = user.name
> >   end
>
> > and here's the test:
>
> > feature 'testing oauth' do
> >   before(:each) do
> >     @twitter = double("Twitter")
> >     @twitter.stub!(:configure).and_return true
> >     @client = double("Twitter::Client")
> >     @client.stub!(:current_user).and_return(@user)
> >     @user = double("Twitter::User")
> >     @user.stub!(:name).and_return("Tester")
> >   end
>
> You're creating @twitter, stubbing configure on it and so on, but the
> code under test is still calling Twitter.configure. Calling
> double('Twitter') doesn't replace the existing Twitter constant - you
> need to do something like Twitter.stub(:configure) (or
> Twitter.should_receive(...), similarly with Twitter::Client.new and so
> on
>
> Fred
>
> >   scenario 'twitter' do
>
> >     visit root_path
> >     login_with_oauth
>
> >     page.should have_content("Pages#home")
> >   end
> > end
>
> > But, I'm getting this error:
> > Failures:
>
> >   1) testing oauth twitter
> >      Failure/Error: login_with_oauth
> >      Twitter::Error::Unauthorized:
> >        GEThttps://api.twitter.com/1/account/verify_credentials.json:
> > 401: Invalid / expired Token
> >      # ./app/models/user.rb:40:in `build_twitter'
> >      # ./app/models/user.rb:16:in `build_authentication'
> >      # ./app/controllers/authentications_controller.rb:47:in `create'
> >      # ./spec/support/integration_spec_helper.rb:3:in
> > `login_with_oauth'
> >      # ./spec/integration/twit_test.rb:16:in `block (2 levels) in <top
> > (required)>'
>
> > Any ideas on how to make this work? I'm using rspec for mocking the
> > objects but I'm open to mocha if that's a better choice.
>
> > Thanks,
> > Andrew

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

Ruby on Rails

Hi,

It has been 2 hours that I'm stuck on setting up a rails 3 project to
test it with some Ajax with the Prototype Framework, the problem is
that the tutorial I followed is based on rails 2, and from what I
learned Rails 3 has included some JS Frameworks such Prototype and
jQuery which means that the way to implements those is also different.
help with this please

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

Ruby on Rails

Thanks Craig, this works!
And i think i've found and fixed my first bug in rails.

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

Ruby on Rails

On Nov 30, 2011, at 4:47 PM, Alexey Muranov wrote:

> Sorry for a primitive question, but how can i use a local copy of rails
> with my rails 3 application (locally)?
>
> Quick googling didn't help, and on StackOverflow there is something
> about putting local rails to the "vendor" directory, but it does not
> seem to work for me.
----
http://stackoverflow.com/questions/4516097/how-can-i-vendorize-rails-3

Craig

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

Ruby on Rails

On Nov 30, 2011, at 3:31 PM, Mauro wrote:

> I want to display different layouts based on user.
> If user is "intraOp" the I want to use layout intraOp, if user is
> "interOp" I want to display layout interOp while if controller_devise
> I want to display application layout.
> I based the user selection on request.path.
> If request.path is /intraOp then I select user IntraOp, if /interOp
> then select user interOp and so on.
> The routes.rb is:
>
> match "intraOp" => "companies#index"
> match "interOp" => "companies#index"
>
> The problem is that I use pagination.
> When the request.path is /interOp companies#index is launched, and are
> displayed 10 companies with pagination.
> When I click for displaying page 2 companies#index is launched but the
> path is not /interOp/companies......... but is
> /intraOp/companies.........that is because companies#index is first
> matched with "intraOp".
> Have you some suggestions to solve the problem to having different
> layouts based on user?
> I prefer to not create two controllers: intraOp and interOp.
----
stuff the 'company' into the users session and you can use the session value everywhere, all the time (or not)

Craig

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

Ruby on Rails

Sorry for a primitive question, but how can i use a local copy of rails
with my rails 3 application (locally)?

Quick googling didn't help, and on StackOverflow there is something
about putting local rails to the "vendor" directory, but it does not
seem to work for me.

Thanks.

Alexey.

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

Ruby on Rails

I want to display different layouts based on user.
If user is "intraOp" the I want to use layout intraOp, if user is
"interOp" I want to display layout interOp while if controller_devise
I want to display application layout.
I based the user selection on request.path.
If request.path is /intraOp then I select user IntraOp, if /interOp
then select user interOp and so on.
The routes.rb is:

match "intraOp" => "companies#index"
match "interOp" => "companies#index"

The problem is that I use pagination.
When the request.path is /interOp companies#index is launched, and are
displayed 10 companies with pagination.
When I click for displaying page 2 companies#index is launched but the
path is not /interOp/companies......... but is
/intraOp/companies.........that is because companies#index is first
matched with "intraOp".
Have you some suggestions to solve the problem to having different
layouts based on user?
I prefer to not create two controllers: intraOp and interOp.

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

Ruby on Rails

ignore - brain dead - bundle install/update duh

On Nov 30, 2011, at 12:26 PM, Craig White wrote:

> WTF... how to solve? (REE ruby/Ubuntu 10.04)
> $ dpkg -l |grep ruby
> ii ruby-enterprise - 1.8.7-2011.03 - Ruby Enterprise Edition.
>
> $ bundle exec
> /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/cli.rb:344:in `exec': wrong number of arguments (ArgumentError)
> from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/cli.rb:344:in `exec'
> from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in `send'
> from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in `run'
> from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
> from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor.rb:263:in `dispatch'
> from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386:in `start'
> from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/bin/bundle:13
> from /usr/local/bin/bundle:19:in `load'
> from /usr/local/bin/bundle:19
>
> This is a fairly new application in Rails 3.1
>
> Gemfile contents below (if useful - comments removed)
>
> $ cat Gemfile
> source 'http://rubygems.org'
>
> gem 'rails', '3.1.1'
>
> gem 'pg'
> gem 'json'
>
> gem 'execjs'
> gem 'therubyracer'
>
> group :assets do
> gem 'sass-rails', '~> 3.1.4'
> gem 'coffee-rails', '~> 3.1.1'
> gem 'uglifier', '>= 1.0.3'
> end
>
> gem 'jquery-rails'
>
> gem 'activeldap'
> gem 'ruby-ldap'
> gem 'will_paginate', '~> 3.0.2'
> gem 'dm-core'
> gem 'dm-aggregates'
> gem "net-ldap"
>
> --
> Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white@ttiltd.com
> 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com
>
> Need help communicating between generations at work to achieve your desired success? Let us help!
>

--
Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white@ttiltd.com
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com

Need help communicating between generations at work to achieve your desired success? Let us help!

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

Ruby on Rails

WTF... how to solve? (REE ruby/Ubuntu 10.04)
$ dpkg -l |grep ruby
ii ruby-enterprise - 1.8.7-2011.03 - Ruby Enterprise Edition.

$ bundle exec
/usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/cli.rb:344:in `exec': wrong number of arguments (ArgumentError)
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/cli.rb:344:in `exec'
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in `send'
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/task.rb:22:in `run'
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/lib/bundler/vendor/thor/base.rb:386:in `start'
from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.21/bin/bundle:13
from /usr/local/bin/bundle:19:in `load'
from /usr/local/bin/bundle:19

This is a fairly new application in Rails 3.1

Gemfile contents below (if useful - comments removed)

$ cat Gemfile
source 'http://rubygems.org'

gem 'rails', '3.1.1'

gem 'pg'
gem 'json'

gem 'execjs'
gem 'therubyracer'

group :assets do
gem 'sass-rails', '~> 3.1.4'
gem 'coffee-rails', '~> 3.1.1'
gem 'uglifier', '>= 1.0.3'
end

gem 'jquery-rails'

gem 'activeldap'
gem 'ruby-ldap'
gem 'will_paginate', '~> 3.0.2'
gem 'dm-core'
gem 'dm-aggregates'
gem "net-ldap"

--
Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.white@ttiltd.com
1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ www.ttiassessments.com

Need help communicating between generations at work to achieve your desired success? Let us help!

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

Ruby on Rails

On Wed, Nov 30, 2011 at 05:56, Michael Erasmus <michaelerasmus@gmail.com> wrote:

> know if it's feasible or considered best practice to write specs/
> tests for your generator,

Of course! It's considered best practice to write spec/tests for
*everything*! :-)

-Dave

--
LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages.
Where: Northern Virginia, Washington DC (near Orange Line), and remote work.
See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence).
Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson)

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

Ruby on Rails

On Wed, Nov 30, 2011 at 10:29 AM, art tav <lists@ruby-forum.com> wrote:
> Hi, I'm having a issue when attempt to read this page:
>
> http://www.treasury.gov/resource-center/sanctions/SDN-List/Pages/default.aspx

> C:/Ruby187/Ruby1.8.7/lib/ruby/1.8/open-uri.rb:277:in `open_http': 500
> Internal Server Error (OpenURI::HTTPError)

Love it. Apparently that server is rather picky about the requests it's
willing to service :-) Thank you, Treasury Department!

Anyway, try:

>> doc = Hpricot(open(url, "User-Agent" => "MSIE"))
=> #<Hpricot::Doc "\r\n" {doctype "<!DOCTYPE html PUBLIC \"-//W3C//DTD
XHTML 1.0 Strict//EN\" \...

Note: this also works :-)

>> doc = Hpricot(open(url, "User-Agent" => "Zombies from Space"))

(A look through the open-uri docs will be useful for future reference.)

FWIW,
--
Hassan Schroeder ------------------------ hassan.schroeder@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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

On Wed, Nov 30, 2011 at 04:00, johnnybutler7 <johnnybutler7@gmail.com> wrote:

> What im trying to do at the moment is have the client name after
> the .com/ so its always present www.myurl.com/client_name so i can
> grab who the client is and use that throughout their session.
>
> localhost:3000/{client_1}/news
> localhost:3000/{client_2}/news

Sounds like a job for Superman, er, I mean, a custom route. Maybe
something like:

match ':client(/:controller(/:action(/:id(.:format))))'

based on the old wildcard router (adding :client at the front). Note
that, as advised in the modern default route.cfg files, this will make
ALL your controllers and actions accessible via GET! If you're OK
with that, go for it. Also depending on how the rest of your normal
routes look (in particular whether you're using nested resources,
renamed routes, etc.), you may need more such lines, which could get
to be a pain.

If you decide to try it, let me know how it works. :-)

-Dave

--
LOOKING FOR WORK! What: Ruby (on/off Rails), Python, other modern languages.
Where: Northern Virginia, Washington DC (near Orange Line), and remote work.
See: davearonson.com (main) * codosaur.us (code) * dare2xl.com (excellence).
Specialization is for insects. (Heinlein) - Have Pun, Will Babble! (Aronson)

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

Ruby on Rails

I need to implement a feature for a rails site that will involve
reading and exporting most of my database.

I know this operation is going to take a while. That's fine-- I've got
delayed job for that.

What I'm worried about is the data changing during the running of the
job, and the resulting export being corrupted because of that.

My initial thought was to do all of the reads within a transaction.
However, I would also like to be running the reads concurrently.
ActiveRecord docs say that Transactions cannot be shared between
Connections, and Connections cannot be shared between Threads. So it
looks as though I am restricted to a single thread with this approach.

Any suggestions for a workaround? Is there another way to give the job
a consistent view of the data that doesn't involve transactions? Or is
there some alternative to ActiveRecord/Mysql out there that can
distribute transactions across threads?

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

Ruby on Rails

Hi, I'm having a issue when attempt to read this page:

http://www.treasury.gov/resource-center/sanctions/SDN-List/Pages/default.aspx

and get the following error:

C:/Ruby187/Ruby1.8.7/lib/ruby/1.8/open-uri.rb:277:in `open_http': 500
Internal Server Error (OpenURI::HTTPError)
from C:/Ruby187/Ruby1.8.7/lib/ruby/1.8/open-uri.rb:616:in
`buffer_open'
from C:/Ruby187/Ruby1.8.7/lib/ruby/1.8/open-uri.rb:164:in
`open_loop'
from C:/Ruby187/Ruby1.8.7/lib/ruby/1.8/open-uri.rb:162:in
`catch'
from C:/Ruby187/Ruby1.8.7/lib/ruby/1.8/open-uri.rb:162:in
`open_loop'
from C:/Ruby187/Ruby1.8.7/lib/ruby/1.8/open-uri.rb:132:in
`open_uri'
from C:/Ruby187/Ruby1.8.7/lib/ruby/1.8/open-uri.rb:518:in `open'
from C:/Ruby187/Ruby1.8.7/lib/ruby/1.8/open-uri.rb:30:in `open'
from prueba_fecha.rb:11

This is the code I'm using

url =
"http://www.treasury.gov/resource-center/sanctions/SDN-List/Pages/default.aspx"
doc = Hpricot(open(url))

Somebody can help me with it?

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

Ruby on Rails

On Nov 30, 2011, at 1:02 AM, Colin Law wrote:

> On 29 November 2011 21:33, Craig White <craig.white@ttiltd.com> wrote:
>>
>> On Nov 29, 2011, at 2:11 PM, Angelo Cordova wrote:
>>
>>>
>>>
>>> On 29 nov, 17:14, Colin Law <clan...@googlemail.com> wrote:
>>>> On 29 November 2011 18:33, Angelo Cordova <acord...@gmail.com> wrote:
>>>>
>>>>> Hi people
>>>>
>>>>> I want to know which is the best gem or plug-in to store and track
>>>>> register changes for a rails 3.0.9 app
>
>> probably want to check out 'acts_as_auted' - I've used that in the past but not with Rails 3 - appears that there is a version specifically for Rails 3
>
> Or even acts_as_audited :)
----
brain was typing audited, fingers apparently decided to do something different or perhaps my dog ate my homework.

Yes, acts_as_audited - evokes a time period when it seemed just about every rails inspired gem was acts_as...

Actually it worked very well (acts_as_audited) but again, that was a rails 0.x & 1.x project

Craig

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

Ruby on Rails

I think it is not a good idea to use Access as a datebase.
You could use EMS SQL Management Studio for PostgreSQL to export your
data from access to PostgreSql and then adopt ActiveRecord in your
Ruby project. But you have to adapt the table names and structure as
the ActiveRecord convention or customize the models (http://
2dconcept.com/articles/2-rails-legacy-db-activerecord-conventions).

On 30 nov, 03:53, Alec Taylor <alec.tayl...@gmail.com> wrote:
> Good afternoon,
>
> Is there a Ruby ORM gem which integrates with MS Access?
>
> Alternatively how would I convert one to PostgreSQL or MySQL then
> interpret it into ORM syntax for use in Ruby?
>
> Thanks for all suggestions,
>
> Alec Taylor

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

Ruby on Rails

On Nov 30, 10:56 am, Michael Erasmus <michaeleras...@gmail.com> wrote:
> I would like to experiment with writing a my own generator that I
> might want to eventually bundle into it's own gem. What I would like
> to know if it's feasible or considered best practice to write specs/
> tests for your generator, and if so, any tips or examples you can
> point me to?

You certainly can test them, for example here are the specs for the
rspec generators: https://github.com/rspec/rspec-rails/tree/master/spec/generators

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

Ruby on Rails



On Wed, Nov 30, 2011 at 9:02 AM, rahul chandra <richesrahul@gmail.com> wrote:
The problem was in routes and i rewrite it again...

On Wed, Nov 30, 2011 at 5:50 PM, Colin Law <clanlaw@googlemail.com> wrote:
On 30 November 2011 12:17, rahul chandra <richesrahul@gmail.com> wrote:
> thanks guys figured it out...

It is good practice to describe the solution in case anyone finds this
thread in the future.  It is very frustrating to find someone with the
same problem as yourself who has found a solution but has not
published it.

Colin


You remind me of this comic

=) 

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

Ruby on Rails

The problem was in routes and i rewrite it again...

On Wed, Nov 30, 2011 at 5:50 PM, Colin Law <clanlaw@googlemail.com> wrote:
On 30 November 2011 12:17, rahul chandra <richesrahul@gmail.com> wrote:
> thanks guys figured it out...

It is good practice to describe the solution in case anyone finds this
thread in the future.  It is very frustrating to find someone with the
same problem as yourself who has found a solution but has not
published it.

Colin

>
>
> On Wed, Nov 30, 2011 at 5:37 PM, Jim Ruther Nill <jvnill@gmail.com> wrote:
>>
>>
>>
>> On Wed, Nov 30, 2011 at 7:59 PM, Colin Law <clanlaw@googlemail.com> wrote:
>>>
>>> On 30 November 2011 11:41, rahul chandra <richesrahul@gmail.com> wrote:
>>> > My server is running but not getting anything
>>> >
>>> > ### In server m getting #####
>>> > Started GET "/users/sign_in" for 127.0.0.1 at 2011-11-30 16:56:13
>>> > +0530
>>> >  Processing by UsersController#show as HTML
>>> >  Parameters: {"id"=>"sign_in"}
>>>
>>> You have a problem with your routes.  It is interpreting sign_in as an
>>> id and going to the show action.  You may have a route for show/id
>>> before sign_in.
>>> Try
>>> rake routes
>>> in a terminal to see what your routes are.
>>
>>
>> The browser says it's not redirecting properly so I think another probable
>> cause
>> is requiring a logged in user for the action that shows the login page.
>>  You most
>> probably have a before_filter that checks if the user is logged in, and if
>> not,
>> redirects to the log in page.
>>
>>>
>>>
>>> Show us your routes.rb and the result of rake routes if you cannot work
>>> it out.
>>>
>>> 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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.



--
gplus.to/clanlaw

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

Ruby on Rails

Thanks for the help

I'll try them

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

Ruby on Rails

On 30 November 2011 12:17, rahul chandra <richesrahul@gmail.com> wrote:
> thanks guys figured it out...

It is good practice to describe the solution in case anyone finds this
thread in the future. It is very frustrating to find someone with the
same problem as yourself who has found a solution but has not
published it.

Colin

>
>
> On Wed, Nov 30, 2011 at 5:37 PM, Jim Ruther Nill <jvnill@gmail.com> wrote:
>>
>>
>>
>> On Wed, Nov 30, 2011 at 7:59 PM, Colin Law <clanlaw@googlemail.com> wrote:
>>>
>>> On 30 November 2011 11:41, rahul chandra <richesrahul@gmail.com> wrote:
>>> > My server is running but not getting anything
>>> >
>>> > ### In server m getting #####
>>> > Started GET "/users/sign_in" for 127.0.0.1 at 2011-11-30 16:56:13
>>> > +0530
>>> >  Processing by UsersController#show as HTML
>>> >  Parameters: {"id"=>"sign_in"}
>>>
>>> You have a problem with your routes.  It is interpreting sign_in as an
>>> id and going to the show action.  You may have a route for show/id
>>> before sign_in.
>>> Try
>>> rake routes
>>> in a terminal to see what your routes are.
>>
>>
>> The browser says it's not redirecting properly so I think another probable
>> cause
>> is requiring a logged in user for the action that shows the login page.
>>  You most
>> probably have a before_filter that checks if the user is logged in, and if
>> not,
>> redirects to the log in page.
>>
>>>
>>>
>>> Show us your routes.rb and the result of rake routes if you cannot work
>>> it out.
>>>
>>> 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+unsubscribe@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+unsubscribe@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+unsubscribe@googlegroups.com.
> For more options, visit this group at
> http://groups.google.com/group/rubyonrails-talk?hl=en.

--
gplus.to/clanlaw

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

Ruby on Rails

thanks guys figured it out...

On Wed, Nov 30, 2011 at 5:37 PM, Jim Ruther Nill <jvnill@gmail.com> wrote:


On Wed, Nov 30, 2011 at 7:59 PM, Colin Law <clanlaw@googlemail.com> wrote:
On 30 November 2011 11:41, rahul chandra <richesrahul@gmail.com> wrote:
> My server is running but not getting anything
>
> ### In server m getting #####
> Started GET "/users/sign_in" for 127.0.0.1 at 2011-11-30 16:56:13
> +0530
>  Processing by UsersController#show as HTML
>  Parameters: {"id"=>"sign_in"}

You have a problem with your routes.  It is interpreting sign_in as an
id and going to the show action.  You may have a route for show/id
before sign_in.
Try
rake routes
in a terminal to see what your routes are.

The browser says it's not redirecting properly so I think another probable cause
is requiring a logged in user for the action that shows the login page.  You most
probably have a before_filter that checks if the user is logged in, and if not, 
redirects to the log in page.
 

Show us your routes.rb and the result of rake routes if you cannot work it out.

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

Ruby on Rails



On Wed, Nov 30, 2011 at 7:59 PM, Colin Law <clanlaw@googlemail.com> wrote:
On 30 November 2011 11:41, rahul chandra <richesrahul@gmail.com> wrote:
> My server is running but not getting anything
>
> ### In server m getting #####
> Started GET "/users/sign_in" for 127.0.0.1 at 2011-11-30 16:56:13
> +0530
>  Processing by UsersController#show as HTML
>  Parameters: {"id"=>"sign_in"}

You have a problem with your routes.  It is interpreting sign_in as an
id and going to the show action.  You may have a route for show/id
before sign_in.
Try
rake routes
in a terminal to see what your routes are.

The browser says it's not redirecting properly so I think another probable cause
is requiring a logged in user for the action that shows the login page.  You most
probably have a before_filter that checks if the user is logged in, and if not, 
redirects to the log in page.
 

Show us your routes.rb and the result of rake routes if you cannot work it out.

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

Ruby on Rails

On 30 November 2011 11:41, rahul chandra <richesrahul@gmail.com> wrote:
> My server is running but not getting anything
>
> ### In server m getting #####
> Started GET "/users/sign_in" for 127.0.0.1 at 2011-11-30 16:56:13
> +0530
>  Processing by UsersController#show as HTML
>  Parameters: {"id"=>"sign_in"}

You have a problem with your routes. It is interpreting sign_in as an
id and going to the show action. You may have a route for show/id
before sign_in.
Try
rake routes
in a terminal to see what your routes are.

Show us your routes.rb and the result of rake routes if you cannot work it out.

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

Ruby on Rails

My server is running but not getting anything

### In server m getting #####
Started GET "/users/sign_in" for 127.0.0.1 at 2011-11-30 16:56:13
+0530
Processing by UsersController#show as HTML
Parameters: {"id"=>"sign_in"}
Completed 401 Unauthorized in 1ms


##########and in browser#######
The page isn't redirecting properly

Firefox has detected that the server is redirecting the
request for this address in a way that will never complete.

This problem can sometimes be caused by disabling or refusing to
accept
cookies.

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

Ruby on Rails

I would like to experiment with writing a my own generator that I
might want to eventually bundle into it's own gem. What I would like
to know if it's feasible or considered best practice to write specs/
tests for your generator, and if so, any tips or examples you can
point me to?

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

Ruby on Rails



On Wed, Nov 30, 2011 at 5:44 PM, Somnath Mallick <lists@ruby-forum.com> wrote:
Just had one final question... what is the difference between:

bundle exec "command"
and
directly running the command?

"bundle exec" makes sure that you're using the executables that ship along with
the gem installed by bundler while running only the command uses the one
recognized by your system.
 
Like for me bundle exec rspec throws and error while rspec does not.

This usually happens when the rspec bundle exec runs is of a different version.
Try getting the version of the rspec executable that works and change your Gemfile
to use that rspec version.  Run bundle install and try running rspec again with
bundle exec.
 

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

Ruby on Rails

Just had one final question... what is the difference between:

bundle exec "command"
and
directly running the command?

Like for me bundle exec rspec throws and error while rspec does not.

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

Ruby on Rails

Hi,

I have already used subdomains in rails 3 and it was straightforward
to setup.

What im trying to do at the moment is have the client name after
the .com/ so its always present www.myurl.com/client_name so i can
grab who the client is and use that throughout their session.

localhost:3000/{client_1}/news
localhost:3000/{client_2}/news

I have searched around and cant really find any examples of this so im
wondering if its possible and/or good practice. I would prefer the
subdomain route but the client specifically wants it setup this way
and im not really sure how best to do it, any advice is appreciated,

JB

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

Ruby on Rails

On 29 November 2011 21:33, Craig White <craig.white@ttiltd.com> wrote:
>
> On Nov 29, 2011, at 2:11 PM, Angelo Cordova wrote:
>
>>
>>
>> On 29 nov, 17:14, Colin Law <clan...@googlemail.com> wrote:
>>> On 29 November 2011 18:33, Angelo Cordova <acord...@gmail.com> wrote:
>>>
>>>> Hi people
>>>
>>>> I want to know which is the best  gem or plug-in to store and track
>>>> register changes for a rails 3.0.9 app

> probably want to check out 'acts_as_auted' - I've used that in the past but not with Rails 3 - appears that there is a version specifically for Rails 3

Or even acts_as_audited :)

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

Ruby on Rails Tuesday, November 29, 2011

Hi
have you tried the method request.subdomain
Checkout the railscast on subdomains for more info
http://railscasts.com/episodes/221-subdomains-in-rails-3

Bye
Rik

On Nov 29, 10:44 am, Jim Ruther Nill <jvn...@gmail.com> wrote:
> On Mon, Nov 28, 2011 at 9:11 AM, newrails user <newror.u...@gmail.com>wrote:
>
>
>
>
>
>
>
>
>
> > Hi all,
>
> > I am facing problem in getting subdomain name inside the model. The
> > following is my setup.
>
> > I am using cancan for authorization.I wanted a specific condition in
> > Ability.rb ( the file which is placed in models if we install cancan gem).
>
> > Below is the condition I wanted:
> > =========================================================
> >       user ||= User.new # guest user (not logged in)
> >       if (user.role == 'admin' && user.site_name == current_subdomain_name)
> >        can :manage, :all
> >       else
> >        can :read, :all
> >       end
> > =======================================================
>
> > current_subdomain_name should be the name of the subdomain on which user
> > is browsing. But i could not get it.
>
> > I have tried the following was but could not succeed.
>
> > 1) setting a current_subdomain_name as a global variable in the
> > application controller and using the global variable. (using ruby debugger
> > i found that the global variable is having nil in it)
> > 2) i have a method current_subdomain_name in the application helper which
> > returns what i wanted, I included the same inside the ability model and
> > tried to use the method . But was getting error .
>
> > 3) writting a mehod in controller such that it returns what i wanted and
> > use the same in the model.Still could not succeed.
>
> See if this works
>
> class Ability
>   include CanCan::Ability
>
>   def initialize(user, subdomain) #subdomain should now contain the current
> subdomain
>     user ||= User.new
>     ...
>   end
> end
>
> Then in your application controller
>
> def current_ability
>   @current_ability ||= Ability.new(current_user, current_subdomain_name)
> end
>
> class Ability
>   include CanCan::Ability
>
>   def initialize(user)
>     user ||= User.new # guest user (not logged in)
>     if user.admin?
>       can :manage, :all
>     else
>       can :read, :all
>     end
>   endend
>
>
>
>
>
>
>
>
>
>
>
> > Can anybody let me know how to get the subdomain from request and use it
> > in the model (In Ability.rb which cancan provide).
>
> > Any help is highly appreciated.
>
> > Thanks,
> > Nror
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Ruby on Rails: Talk" group.
> > To post to this group, send email to rubyonrails-talk@googlegroups.com.
> > To unsubscribe from this group, send email to
> > rubyonrails-talk+unsubscribe@googlegroups.com.
> > For more options, visit this group at
> >http://groups.google.com/group/rubyonrails-talk?hl=en.
>
> --
> -------------------------------------------------------------
> visit my blog athttp://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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

i am with paper trail

https://github.com/airblade/paper_trail 


On Wed, Nov 30, 2011 at 2:33 AM, Craig White <craig.white@ttiltd.com> wrote:

On Nov 29, 2011, at 2:11 PM, Angelo Cordova wrote:

>
>
> On 29 nov, 17:14, Colin Law <clan...@googlemail.com> wrote:
>> On 29 November 2011 18:33, Angelo Cordova <acord...@gmail.com> wrote:
>>
>>> Hi people
>>
>>> I want to know which is the best  gem or plug-in to store and track
>>> register changes for a rails 3.0.9 app
>>
>> It is not clear what it is that is changing (a register?).  Is it
>> changes to data in the database or code changes or what?
>>
>> Colin
>
>
> In my app, a user must log-in to the system.
> Then he can create and/or update many documents (invoices, waybills,
> credit notes, etc.). Each one has many details (because they have many
> products)
> So I'm looking for a gem that allow me to store the changes of these
> documents, what I want to know is:
>
> - user_id (who made the changes or has created a new document)
> - object_id (the document or detail that has been created, updated,
> deleted, etc.)
> - class_name (the class name of the document/detail)
> - action_name (create, update, delete, etc.)
> - datetime (date and time when the document/detail has been created or
> updated or deleted)
> - changes (which attributes has been changed and what has changed
> (old_value, new_value))
>
> Is it clearer now? if not, just tell me to try a better explanation
----
probably want to check out 'acts_as_auted' - I've used that in the past but not with Rails 3 - appears that there is a version specifically for Rails 3

Craig

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




--
Naveed Ahmad
Software Engineer  |  7vals 
skype: naveed.ahmad.7
direct: +92-321-4263188

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

Ruby on Rails

Hi can anybody help me in running action profiler for my application.

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

Ruby on Rails

Good afternoon,

Is there a Ruby ORM gem which integrates with MS Access?

Alternatively how would I convert one to PostgreSQL or MySQL then
interpret it into ORM syntax for use in Ruby?

Thanks for all suggestions,

Alec Taylor

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

Ruby on Rails

I was a PHP Developer before switching to ROR, and here are some reasons to use RoR.

1. Build a business web application.
Of course :) Almost all frameworks can do this nowadays, including RoR
2. Easy to maintain, update. 
Code is highly readable, and Ruby's core priciples include Developer Happiness :) 
3. Easy to scalable. 
Whatever framework it is, scaling is possible when done correctly. In RoR we use gems like EventMachine 
5. Easy to separate test& live environment. 
You get a Development, Test and Production environment when you start a new project. Not sure if you can add more, but these 3 are enough for 99% of the cases. 
6. Great performance. (We have like 1000 devices is getting data via our)
Oooh yeah :) Ruby is not the fastest language as it's interpreted, but it's still extremely fast for most of our intents and purposes.
7. Easy to deployment.
With the Capistrano gem, we usually do 

$ cap deploy 

…and done!
8. It already has a many components/modules for general purpose such as: ACL, Authentication, Uploading, Picture processing,...    
Yes to all, you have CanCan/Cantango, devise, RMagick/MiniMagick/ImageScience 
9. Have a great community behind the framework to support for it.
Agreed. This is one marked difference I found over PHP frameworks. RoR's community is excellent, considering its the community that makes the framework :) 
10. Unit testing.
Several excellent gems available, and test driven development is actively encouraged in Rails. A popular and great combination is RSpec/Shoulda

Dheeraj Kumar

On Tuesday 29 November 2011 at 11:59 PM, Vinh Quốc Nguyễn wrote:

Hi,

This question may asked so many times. I google about it and got lots of discuss generally. After reading all of them, I go to
a conclusion is choose the framework which your understand to it is the most. But we are willing to lean new language or framrwork to make our app better.
So we need some advices to determine which framework we should go with. So I'm posting here, hope
someone can give some advice from real experience when working with ROR and some PHP Framework.

We are developing a web application (it somehows likes a file management sytem with multi users, drag and drop user interface,..). Our application is really a back-end for a system which runs on embedded device. We
are in progress to determine a "good" framework for our need.

Our purposes:
1. Build a business web application.
2. Easy to maintain, update.
3. Easy to scalable.
5. Easy to separate test& live environment.
6. Great performance. (We have like 1000 devices is getting data via our)
7. Easy to deployment.
8. It already has a many components/modules for general purpose such as: ACL, Authentication, Uploading, Picture processing,...   
9. Have a great community behind the framework to support for it.
10. Unit testing.

One thing I notice, code in Ror is very short. To do the same purpose, we can just use some line of code in ROR compare
to PHP. This is better for us. Also we want to use AGILE method in our project. The reason is our product keeps
changing to meet to the need of customer. So I think AGILE method is better than for us than WATERFALL method.

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

Ruby on Rails

On Nov 29, 2011, at 4:25 PM, Frederick Cheung wrote:
> On Nov 29, 5:37 pm, Craig White <craig.wh...@ttiltd.com> wrote:
>> Rails 3.1 and I'm working through activeldap which is not exactly ActiveRecord
>>
>> class Group < ActiveLdap::Base
>> def validate
>> errors.add(:base, "You must enter a value for the 'Common name'") unless self.cn.to_s != ''
>> errors.add(:base, "You must enter a value for the 'GID Number'") unless self.gidNumber.to_s != ''
>> errors.add(:base, "You must enter a value for the 'Description'") unless self.description.to_s != ''
>> errors.add(:base, "You must enter a value for the 'sambaGroupType'") unless self["objectclass"].include? "sambaGroupMapping"
>> return errors
>> end
>>
> Everytime validate is called you're adding errors, nothing is
> resetting errors so it stands to reason that you're going to get
> duplicate (or triplicate if validate was called again etc) error
> messages.
> Given that activeldap seems to be using active model for its
> validations stuff it's going to be very close to active record, so you
> shouldn't be calling validate directly - call group.valid? to see if
> the object is valid and if it isn't look at group.errors
----
thanks Fred...

valid? indeed works and so does errors and yes, it obviously uses ActiveModel now but since it's LDAP but not user friendly, it's not for the uninitiated.

@group.errors is a mess and @person.errors - fahgettaboutit and will not be useful to someone trying to use the application so I ended up using .to_a.uniq to toss out the dupes...

I finally just worked it out a minute ago with this (in my Person model)

flash[:error] = @person.validate['base'].to_a.uniq.join("<br />")

apparently have to use .html_safe in my view to view the flash[:error] and it's reasonably friendly now.

Craig

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

Ruby on Rails

On Nov 29, 7:11 pm, DmitryS <dmitry.g.shul...@gmail.com> wrote:

>
> _skills_list.html.erb
>
> <div id="skills_list">
> <table>
>   <tr>
>     <th>Title</th>
>     <th>Parent</th>
>   </tr>
>
> <% @skills.each do |skill| %>
>   <tr>
>     <td><%= skill.title %></td>
>     <td><%= skill.parent_id %></td>
>   </tr>
> <% end %>
> </table>
>
> </div>
>
> It finally prints <%= escape_javascript(render :partial=>'skills_list') %> instead of rendering skills list. I would appreciate if you tell me why.
>

The files in assets there aren't passed through erb, they're not
supposed to reference application contents etc. They're completely
static js, css etc files that rails does clever stuff to ensure that
they are delivered to clients in a way that is efficient, cache
friendly etc.
If you want a js template to be rendered for your action then it
should live in the same place as your other templates (i.e. app/view/
skills)

Fred


> Thank you in advance,
> Dmitry.

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

Ruby on Rails

i`m in the same situation and did the following in view:
<%= text_field_tag('book[price]', @book.price) %>

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

Ruby on Rails

On Nov 29, 6:05 pm, spinlock <atomicbroadc...@gmail.com> wrote:
> Hi everyone,
>
> I'm trying to write integration tests for my sample twitter app and
> I'm having trouble mocking out objects in the Twitter namespace.
> Here's the function that's giving me trouble:
>
>   def build_twitter(omniauth)
>     Twitter.configure do |config|
>       config.consumer_key = TWITTER_KEY
>       config.consumer_secret = TWITTER_SECRET
>       config.oauth_token = omniauth['credentials']['token']
>       config.oauth_token_secret = omniauth['credentials']['secret']
>     end
>     client = Twitter::Client.new
>     user = client.current_user
>     self.name = user.name
>   end
>
> and here's the test:
>
> feature 'testing oauth' do
>   before(:each) do
>     @twitter = double("Twitter")
>     @twitter.stub!(:configure).and_return true
>     @client = double("Twitter::Client")
>     @client.stub!(:current_user).and_return(@user)
>     @user = double("Twitter::User")
>     @user.stub!(:name).and_return("Tester")
>   end
>
You're creating @twitter, stubbing configure on it and so on, but the
code under test is still calling Twitter.configure. Calling
double('Twitter') doesn't replace the existing Twitter constant - you
need to do something like Twitter.stub(:configure) (or
Twitter.should_receive(...), similarly with Twitter::Client.new and so
on

Fred


>   scenario 'twitter' do
>
>     visit root_path
>     login_with_oauth
>
>     page.should have_content("Pages#home")
>   end
> end
>
> But, I'm getting this error:
> Failures:
>
>   1) testing oauth twitter
>      Failure/Error: login_with_oauth
>      Twitter::Error::Unauthorized:
>        GEThttps://api.twitter.com/1/account/verify_credentials.json:
> 401: Invalid / expired Token
>      # ./app/models/user.rb:40:in `build_twitter'
>      # ./app/models/user.rb:16:in `build_authentication'
>      # ./app/controllers/authentications_controller.rb:47:in `create'
>      # ./spec/support/integration_spec_helper.rb:3:in
> `login_with_oauth'
>      # ./spec/integration/twit_test.rb:16:in `block (2 levels) in <top
> (required)>'
>
> Any ideas on how to make this work? I'm using rspec for mocking the
> objects but I'm open to mocha if that's a better choice.
>
> Thanks,
> Andrew

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

Ruby on Rails

On Nov 29, 5:37 pm, Craig White <craig.wh...@ttiltd.com> wrote:
> Rails 3.1 and I'm working through activeldap which is not exactly ActiveRecord
>
> class Group < ActiveLdap::Base
>   def validate
>     errors.add(:base, "You must enter a value for the 'Common name'") unless self.cn.to_s != ''
>     errors.add(:base, "You must enter a value for the 'GID Number'") unless self.gidNumber.to_s != ''
>     errors.add(:base, "You must enter a value for the 'Description'") unless self.description.to_s != ''
>     errors.add(:base, "You must enter a value for the 'sambaGroupType'") unless self["objectclass"].include? "sambaGroupMapping"
>     return errors
>   end
>
Everytime validate is called you're adding errors, nothing is
resetting errors so it stands to reason that you're going to get
duplicate (or triplicate if validate was called again etc) error
messages.
Given that activeldap seems to be using active model for its
validations stuff it's going to be very close to active record, so you
shouldn't be calling validate directly - call group.valid? to see if
the object is valid and if it isn't look at group.errors

Fred


> irb(main):014:0> @group = Group.new
> => #<Group objectClass:<top, posixGroup>, must:<cn, gidNumber, objectClass>, may:<description, memberUid, userPassword>, cn: [], commonName: [], description: [], gidNumber: [], memberUid: [], objectClass: ["top", "PosixGroup"], userPassword: []>
>
> irb(main):015:0> @group.validate
> => #<ActiveModel::Errors:0xa4b706c @base=#<Group objectClass:<top, posixGroup>, must:<cn, gidNumber, objectClass>, may:<description, memberUid, userPassword>, cn: [], commonName: [], description: [], gidNumber: [], memberUid: [], objectClass: ["top", "PosixGroup"], userPassword: []>, @messages=#<OrderedHash {:base=>["You must enter a value for the 'Common name'", "You must enter a value for the 'GID Number'", "You must enter a value for the 'Description'", "You must enter a value for the 'sambaGroupType'"]}>>
>
> irb(main):016:0> @group.validate.messages.each do |a|
> irb(main):017:1* puts a
> irb(main):018:1> end
> base
> You must enter a value for the 'Common name'
> You must enter a value for the 'GID Number'
> You must enter a value for the 'Description'
> You must enter a value for the 'sambaGroupType'
> You must enter a value for the 'Common name'
> You must enter a value for the 'GID Number'
> You must enter a value for the 'Description'
> You must enter a value for the 'sambaGroupType'
>
> Or if I use my rails app instead and put @group.validate into flash hash, I also get duplication...
>
> base You must enter a value for the 'Description' base You must enter a value for the 'Description'
>
> (and I really would prefer to get the 'base' out of there altogether but can't seem to find a way to do that either)
>
> --
> Craig White ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ craig.wh...@ttiltd.com
> 1.800.869.6908 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~www.ttiassessments.com
>
> Need help communicating between generations at work to achieve your desired success? Let us help!

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