Ruby on Rails Tuesday, January 31, 2012


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

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@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,

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@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 Jan 31, 7:16 pm, Christopher Jones <li...@ruby-forum.com> 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/

For what you describe, that should work. As a note, games can have
only one user. If that was not your intention, look at has_many
through and has_and_belongs_to_many.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 able to create databases (development, test, and production
databases) as follows
.................................................................
ajit@ajit:~$ su - postgres
Password:
postgres@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

--
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'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@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

how to capture the response code from our rails 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

Hi everyone,

when I run my rspec tests, my initializers are run twice: Once in
development mode, once in test mode. Why does Rails do this? Can this
be turned off?

--
Roger Braun
rogerbraun.net | humoralpathologie.de

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 took some time to search and find if job postings are acceptable here and what format the community seems to prefer.  Hope this is ok.  


Confident you can design/build for high performance RoR web infrastructure that serves tens of thousands of users concurrently?  Users accessing massive amounts of data?

Look into the future. You came into a world class software company three years ago to build elaborate, high traffic web products for a global media powerhouse. These are not shopping or informational websites, but complex and detailed business services delivered over the web to the most sophisticated customers.  You've grown with the team and can now continue to thrive in one of the world's most advanced software development organizations or parlay the experience into a new direction.

This company offers 4 weeks vacation to start, free health insurance for your whole family, 50% 401k match, and very healthy comp among other benefits. They have carefully built a highly diverse and high performance software development organization. You will emerge a much better developer in a few years. In this company software performance is more important than anything else. This is not a punch the clock and wait for a 3% annual raise job. This is a "let's make it better than any other company in the world can" job.

The tech: we are looking serious experience on high traffic RoR customer facing sites.

Bonus for skill in Java.

Web services creation experience with SOAP or REST.

Design with HTML, CSS and JavaScript (JQuery)

It's an Agile development environment.

 

To discuss please email me: davef (at) coresearchinc (dot) com.

Best,

DAVE

--
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/-/VmheOPfwDdkJ.
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 Tue, Jan 31, 2012 at 5:26 PM, Kevin Bedell <kbedell@gmail.com> wrote:
In this case, use 'device' --

Small detail, it's 'devise'  (with an 's').


Peter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 noticed that Rails cache is not cleared between tests.
I'm wondering if this shouldn't be the default behaviour.

What are your thoughts on 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/-/jtqQXycEHuYJ.
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 Tue, Jan 31, 2012 at 02:28, Soichi Ishida <lists@ruby-forum.com> wrote:

> It was simpler than I thought!

