Christopher Jones | 1 Feb 02:16

User and Game Association help.

Hi all, I am currently doing work on my rails project and have hit a
wall. I am quite new to Rails so at the moment only know a little bit
about it.

I have a users table and a games table. At the moment I am able to enter
in user information as well as add new games to the games table.

What I wish to do now is to combine the both using a foreign key. I have
added the user_id entry to the games table and even declared it as a
foreign key by writing it as a command through MySQL. I have also
declared them as followed:

model Games < ActiveRecord::Base
  belongs_to :user
end
model User < ActiveRecord::Base
  has_many :games
end

Is there anything else I must do. I want to be able to on the user
profile show all games associated with that particular user. How would I
go about doing this?

Any help would be greatly appreciated.

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

--

-- 
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
(Continue reading)

Bob B. | 1 Feb 03:57

Re: rubygems Problem on ubuntu 10.04

Awesome that DNS fix in etc/hosts worked for me

Finally ..
$ sudo gem install rails
Fetching: i18n-0.6.0.gem (100%)
Fetching: multi_json-1.0.4.gem (100%)
..

Many thanks Damian!!

Bob

Damian M. wrote in post #1031895:
> MaT 2. wrote in post #1031374:
>> i really need help.. i hope someone can help me..
>
>
> I don't know if this effects you or not, but if you're behind OpenDNS
> then you're likely having issues because of them. I had this issue
> myself just today (which is how I stumbled on this forum post) and the
> resolution for me was to add the following to my hosts file:
>
>
>
> 205.251.203.201 production.cf.rubygems.org
>
> if you go to production.cf.rubygems.org in your web browser, and this is
> your issue, you'll get an OpenDNS message which essentially claims
> production.cf.rubygems.org distributes malware/viruses. Adding the hosts
> file entry allowed me to bypass opendns entirely for the one site. This
(Continue reading)

Duane Morin | 1 Feb 04:45

Does Devise make use of a "status" method? Weird bug.

So I've inherited a legacy application and I'm trying to work around the
edges as I put an admin tool interface on top of the existing code base.
I install Devise for user authentication, since I've used it in the
past.  I change none of the default code.  And yet, on successful sign
in, I get an error:

Render and/or redirect were called multiple times in this action. Please
note that you may only call render OR redirect, and at most once per
action. Also note that neither redirect nor render terminate execution
of the action, so if you want to exit an action after redirecting, you
need to do something like "redirect_to(...) and return".

Here's the thing, look where that error was thrown

vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.0/lib/action_controller/metal/rendering.rb:15:in
`render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.0/lib/action_controller/metal/instrumentation.rb:40:in
`block (2 levels) in render'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/core_ext/benchmark.rb:5:in
`block in ms'
/Users/dmorin/.rvm/rubies/ruby-1.9.3-p0/lib/ruby/1.9.1/benchmark.rb:295:in
`realtime'
vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/core_ext/benchmark.rb:5:in
`ms'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.0/lib/action_controller/metal/instrumentation.rb:40:in
`block in render'
vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.0/lib/action_controller/metal/instrumentation.rb:81:in
`cleanup_view_runtime'
vendor/bundle/ruby/1.9.1/gems/activerecord-3.1.0/lib/active_record/railties/controller_runtime.rb:24:in
`cleanup_view_runtime'
(Continue reading)

Mike Kim | 1 Feb 04:52
Picon

Re: Does Devise make use of a "status" method? Weird bug.

Duane,

Try running "rake routes" in order to see which controller is being
used for the create method. Hopefully that'll help narrow things down.

Best,

Mike

On Jan 31, 7:45 pm, Duane Morin <li...@...> wrote:
> So I've inherited a legacy application and I'm trying to work around the
> edges as I put an admin tool interface on top of the existing code base.
> I install Devise for user authentication, since I've used it in the
> past.  I change none of the default code.  And yet, on successful sign
> in, I get an error:
>
> Render and/or redirect were called multiple times in this action. Please
> note that you may only call render OR redirect, and at most once per
> action. Also note that neither redirect nor render terminate execution
> of the action, so if you want to exit an action after redirecting, you
> need to do something like "redirect_to(...) and return".
>
> Here's the thing, look where that error was thrown
>
> vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.0/lib/action_controller/metal/ rendering.rb:15:in
> `render'
> vendor/bundle/ruby/1.9.1/gems/actionpack-3.1.0/lib/action_controller/metal/ instrumentation.rb:40:in
> `block (2 levels) in render'
> vendor/bundle/ruby/1.9.1/gems/activesupport-3.1.0/lib/active_support/core_e xt/benchmark.rb:5:in
> `block in ms'
(Continue reading)

Paet Worlds II | 1 Feb 06:27

How do I install this gem?

I'm trying to figure out how I can setup my own forums using Ruby, but I
can't get passed installing "nifty-generators"... I haven't a clue how
to install the gems... Please tell me what I'm doing wrong?

I open the command prompt, I type in :

gem install nifty-generators

And this is what I get:

Successfully installed nifty-generators-0.4.6
1 gem installed
Installing ri documentation for nifty-generators-0.4.6...
ERROR:  While generating documentation for nifty-generators-0.4.6
... MESSAGE:   Invalid argument - ./</cdesc-<.ri
... RDOC args: --ri --op
C:/Ruby193/lib/ruby/gems/1.9.1/doc/nifty-generators-0.4
.6/ri lib --title nifty-generators-0.4.6 Documentation --quiet

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

(Continue reading)

Ajit Teli | 1 Feb 07:59

Unable to run rake db:create:all

I am able to create databases (development, test, and production
databases) as follows
.................................................................
ajit <at> ajit:~$ su - postgres
Password:
postgres <at> ajit:~$ psql
postgres=# create DATABASE book_shelf_development;
CREATE DATABASE
postgres=# create DATABASE book_shelf_test;
CREATE DATABASE
postgres=# create DATABASE book_shelf_production;
CREATE DATABASE
postgres=#

................................................................

But when I try to create same databases using the command
'rake db:create:all', I am getting an error massage saying 'FATAL:
Ident authentication failed for user "postgres"'. And none of the
databases are created.

  And also after creating databases as shown above, I created migration
files and I am able to do rake db:migrate for the same database.yml
file.

Can you please help me why 'rake db:create:all' is not working?

Thank you
  Ajit

(Continue reading)

CavalryJim | 1 Feb 08:16
Picon
Gravatar

Re: User and Game Association help.


On Jan 31, 7:16 pm, Christopher Jones <li...@...> wrote:
> Hi all, I am currently doing work on my rails project and have hit a
> wall. I am quite new to Rails so at the moment only know a little bit
> about it.
>
> I have a users table and a games table. At the moment I am able to enter
> in user information as well as add new games to the games table.
>
> What I wish to do now is to combine the both using a foreign key. I have
> added the user_id entry to the games table and even declared it as a
> foreign key by writing it as a command through MySQL. I have also
> declared them as followed:
>
> model Games < ActiveRecord::Base
>   belongs_to :user
> end
> model User < ActiveRecord::Base
>   has_many :games
> end
>
> Is there anything else I must do. I want to be able to on the user
> profile show all games associated with that particular user. How would I
> go about doing this?
>
> Any help would be greatly appreciated.
>
> --
> Posted viahttp://www.ruby-forum.com/

(Continue reading)

angel david | 1 Feb 08:33

Devise with Rails 3

Hi All,

Im using devise with rails 3.

My requirement in this is,

There are two scenarios.

1. User send reset password for their email id.

2. Admin send reset password for the user mail id, where the user is not
active. When this scenario is generated, the reset instruction mail
should be delivered to the admin email id and not to the actual user
mail id.

This is tricky but this is what my requirement is.

Can this be done in devise?
Or is there any other possibilities?

Can anyone share your thoughts on this?

Regards,

-- 
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@...
(Continue reading)

Robert Walker | 1 Feb 08:35

Re: How do I install this gem?

Paet Worlds II wrote in post #1043392:
> gem install nifty-generators
>
>
> And this is what I get:
>
>
> Successfully installed nifty-generators-0.4.6
> 1 gem installed
> Installing ri documentation for nifty-generators-0.4.6...
> ERROR:  While generating documentation for nifty-generators-0.4.6
> ... MESSAGE:   Invalid argument - ./</cdesc-<.ri
> ... RDOC args: --ri --op
> C:/Ruby193/lib/ruby/gems/1.9.1/doc/nifty-generators-0.4
> .6/ri lib --title nifty-generators-0.4.6 Documentation --quiet

It's only failing to install the docs. Either add the option to gem 
install to skip the docs, or do the actual right thing and put the gem 
in your Gemfile and use bundler to install. That will automatically skip 
installing the docs. The docs you probably won't use anyway.

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

(Continue reading)

amvis | 1 Feb 08:56
Picon

insert problem with rails3


tran =Transaction.select("transactions.id,transactions.user_id,transactions.branch_id,transactions.customer_id,transactions.membership_type_id,transactions.bill_amount,transactions.bill_date")
  treport = TransactionReport.new 
  puts "from report"
  tran.each do |u|
  bs = TransactionReport.new(
    :user_id => u.user_id,
    :branch_id => u.branch_id,
    :transaction_id => u.id,
    :customer_id => u.customer_id,
    :membership_type_id => u.membership_type_id,
    :bill_amount => u.bill_amount,
    :bill_date => u.bill_date
 )
  bs.save

Here the object creation will happen in loop so this will create new object for TransactionReport with each insertion. How to avoid this in rails3.....?

Thank you
vishnu



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

Gmane