Rails often is. For example, a while back I was trying to do a simple
timesheet system. Couldn't figure out how to force the newly entered
entries into the right places. Came up with a hairy and fragile way,
that duplicated a lot of what Rails was doing behind the scenes.
Correct solution? Don't. Just let Rails do it. No problem. Now I
use essentially the same technique in The Decider
(http://thedecider.herokuapp.com), to let Rails keep track of which
rating in the spreadsheet is for which alternative in which factor.

> Thanks again.

You're welcome.

-Dave

--
Dave Aronson:  Available Cleared Ruby on Rails Freelancer
(NoVa/DC/Remote) -- see www.DaveAronson.com, and blogs at
www.Codosaur.us, www.Dare2XL.com, www.RecruitingRants.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 31 Jan 2012, at 18:27, Javier Quarite wrote:

> That is weird, in the logs it looks like everything is working
> smoothly, but when I try to access it, takes me about 5 seconds.
>
> It seems that (for example) if I access the app yesterday and then I
> access now, the server starts again (that's what my log says)
> I've never checked this before, but that make the access too slow
> (the first time)

That's normal behavior, it frees up memory on the server that's just
sitting around doing nothing. That's also how Passenger works by
default. It "intelligently" spawns and kills off instances.

But rest assured, if your application has more users accessing it, it
won't be suspended.


Best regards

Peter De Berdt

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

Ruby on Rails

I believe this to be the root issue. That's why things like reserved instances at AWS are sometimes better because they stay up all the time.

I understand the Google App engine is the same way. Makes it unusable for Grails apps because spinning up the JVM is so slow the app startup even times out causing no load at all.

On Jan 31, 2012, at 12:26 PM, Greg Akins <angrygreg@gmail.com> wrote:

> On Tue, Jan 31, 2012 at 12:19 PM, Dieter Lunn <coder2000@gmail.com> wrote:
>
>>
>> On Tue, Jan 31, 2012 at 11:04 AM, Rodrigo Ruiz <rodrigo.ruiz7@gmail.com> wrote:
>>> That is weird, in the logs it looks like everything is working smoothly, but
>>> when I try to access it, takes me about 5 seconds.
>>>
>
> I can't be sure, but.. AFAIK
>
> Does this only happen the first time the page is loaded?
>
> Heroku unloads applications. Both when it's deployed, and after
> periods of inactivity. The first load after it's been unloaded is
> always slow.
>
>
>
>
> --
> Greg Akins
> http://twitter.com/akinsgre
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 Tue, Jan 31, 2012 at 12:04 PM, Rodrigo Ruiz <rodrigo.ruiz7@gmail.com> wrote:
That is weird, in the logs it looks like everything is working smoothly, but when I try to access it, takes me about 5 seconds.



It seems that (for example) if I access the app yesterday and then I access now, the server starts again (that's what my log says)
I've never checked this before, but that make the access too slow (the first time)


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 Tue, Jan 31, 2012 at 12:19 PM, Dieter Lunn <coder2000@gmail.com> wrote:

>
> On Tue, Jan 31, 2012 at 11:04 AM, Rodrigo Ruiz <rodrigo.ruiz7@gmail.com> wrote:
>> That is weird, in the logs it looks like everything is working smoothly, but
>> when I try to access it, takes me about 5 seconds.
>>

I can't be sure, but.. AFAIK

Does this only happen the first time the page is loaded?

Heroku unloads applications. Both when it's deployed, and after
periods of inactivity. The first load after it's been unloaded is
always slow.


--
Greg Akins
http://twitter.com/akinsgre

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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

It could be the internet itself. Connections are not instantaneous.

Dieter Lunn
http://ubiety.ca

On Tue, Jan 31, 2012 at 11:04 AM, Rodrigo Ruiz <rodrigo.ruiz7@gmail.com> wrote:
> That is weird, in the logs it looks like everything is working smoothly, but
> when I try to access it, takes me about 5 seconds.
>
>
> On Tue, Jan 31, 2012 at 2:59 PM, Javier Quarite <jquarites@gmail.com> wrote:
>>
>>
>>
>> On Tue, Jan 31, 2012 at 11:56 AM, Rodrigo Ruiz <rodrigo.ruiz7@gmail.com>
>> wrote:
>>>
>>> Hi, I just deployed a simple crud (Rails 3.1) to heroku, and it takes
>>> more than 5 seconds to load the index page.
>>>
>>> Does anyone know how to solve this?
>>>
>>> Ps.: locally it takes less than 500 ms, and have more data at the
>>> database.
>>>
>>> Thanks in advance.
>>
>>
>> Have you tried (in console)
>>
>> $ heroku logs
>>
>> It could help, but I have the same problem... sometimes. After that the
>> application works fine
>>
>>
>> Javier Q.
>>
>> --
>> You received this message because you are subscribed to the Google Groups
>> "Ruby on Rails: 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.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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

Heroku put you app into a sleep mode when it's no accessed in a certain amount of time. Sometimes when no one visited you application in the last several minutes and whoever access it, the app will bootstrap, this process can take several minutes. But this only occurs in the first request, subsequents request should run fast.

[]'s
Paulo Poiati

blog.paulopoiati.com


On Tue, Jan 31, 2012 at 3:04 PM, Rodrigo Ruiz <rodrigo.ruiz7@gmail.com> wrote:
That is weird, in the logs it looks like everything is working smoothly, but when I try to access it, takes me about 5 seconds.


On Tue, Jan 31, 2012 at 2:59 PM, Javier Quarite <jquarites@gmail.com> wrote:


On Tue, Jan 31, 2012 at 11:56 AM, Rodrigo Ruiz <rodrigo.ruiz7@gmail.com> wrote:
Hi, I just deployed a simple crud (Rails 3.1) to heroku, and it takes more than 5 seconds to load the index page.

Does anyone know how to solve this?

Ps.: locally it takes less than 500 ms, and have more data at the database.

Thanks in advance.

Have you tried (in console)

$ heroku logs

It could help, but I have the same problem... sometimes. After that the application works fine


Javier Q. 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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

That is weird, in the logs it looks like everything is working smoothly, but when I try to access it, takes me about 5 seconds.

On Tue, Jan 31, 2012 at 2:59 PM, Javier Quarite <jquarites@gmail.com> wrote:


On Tue, Jan 31, 2012 at 11:56 AM, Rodrigo Ruiz <rodrigo.ruiz7@gmail.com> wrote:
Hi, I just deployed a simple crud (Rails 3.1) to heroku, and it takes more than 5 seconds to load the index page.

Does anyone know how to solve this?

Ps.: locally it takes less than 500 ms, and have more data at the database.

Thanks in advance.

Have you tried (in console)

$ heroku logs

It could help, but I have the same problem... sometimes. After that the application works fine


Javier Q. 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 Tue, Jan 31, 2012 at 11:56 AM, Rodrigo Ruiz <rodrigo.ruiz7@gmail.com> wrote:
Hi, I just deployed a simple crud (Rails 3.1) to heroku, and it takes more than 5 seconds to load the index page.

Does anyone know how to solve this?

Ps.: locally it takes less than 500 ms, and have more data at the database.

Thanks in advance.

Have you tried (in console)

$ heroku logs

It could help, but I have the same problem... sometimes. After that the application works fine


Javier Q. 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 just deployed a simple crud (Rails 3.1) to heroku, and it takes more than 5 seconds to load the index page.

Does anyone know how to solve this?

Ps.: locally it takes less than 500 ms, and have more data at the database.

Thanks in advance.

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

Ruby on Rails

I also have this problem but I have root access.
Are there any options?

--
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 appreciate what you're trying to do. I've been a dba in the past and
have built apps using database credentials in the past.

But this is a mistake. They key to being successful with rails is to
leave behind the ways you did things before and embrace 'the rails
way'.

ActiveRecord using a single connection string to connect to the
database -- it's in the database.yml file in the /config directory.
Having it somehow use different credentials based on the user would
make things much more complicated than need be.

My advice -- forget about how you did things before and embrace the
powerful and fast tools that rails provides to do things.

In this case, use 'device' -- it's what almost everyone else uses and
you'll thank yourself later for doing so. If you proceed with the way
you're going then later on you'll kick yourself and wonder what the
hell you were thinking.

Best of luck.

On Mon, Jan 30, 2012 at 11:36 AM, Marcin S <msporysz06@gmail.com> wrote:
> Hello, Im trying to write a simple app  for company internal usage.
> The other applications we use (in php) authenticate users based on
> database credentials, and to be honest I have no idea how to implement
> this. Any suggestions will be great!
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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

2012/1/31 Peter De Berdt <peter.de.berdt@pandora.be>:
>
> On 31 Jan 2012, at 10:43, Colin Law wrote:
>
>>> That would be second option.
>>
>>
>> Since you have top posted everyone will have to scroll down to see
>> which that is.  I will repeat it here to make it easier for those
>> reading it:
>>>>
>>>> prevent the user from logging in unless he uses a valid name/password
>>>> configured for the db
>>
>>
>> The only way I can think of doing that is to attempt to connect to
>> re-connect to the db when he logs in, using his credentials, and see
>> if it successful.
>
>
> There is actually a way to just query the database.
>
> You haven't said what database you're using, but the procedure should be
> more or less the same once you figure out how your specific database stores
> things.
>
> In case of MySQL, you would basically have to establish a connection with
> the database "mysql" from some ActiveRecord model (using
> "establish_connection", search it at http://api.rubyonrails.org/), then make
> sure your ActiveRecord model connects to the "user" table (singular! so use
> self.table_name="user" in Rails 3 or set_table_name in Rails 2) witin that
> database. Then you can just use a method like:
>
> Rails 2.x
> def authenticate(login, passwd)
>   self.first(:conditions => ["Login=? and Password=PASSWORD(?)", login,
> passwd])
> end
>
> Rails 3.x
> def authenticate(login, passwd)
>   self.where("Login=? and Password=PASSWORD(?)", login, passwd).first
> end
>
> This is completely untested and it's an authentication method I'm not too
> fond of, but this is more or less how you could get it done.
>
>
> Best regards
>
> Peter De Berdt

I'm using postgres.
Yea I think thats what I'm looking for, already made some tests and it
appears to be working - but we will see if there are any other
consequences at later time.

Thanks everyone for discuession.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 Colin,

I found the problem, :params wasn't present on partial, so I did it:

<%= will_paginate @cursos , :previous_label => h("<"), :next_label =>
h(">"), :params => { "controller"=>"embaixada","action"=>"cursos",
"search"=> params[:search]} %>

Thanks!

Pedro


On Jan 31, 10:33 am, Colin Law <clan...@googlemail.com> wrote:
> On 31 January 2012 12:16, Pedro <pogerm...@gmail.com> wrote:
>
> > I'm using will_paginate on my app and it's working fine. The problem
> > came when I had to put search field.
> > After the search, the first page comes according to the parameter
> > passed, but when I go to the second page, it don't brings me the
> > second page, but a new search with no search parameter restriction. I
> > tried everything, but didn't work. Could somebody help me?
>
> Have a look in log/development.log to give you some clues as to what
> is happening.
> If you still can't work it out have a look at the Rails Guide on
> Debugging.  In particular see how to use ruby-debug to break into your
> code and inspect data and follow the flow to see what is going wrong.
>
> 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

you have to do an extra loop to get "recommendation_id"
I think your @rec_id should be an array

I have had problems with has_many through in the past
personally I try to avoid it.

On Jan 30, 2:54 pm, "Raminder G." <li...@ruby-forum.com> wrote:
> My model association is as follows:
>
> #book model
> class Book < ActiveRecord::Base
> has_many :recommendations, :dependent => :destroy
> has_many :similars, :through => :recommendations, :conditions =>
> ['recommendation_type IS NULL'], :order => 'recommendations.created_at
> DESC'
>
> #recommendation model
> class Recommendation < ActiveRecord::Base
> belongs_to :book
>
> #Books_controller -  injecting the recommendation_id
> @book_similars = Book.similars
> @book_similars.each do |similar|
>   @rec_id = Recommendation.where(:book_id=>similar.id,
> :recommendation_type=>'S').select('id').first.id
>   similar << {:rec_id => @rec_id}
>   # ^-- Above line gives NoMethodError (undefined method `<<' for
> #<Book:0x10de1f40>):
> end
>
> So as noted above, A book has many similars through recommendations. My
> requirement is that while retrieving similars, I would also like to
> include the id of the corresponding record in the join table
> recommendations.
> My questions are:
>
> How can I include the field *recommendation_id* alongwith similars?
>
> If it cannot be included directly, then what is the correct way to
> determine this field separately (as shown above) and then inject it into
> the similars instance variable so that I can use it directly in my
> views?
>
> --
> 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

I have a custom serializer object that I use for an attribute of
ActiveRecord as presented in this article:
http://www.edgerails.info/articles/what-s-new-in-edge-rails/2011/03/09/custom-activerecord-attribute-serialization/index.html

If I assign a value to that attribute with a form (in my case a nested
form), I don't get the deserialized value in the params hash as it used
to be with Rails 3.1, but now I get a serializer struct that contains
the custom serializer class instance and the deserialized value.

Does anybody know whether this is intentional, or is it just broken and
I have to work around that until it gets fixed...?

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

Colin Law wrote in post #1043237:
> On 31 January 2012 12:01, Srimanta Chakraborty <lists@ruby-forum.com>
> wrote:
>>>> Please help me how to do that, what files or folders should I place
>>> gplus.to/clanlaw
>>
>> I am using Windows OS. In my pc, already xampp is installed. Now by
>> making use of that mysql database how can I fetch data to my Ruby
>> application. Is there any need to install mysql server again though
>> xampp is installed?
>
> I don't know much about Windows, most Rails developers use Mac or
> Linux (often Ubuntu). However first you must check that your mysql
> server is working, presumably there is some way of accessing mysql
> from the command line to check it and to setup users and so on.
> Assuming you have already done this then setup the database details in
> database.yml and all should work.
>
> Personally I advise people not to do Rails development Windows, but
> others do manage this. Either use a virtual machine running, for
> example, Ubuntu, using VirtualBox or VMWare or set your PC up to dual
> boot Windows and Ubuntu, which is very easy.
>
> If you must use windows then I believe using railsinstaller is
> considered the best option at the moment.
>
> Other than the above, if you have further problems while using
> Windows, I am afraid I will have to leave it to others to help.
>
> Colin

I finally got the result. Now I am starting to play with database.
Thanks.

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

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

Ruby on Rails

Sounds like you want DB to tell you the roles people play and what
permissions go with those roles.


On Jan 30, 2:06 pm, Marcin S <msporys...@gmail.com> wrote:
> No, I think...
>
> Its like every db on server have its own set of permissions for
> different users ,right?
> And i want to authenticate user based on that permissions.
>
> 2012/1/30 venkata reddy <venkatareddy...@gmail.com>:
>
>
>
>
>
>
>
> > What do you mean by database here, Do you need something like LDAP
> > authentication?
>
> > On Jan 30, 10:25 pm, Marcin S <msporys...@gmail.com> wrote:
> >> I read README, and i don't see anywere it provides solution I need.
>
> >> Let me clarify, username and password combination must be same as
> >> DATABASE permission (set by db engine).
> >> It has nothing to to do with content on that database itself.
>
> >> 2012/1/30 Everaldo Gomes <everaldo.go...@gmail.com>:
>
> >> > Take a look at the devise gem:
>
> >> >https://github.com/plataformatec/devise
>
> >> > On Mon, Jan 30, 2012 at 2:36 PM, Marcin S <msporys...@gmail.com> wrote:
>
> >> >> Hello, Im trying to write a simple app  for company internal usage.
> >> >> The other applications we use (in php) authenticate users based on
> >> >> database credentials, and to be honest I have no idea how to implement
> >> >> this. Any suggestions will be great!
>
> >> >> --
> >> >> You received this message because you are subscribed to the Google Groups
> >> >> "Ruby on Rails: 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.
>
> > --
> > You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 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+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

Ruby on Rails

http://railscasts.com/episodes/209-introducing-devise
or even more fun:
http://railscasts.com/episodes/235-omniauth-part-1 and
http://railscasts.com/episodes/236-omniauth-part-2


On Jan 30, 11:36 am, Marcin S <msporys...@gmail.com> wrote:
> Hello, Im trying to write a simple app  for company internal usage.
> The other applications we use (in php) authenticate users based on
> database credentials, and to be honest I have no idea how to implement
> this. Any suggestions will be great!

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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

We are looking for web developer in our professional ruby on rails
team in Hungary, who:
- thinks ruby is not a jewel (Ruby experience)
- stores even his/her own to-dos in database (familiarity with mysql,
postgresql, oracle)
- waited eagerly for HTML 5.0 as a child (html, css, javascript
experience)
- 's best friend is console (knowledge of Linux development and
operating environment)
- can understand this job posting (fluent english)

Very Nice to Haves:
- is a real agile warrior (experience with agile development)
- has experience in mobile development (iphone/android)
- has knowledge of search engines: (pl. Apache Lucene, SOLR)
- has Bachelor's degree in Computer Science or equivalent
- knows why multiple inheritance is bad or good (php, java, perl,
python experience)

We offer:
- Agile team
- Innovative projects, product development , creative work
- Participation in Digital Natives Startup Inkubation (e.g.
mixgar.com)
- Trainings, professional development
- Competitive salary
- Pleasant working environment (http://officespotting.blogspot.com/
search?q=digital+natives
)
- Recreational opportunities (foosball, flipper, darts, ...)
Place of work: Budapest XI. district
If you are interested in this position, please submit your resume with
photo to <info at digitalnatives.hu>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 Mon, Jan 30, 2012 at 3:04 PM, LED <leedapdap@gmail.com> wrote:


On Jan 28, 12:52 am, Eduardo Rabelo <oieduardorab...@gmail.com> wrote:
> Hi group,
>
> I'm new here, and, after search and search on Bing (trollface),
>
> I decided to ask the group, I'm having this problem
>
> `to_specs': Could not find railties (>= 0) amongst [bundler-1.0.21, bundler-1.0.21, rake-0.9.2.2, rake-0.9.2] (Gem::LoadError)
>
> Every time on i make "rails s" or "rails new",
>
> This occurred after I updated to Ruby 1.9.2,
>
> Anyone know how i fix it?
> Thx
>

good day try gem update
then
bundle install
bundle update


Actually, I see a similar problem on a directory where I have installed

$ rails new --edge

inside a gemset. What I have to do there is always use `bundle exec`
like this:

$ bundle exec rails console
$ bundle exec rails generate ...

For reference, this is the set-up described here

https://github.com/rails/rails/issues/4749

HTH,

Peter

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 31 January 2012 12:16, Pedro <pogermano@gmail.com> wrote:
> I'm using will_paginate on my app and it's working fine. The problem
> came when I had to put search field.
> After the search, the first page comes according to the parameter
> passed, but when I go to the second page, it don't brings me the
> second page, but a new search with no search parameter restriction. I
> tried everything, but didn't work. Could somebody help me?

Have a look in log/development.log to give you some clues as to what
is happening.
If you still can't work it out have a look at the Rails Guide on
Debugging. In particular see how to use ruby-debug to break into your
code and inspect data and follow the flow to see what is going wrong.

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

On 31 January 2012 12:01, Srimanta Chakraborty <lists@ruby-forum.com> wrote:
> Colin Law wrote in post #1043229:
>> On 31 January 2012 11:47, Srimanta Chakraborty <lists@ruby-forum.com>
>> wrote:
>>> Hi everybody,
>>>  I am very new in Ruby on Rails.
>>> I install ruby(1.9.2p180) and Rails(3.1.3). Also I install RubyMine3.1.1
>>> as IDE.
>>>  I successfully have done some simple simple practices. Now I want to
>>> play with database(mysql).Though I have checked so some of the URLs but
>>> unable to make out.
>>>   Please help me how to do that, what files or folders should I place
>>> and where should I place those. Please guide me.
>>
>> Do you mean you are trying to install a mysql server on your pc, or
>> what?  Please give more detail on exactly what you want to do.
>> Also tell us which operating system you are using.
>>
>> Colin
>>
>>>
>> --
>> gplus.to/clanlaw
>
>  I am using Windows OS. In my pc, already xampp is installed. Now by
> making use of that mysql database how can I fetch data to my Ruby
> application. Is there any need to install mysql server again though
> xampp is installed?

I don't know much about Windows, most Rails developers use Mac or
Linux (often Ubuntu). However first you must check that your mysql
server is working, presumably there is some way of accessing mysql
from the command line to check it and to setup users and so on.
Assuming you have already done this then setup the database details in
database.yml and all should work.

Personally I advise people not to do Rails development Windows, but
others do manage this. Either use a virtual machine running, for
example, Ubuntu, using VirtualBox or VMWare or set your PC up to dual
boot Windows and Ubuntu, which is very easy.

If you must use windows then I believe using railsinstaller is
considered the best option at the moment.

Other than the above, if you have further problems while using
Windows, I am afraid I will have to leave it to others to help.

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

I'm using will_paginate on my app and it's working fine. The problem
came when I had to put search field.
After the search, the first page comes according to the parameter
passed, but when I go to the second page, it don't brings me the
second page, but a new search with no search parameter restriction. I
tried everything, but didn't work. Could somebody help me?

Thanks,

Pedro

Gemfile:

gem "rails", "2.3.8"
gem "will_paginate", "2.3.15"


CONTROLLER:

@cursos = Curso.paginate :per_page => 12, :page =>
params[:page], :conditions => ['nome like ?', "%#{params[:search]}
%"], :order =>'nome, dia_semana'


VIEW:

<% tabnav :embaixada do %>
<% form_tag :url => '/embaixada/cursos', :method => 'get' do %>
<%= text_field_tag :search, params[:search], :value => nil %>
<%= submit_tag "Busca", :name => nil , :disable_with =>
"Aguarde..."%>
<%end%>
<br/>
<div id="full_name">
<%= render :partial => "embaixada/cursos" , :locals => { :cursos
=> @cursos } %>
</div>
<br>
<span class="edit_link"><%= link_to "Adicionar novo
curso", :controller => "curso" , :action => "new" , :embaixada_id
=>@embaixada.id %></span>
<% end %>

PARTIAL:


<% if @cursos and not @cursos.empty? %>
<table class="curso" id="cursos">
<tr class="header">
<th>Curso</th><th>Dia Semana</th><th>Local</th> <th>Horário de
início</th> <th>Horário de fim</th> <th>Professor</th>
</tr>
<% @cursos.each do |curso| %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%= link_to curso.nome, :controller => :curso, :action =>
"edit" ,:embaixada_id => @embaixada.id, :curso_id => curso.id %></td>
<td><%= curso.dia_semana.capitalize %></td>
...
...
...
</table>
<% end %>
<p>
<div style="font-size: small">
<%= will_paginate @cursos %>
</div>

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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

Colin Law wrote in post #1043229:
> On 31 January 2012 11:47, Srimanta Chakraborty <lists@ruby-forum.com>
> wrote:
>> Hi everybody,
>> I am very new in Ruby on Rails.
>> I install ruby(1.9.2p180) and Rails(3.1.3). Also I install RubyMine3.1.1
>> as IDE.
>> I successfully have done some simple simple practices. Now I want to
>> play with database(mysql).Though I have checked so some of the URLs but
>> unable to make out.
>> Please help me how to do that, what files or folders should I place
>> and where should I place those. Please guide me.
>
> Do you mean you are trying to install a mysql server on your pc, or
> what? Please give more detail on exactly what you want to do.
> Also tell us which operating system you are using.
>
> Colin
>
>>
> --
> gplus.to/clanlaw


I am using Windows OS. In my pc, already xampp is installed. Now by
making use of that mysql database how can I fetch data to my Ruby
application. Is there any need to install mysql server again though
xampp is installed?

--
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 31 January 2012 11:47, Srimanta Chakraborty <lists@ruby-forum.com> wrote:
> Hi everybody,
>   I am very new in Ruby on Rails.
> I install ruby(1.9.2p180) and Rails(3.1.3). Also I install RubyMine3.1.1
> as IDE.
>    I successfully have done some simple simple practices. Now I want to
> play with database(mysql).Though I have checked so some of the URLs but
> unable to make out.
>     Please help me how to do that, what files or folders should I place
> and where should I place those. Please guide me.

Do you mean you are trying to install a mysql server on your pc, or
what? Please give more detail on exactly what you want to do.
Also tell us which operating system you are using.

Colin

>     Thanks in advance.
>
> --
> Posted via http://www.ruby-forum.com/.
>
> --
> You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
> To post to this group, send email to rubyonrails-talk@googlegroups.com.
> To unsubscribe from this group, send email to rubyonrails-talk+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

Just a bump!

--
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/-/QLo8XdPmGJgJ.
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 everybody,
I am very new in Ruby on Rails.
I install ruby(1.9.2p180) and Rails(3.1.3). Also I install RubyMine3.1.1
as IDE.
I successfully have done some simple simple practices. Now I want to
play with database(mysql).Though I have checked so some of the URLs but
unable to make out.
Please help me how to do that, what files or folders should I place
and where should I place those. Please guide me.
Thanks in advance.

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

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

Ruby on Rails

On Jan 31, 2:29 am, Rodrigo Ruiz <rodrigo.ru...@gmail.com> wrote:
> I thought they where attr_accessor method.
>
> Thank you for clearing things up for me.

To add a little more info, the attribute values are stored in the
@attributes / @attributes_cache hashes

Fred
>
> On Monday, January 30, 2012, Peter Vandenabeele <pe...@vandenabeele.com>
> wrote:> On Mon, Jan 30, 2012 at 9:59 PM, Rodrigo Ruiz <rodrigo.ru...@gmail.com>
> wrote:
>
> >> Thank you, but I knew that, I did that (use self to do what I want)
>
> before I asked the question.>> I'd just like to know why can't I use @first_name instead of
>
> self.first_name, to me it seems like the same thing inside the model.
>
>
>
>
>
>
>
>
>
> > They are not:
> > @first_name is an "instance variable". You could set it like this:
> >   @first_name = user.first_name
> > but it is not automatically set, and it is also not typically used like
> that.
> > A more typical use would be:
> > @user = User.find(params[:id])
> > and then you can use @user in the controller, but also in the views,
> > due to the set-up of Rails.
> > self.first_name is a method that is dynamically provided by
> > ActiveRecord , based on the available columns for the table
> > "users" in the database.
> > HTH,
> > Peter
>
> > --
> > You received this message because you are subscribed to the Google Groups
>
> "Ruby on Rails: 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

class Project < ActiveRecord::Base
has_one :template
end

class Template < ActiveRecord::Base
belongs_to :project, foreign_key: "project_id"
end

When you create a new project I'd like you to select the template from
a collection of existing templates (created by an admin).

The new project.template should have all of the template's attributes
(clients, tasks etc) and these should be editable without affecting
the original template (a completely new instance).

My difficulty has been in moving all of the template's params through
the select input from a form.

My current (very poor) attempt at the form looks like this:

= simple_form_for @project do |f|
#### project stuff here #####
= simple_fields_for "project[template_attributes]",
@project.build_template do |project_form|
= project_form.input :title, collection: @templates

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 31 Jan 2012, at 10:43, Colin Law wrote:

>> That would be second option.
>
> Since you have top posted everyone will have to scroll down to see
> which that is. I will repeat it here to make it easier for those
> reading it:
>>> prevent the user from logging in unless he uses a valid name/
>>> password configured for the db
>
> The only way I can think of doing that is to attempt to connect to
> re-connect to the db when he logs in, using his credentials, and see
> if it successful.

There is actually a way to just query the database.

You haven't said what database you're using, but the procedure should
be more or less the same once you figure out how your specific
database stores things.

In case of MySQL, you would basically have to establish a connection
with the database "mysql" from some ActiveRecord model (using
"establish_connection", search it at http://api.rubyonrails.org/),
then make sure your ActiveRecord model connects to the "user" table
(singular! so use self.table_name="user" in Rails 3 or set_table_name
in Rails 2) witin that database. Then you can just use a method like:

Rails 2.x
def authenticate(login, passwd)
self.first(:conditions => ["Login=? and Password=PASSWORD(?)",
login, passwd])
end

Rails 3.x
def authenticate(login, passwd)
self.where("Login=? and Password=PASSWORD(?)", login, passwd).first
end

This is completely untested and it's an authentication method I'm not
too fond of, but this is more or less how you could get it done.


Best regards

Peter De Berdt

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

Ruby on Rails

On 31 January 2012 07:53, Marcin S <msporysz06@gmail.com> wrote:
> That would be second option.

Since you have top posted everyone will have to scroll down to see
which that is. I will repeat it here to make it easier for those
reading it:
>> prevent the user from logging in unless he uses a valid name/password configured for the db

The only way I can think of doing that is to attempt to connect to
re-connect to the db when he logs in, using his credentials, and see
if it successful.

Colin


>
> 2012/1/30 Colin Law <clanlaw@googlemail.com>:
>> On 30 January 2012 19:06, Marcin S <msporysz06@gmail.com> wrote:
>>> No, I think...
>>>
>>> Its like every db on server have its own set of permissions for
>>> different users ,right?
>>> And i want to authenticate user based on that permissions.
>>
>> Do you mean you want to connect to the database using the name and
>> password used by user to login, or do you want to prevent the user
>> from logging in unless he uses a valid name/password configured for
>> the db, or both?
>>
>> Colin
>>
>>>
>>>
>>>
>>> 2012/1/30 venkata reddy <venkatareddy.cs@gmail.com>:
>>>> What do you mean by database here, Do you need something like LDAP
>>>> authentication?
>>>>
>>>> On Jan 30, 10:25 pm, Marcin S <msporys...@gmail.com> wrote:
>>>>> I read README, and i don't see anywere it provides solution I need.
>>>>>
>>>>> Let me clarify, username and password combination must be same as
>>>>> DATABASE permission (set by db engine).
>>>>> It has nothing to to do with content on that database itself.
>>>>>
>>>>> 2012/1/30 Everaldo Gomes <everaldo.go...@gmail.com>:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> > Take a look at the devise gem:
>>>>>
>>>>> >https://github.com/plataformatec/devise
>>>>>
>>>>> > On Mon, Jan 30, 2012 at 2:36 PM, Marcin S <msporys...@gmail.com> wrote:
>>>>>
>>>>> >> Hello, Im trying to write a simple app  for company internal usage.
>>>>> >> The other applications we use (in php) authenticate users based on
>>>>> >> database credentials, and to be honest I have no idea how to implement
>>>>> >> this. Any suggestions will be great!
>>>>>
>>>>> >> --
>>>>> >> You received this message because you are subscribed to the Google Groups
>>>>> >> "Ruby on Rails: 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.
>>>>
>>>> --
>>>> You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.
>

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

Hi all. Does anyone know it there are open sources rails app with api
like e.g unisender? I will deploy same app and use it in my apps.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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, 



         My name is vishal Singh.I have 1 year exp in Ruby On Rails.I will work for you remotely.check my github account https://github.com/vishalsingh/multiple_upload_photo.



Regards,
Vishal Singh

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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 Tue, Jan 31, 2012 at 11:15 AM, sachin kewale <sachinkewale@gmail.com> wrote:


On Tue, Jan 31, 2012 at 11:00 AM, subbarao <subbarao.kly@gmail.com> wrote:
On Tuesday 31 January 2012 10:43 AM, sachin kewale wrote:


On Mon, Jan 30, 2012 at 6:44 PM, subbarao <subbarao.kly@gmail.com> wrote:
On Monday 30 January 2012 01:16 PM, sachin kewale wrote:


On Tue, Jan 24, 2012 at 6:06 PM, sachin kewale <sachinkewale@gmail.com> wrote:
hi all,
   i have captcha image on Registration popup but on local the captcha image and code is not coming.
   i have install RMagick and gd2 gem also.It gives following error,

  MissingSourceFile (no such file to load -- GD):
  lib/captcha_image.rb:22
  app/controllers/login_controller.rb:385:in `sign_up'
  -e:2:in `load'
  -e:2

is anyone who used captcha on local machine ?

thanks in advanced.

--
Regards
Sachin S. Kewale




hi all,
   is any one know how to use captcha on locally ? i am using following ror environment,
   ruby 1.8.7 (2011-02-18 patchlevel 334) [i386-mingw32],
   Rails 2.3.11
   ruby gem version:1.6.2

--
Thanks and Regards
 Sachin S. Kewale

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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
I used Recaptcha plugin from google and recaptcha plugin

for me it working fine. If u want you can also try.
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.

hi ,
 thanks for reply can you please send the steps to used Recaptcha plugin in ROR application ?
 It would be really helpful.

--
Regards
Sachin S. Kewale


--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.
register in the below link to get your api key

http://www.google.com/recaptcha

put below line in your gem file

gem 'recaptcha', :require => 'recaptcha/rails'

put you api keys in config/environment.rb filr


ENV['RECAPTCHA_PUBLIC_KEY'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
ENV['RECAPTCHA_PRIVATE_KEY'] = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'

you can verify recaptcha conditions in controller methods by verify_recaptcha varible


ex:-

if !verify_recaptcha
#do operations
end

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.

can you tell me in which gem file i have to put this line
gem 'recaptcha', :require => 'recaptcha/rails'
also,  i have getting the public and private keys for live domain so shall those keys are used for
local environment also ? also i read on some site that 

Download the zip file for the reCAPTCHA WordPress CAPTCHA plugin.
Unzip the recaptcha folder into your WordPress wp-content/plugins directory.

is this necessary ?


--


hi,
  i am now using the reCaptcha plugin in my application but one issue is there when i submit the form value without/with  
  captcha value in below condition it goes in if only
  if !verify_recaptcha
 
   else
 
end

can you know why it is executing if only and not else.



--
Thanks and Regards
Sachin S. Kewale





--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: 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.