Hi Srimanta,
Assigning values directly to the DB columns from UI can cause sql
injection. To avoid this, I would write this as :
@user = User.find(:first, :conditions = [name = ?, params[:name]])
I think, your association between User and Role is as follows :
User has many roles
Role has many
On 3 February 2012 07:07, Srimanta Chakraborty li...@ruby-forum.com wrote:
This is a piece of code found in a fictional Rails controller and
model.
Please point out any bugs or security problems in the code, fix them,
and refactor the code to make it cleaner.
Sure... how much are you
Thanks a lot.
--
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
Srimanta Chakraborty wrote in post #1043855:
Thanks everybody I have solved this problem.
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this group, send email to
Srimanta Chakraborty wrote in post #1043866:
Thanks a lot to Neethu Satheesh.
Can you help me once again to answer the following:
What problems can arise when users hits the get_pdf action?
If there are problems, how can it be solved?
class PdfController ApplicationController
def
On 3 February 2012 09:33, Srimanta Chakraborty li...@ruby-forum.com wrote:
Thanks everybody I have solved this problem.
Would you like to contribute your solution so that anyone searching
for the same problem could benefit from your experience?
--
You received this message because you are
Hi,
I have a controller action which is taking 10 seconds to run. Most of
the time is being spent in a view which is a large file.(more than 1500
lines). How shall I go about debugging the speed issue?
--
Posted via http://www.ruby-forum.com/.
--
You received this message because you are
Hi
I had a IDE netbeans now I have installed red car but after
installing redcar my NETBEANS not working so I want to remove redcar
from my local machine(ubuntu 10.10)
when I put this in console:
sudo gem uninstall redcar
I got
WARNING: Invalid .gemspec format in
Hi Srimanta,
You can debug this using the method benchmark at various points of the
code to find where it is taking time in models, controllers and in
views.
Explore more in
http://guides.rubyonrails.org/performance_testing.html#helper-methods
Lines of code is not always proportional to the
Neethu Satheesh wrote in post #1043873:
Hi Srimanta,
You can debug this using the method benchmark at various points of the
code to find where it is taking time in models, controllers and in
views.
Explore more in
http://guides.rubyonrails.org/performance_testing.html#helper-methods
venkata reddy wrote in post #1026555:
Got it
it should be @volunteers = Volunteer.near([@party.latitude,
@party.longitude], 10, :order = :distance)
Thank you, venkata! Very little clear and concise documentation out
there and this kind of help is much appreciated!
--
Posted via
1. Provide the models required
2. Each article can be related to many articles (or none).Provide code
for making @article.related_articles work
3. Clean up the code according to rails conventions
class ArticleController ApplicationController
def show
@article = Article.find(params[:id])
On 3 February 2012 10:24, Srimanta Chakraborty li...@ruby-forum.com wrote:
1. Provide the models required
2. Each article can be related to many articles (or none).Provide code
for making @article.related_articles work
3. Clean up the code according to rails conventions
Really? you're just
Michael Pavling wrote in post #1043878:
On 3 February 2012 10:24, Srimanta Chakraborty li...@ruby-forum.com
wrote:
1. Provide the models required
2. Each article can be related to many articles (or none).Provide code
for making @article.related_articles work
3. Clean up the code according to
On 3 February 2012 11:23, Srimanta Chakraborty li...@ruby-forum.com wrote:
Michael Pavling wrote in post #1043878:
Really? you're just pasting your homework questions directly to the
list now without even paraphrasing them?!
Yes
Hahaha! At least you're honest :-)
--
You received this
I can't seem to get Guard 1.0.0 and rb-fsevent 0.9.0 or 0.4.3.1 to
talk to each other. Is there a way to get Guard to use polling instead
of rb-fsevent? I was on 10.6.6. Updating to 10.6.8 did not help. I
updated my XCode to 3.2.6 and that did not help.
I ran a utility called fseventmon that
Michael Pavling wrote in post #1043893:
On 3 February 2012 11:23, Srimanta Chakraborty li...@ruby-forum.com
wrote:
Michael Pavling wrote in post #1043878:
Really? you're just pasting your homework questions directly to the
list now without even paraphrasing them?!
Yes
Hahaha! At least
On 3 February 2012 11:34, Srimanta Chakraborty li...@ruby-forum.com wrote:
Michael Pavling wrote in post #1043878:
Really? you're just pasting your homework questions directly to the
list now without even paraphrasing them?!
Yes
Hahaha! At least you're honest :-)
Thanks for your
prawn (0.8.4)
prawn-core (0.8.4)
prawn-format (0.2.3)
prawn-layout (0.8.4)
prawn-security (0.8.4)
the above gem ive used for pdf
this is the error i get
NoMethodError in Employee#profile_pdf
Showing app/views/employee/profile_pdf.pdf.prawn where line #1 raised:
undefined method `header' for
@Michael is right. We can help you in doing this, in case you are stuck up
somewhere, but you must really atleast make an effort.
As of point 3, you can consider the following suggestions:
1. `current_user.roles.map {|r| r.to_s}.include?('admin')`
Consider moving this code to User model
On Fri, Feb 3, 2012 at 3:27 AM, Michael Pavling pavl...@gmail.com wrote:
On 3 February 2012 11:23, Srimanta Chakraborty li...@ruby-forum.com wrote:
Michael Pavling wrote in post #1043878:
Really? you're just pasting your homework questions directly to the
list now without even paraphrasing
I don't l know why you waste your time -or the group's time - on this guy.
Trying not to say this loser. Oops, just did.
On Feb 3, 2012, at 8:07 AM, Greg Akins angryg...@gmail.com wrote:
On Fri, Feb 3, 2012 at 3:27 AM, Michael Pavling pavl...@gmail.com wrote:
On 3 February 2012 11:23,
Prince Joseph wrote in post #1043906:
@Michael is right. We can help you in doing this, in case you are stuck
up
somewhere, but you must really atleast make an effort.
As of point 3, you can consider the following suggestions:
1. `current_user.roles.map {|r| r.to_s}.include?('admin')`
On Fri, Feb 3, 2012 at 5:12 AM, Scott Eisenberg sco...@btrtrucks.com wrote:
I don't l know why you waste your time -or the group's time - on this guy.
Trying not to say this loser. Oops, just did.
Scott. Are you calling me a loser for posting the comments about Srimanta?
--
Greg Akins
hey everyone i am using ubuntu 11.04 and i wanna install rails 3.0.0
now i have 2.3.8 rails and 1.8.7 ruby. how can i have both of 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
Use rvm http://beginrescueend.com/ and enjoy :)
On Fri, Feb 3, 2012 at 6:51 PM, honey ruby emailtohoneyr...@gmail.comwrote:
hey everyone i am using ubuntu 11.04 and i wanna install rails 3.0.0
now i have 2.3.8 rails and 1.8.7 ruby. how can i have both of them
--
You received this message
Robert Walker wrote in post #1043857:
Deepika Vummiti wrote in post #1043854:
My application in rails 2.3.14, i want to implement the web services
method, please tell which one shall i use.
I have tried some action-webservice and one soap concept, but i didnt
get the request and responses
ok but will my previous rails will be there.
On Fri, Feb 3, 2012 at 6:55 PM, Prince Joseph pri...@mobomo.com wrote:
Use rvm http://beginrescueend.com/ and enjoy :)
On Fri, Feb 3, 2012 at 6:51 PM, honey ruby emailtohoneyr...@gmail.comwrote:
hey everyone i am using ubuntu 11.04 and i wanna
You are basically installing a new ruby version with a whole new set of
gems while using rvm and you can switch between the ruby versions using
rvm. So, in the new ruby inside rvm, there will be no gems. You will have
to install all the gems including rails. So, the previous version of rails
will
Deepika Vummiti wrote in post #1043913:
Will u plz tell some other webservices methods, atleast i want 2 or 3
example applications in soap concepts, i didnt get this concept fully.
I'm sorry, I don't quite understand this question.
What do you mean by, other web services methods? Do you mean
On 3 February 2012 13:15, Greg Akins angryg...@gmail.com wrote:
On Fri, Feb 3, 2012 at 5:12 AM, Scott Eisenberg sco...@btrtrucks.com wrote:
I don't l know why you waste your time -or the group's time - on this guy.
Trying not to say this loser. Oops, just did.
Scott. Are you calling me a
On Fri, Feb 3, 2012 at 7:12 AM, Michael Pavling pavl...@gmail.com wrote:
Not if you read it thus:
I don't l know why you waste your time on this loser.
OK, I'll read it that way ;-)
Incidentally, even though I was shocked by Srimanta's request, I did
learn something from Prince's response.
No sir. Not you!
Apologies if I gave you that impression.
On Feb 3, 2012, at 8:15 AM, Greg Akins wrote:
On Fri, Feb 3, 2012 at 5:12 AM, Scott Eisenberg sco...@btrtrucks.com wrote:
I don't l know why you waste your time -or the group's time - on this guy.
Trying not to say this loser.
hi i have installed rails3.2.1 and rvm but this had happen
*** LOCAL GEMS ***
actionmailer (3.2.1, 2.3.8)
actionpack (3.2.1, 2.3.8)
activemodel (3.2.1)
activerecord (3.2.1, 2.3.14, 2.3.8)
activeresource (3.2.1, 2.3.8)
activesupport (3.2.1, 2.3.14, 2.3.8)
addressable (2.2.6)
arel (3.0.0)
builder
I agree that insults in general are bad. This rare time it seemed deserved.
A few questions are fine. Being a chump for someone who won't do their
homework is beyond the pale. Programmers don't always have good local
resources for help. As a student, he should have a professor, TA, fellow
hey everyone i have installed rails 3.2.1 and want to create app but i
use mysql wht the gems need to add in gem file
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
Actually, you can use both Rails 2.3.8 and Rails 3.2.1 while using Ruby
1.8.7.
For example, if you want to create a new project, you can use:
1. Rails 3.2.1 - 'rails new appname'
2. Rails 2.3.8 - 'rails _2.3.8_ appname'
Already running projects will work as it should.
But, when I
On Fri, Feb 3, 2012 at 7:53 AM, hanish jadala
emailtohoneyr...@gmail.com wrote:
hi i have installed rails3.2.1 and rvm but this had happen
*** LOCAL GEMS ***
actionmailer (3.2.1, 2.3.8)
You need to read the rvm documentation on gemsets.
--
Hassan Schroeder
You need to add 'gem mysql2' in your Gemfile and then run 'sudo bundle
install'.
On Fri, Feb 3, 2012 at 9:33 PM, honey ruby emailtohoneyr...@gmail.comwrote:
hey everyone i have installed rails 3.2.1 and want to create app but i
use mysql wht the gems need to add in gem file
thanks in
On Fri, Feb 3, 2012 at 11:00, Scott Eisenberg sco...@btrtrucks.com wrote:
Certainly 'nuff said on this chancer (whatever that is :-)) for now.
Heh. I had to go look it up too.
http://www.merriam-webster.com/dictionary/chancer says:
===8---cut here---
British
: a scheming opportunist
Quoting Srimanta Chakraborty li...@ruby-forum.com:
Hi,
I have a controller action which is taking 10 seconds to run. Most of
the time is being spent in a view which is a large file.(more than 1500
lines). How shall I go about debugging the speed issue?
Profile it. See which methods are
Hi I have problem trying to pass the signin failure test.
This is the test code of the sessions_controller.rb
def create
user = User.authenticate(params[:session][:email],
params[:session][:password])
if user.nil?
flash.now[:error] =
The problem here is that your user object, isn't retrieving any objects on
precisely this line:
user = User.authenticate(params[:session][:email],
params[:session][:password])
:) Exactly what you where trying to do when this happened?
2012/2/3 Jean
Well I tried two things. Go to localhost:3000/signin click on sign
in button with out any information on email and password field, and I
get this error. But if I fill the field with and user and password,
that exist in my db I get the same error. And in the book at this time
I suppost to see a
On Fri, Feb 3, 2012 at 11:37, Jean josor...@gmail.com wrote:
NoMethodError in SessionsController
#create undefined method `nil' for nil:NilClass
I check the book many times and I have code exactly as the book,
but I still have the error. Any help???
It is a bit odd. When we see undefined
On Fri, Feb 3, 2012 at 11:53, Jean josor...@gmail.com wrote:
if I fill the field with and user and password,
that exist in my db I get the same error.
That also sounds like a forgotten question mark. Ruby would try to
call it, and fail, either way.
-Dave
--
Dave Aronson: Available Cleared
hey everyone i have installed rails3.0.0 in windows and my previous
rails projects not working . so i wanna uninstall rails and then
install from Scratch.
thanks in advance
--
You received this message because you are subscribed to the Google Groups Ruby
on Rails: Talk group.
To post to this
No Dave, I copy from my code. And this is the error:
NoMethodError in SessionsController#create
undefined method `nil' for nil:NilClass
Rails.root: /Users/jeanosorio/rails_projects/sample_app
Application Trace | Framework Trace | Full Trace
app/models/user.rb:37:in `authenticate'
My database(PostgreSQL) have some amount of data, so i need to retrieve the
data for current date only.But my doubt is how to compare the today date
with created_at field. Now am trying so many ways to find that.
Is this correct way * where created_at BETWEEN '2012-01-16 00:00:00.0'
AND
def self.authenticate(email, submitted_password)
user = find_by_email(email)
return nil if user.nil
return user if user.has_password?(summitted_password)
end
Here 'user.nil' in the third line should be 'user.nil?'. There is a typo
('?' missing).
On
On 3 February 2012 17:13, Jean josor...@gmail.com wrote:
No Dave, I copy from my code. And this is the error:
NoMethodError in SessionsController#create
undefined method `nil' for nil:NilClass
Rails.root: /Users/jeanosorio/rails_projects/sample_app
Application Trace | Framework Trace |
OMG thank you s much!!!
On Feb 3, 12:33 pm, Prince Joseph pri...@mobomo.com wrote:
def self.authenticate(email, submitted_password)
user = find_by_email(email)
return nil if user.nil
return user if user.has_password?(summitted_password)
end
On Fri, Feb 3, 2012 at 12:13, Jean josor...@gmail.com wrote:
And this is the code for user model
def self.authenticate(email, submitted_password)
user = find_by_email(email)
return nil if user.nil
Aha! Right error, wrong place. Here's where you're missing the
amvis wrote in post #1043961:
My database(PostgreSQL) have some amount of data, so i need to retrieve
the
data for current date only.But my doubt is how to compare the today date
with created_at field. Now am trying so many ways to find that.
Is this correct way * where created_at BETWEEN
one query got it from guides.rubyonrails.org
--
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/-/9P-2Rz9ZWzoJ.
To post to this group, send email to
I am using gem 'ckeditor', '3.5.0', Rails 3..
It works fine in my 'New' and 'Edit' pages but not 'Show' page
'New' and 'Edit' pages using the following...
%= form_for @question,
%= f.cktext_area :correct_anno, :toolbar='Full', :width='1140px',
:height='250px' %
and all is good.
Show action uses a
Hello Friends,
I have a rails application where requirement is that, I want to display
books based on likes and expiry date..
I am using the following query
select books.*, (select count(*) from likes where likes.book_id = books.id)
as ct
from books, book_expires where book_expires.book_id =
Thanks..
--
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/-/AghPe-3qIR8J.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
amvis wrote in post #1043961:
My database(PostgreSQL) have some amount of data, so i need to retrieve
the
data for current date only.But my doubt is how to compare the today date
with created_at field. Now am trying so many ways to find that.
Is this correct way * where created_at BETWEEN
LOL thanks Dave!!
On Feb 3, 12:54 pm, Dave Aronson googlegroups2d...@davearonson.com
wrote:
On Fri, Feb 3, 2012 at 12:13, Jean josor...@gmail.com wrote:
And this is the code for user model
def self.authenticate(email, submitted_password)
user = find_by_email(email)
On Fri, Feb 3, 2012 at 00:52, Soichi Ishida li...@ruby-forum.com wrote:
How can I stay in that page even after clicking the save button for a
new script?
In your controller, you have control over what page gets rendered.
When you create a new script, attached to a video, you can simply have
honey jadala wrote in post #1043958:
hey everyone i have installed rails3.0.0 in windows and my previous
rails projects not working . so i wanna uninstall rails and then
install from Scratch.
1. Uninstall Windows.
2. Install Ubuntu (or your choice of Linux flavor).
3. Install Ruby Version
Hi
Have you tried gem uninstall rails ?
On Fri, Feb 3, 2012 at 2:09 PM, honey ruby emailtohoneyr...@gmail.comwrote:
hey everyone i have installed rails3.0.0 in windows and my previous
rails projects not working . so i wanna uninstall rails and then
install from Scratch.
thanks in advance
Hi everyone,
I'm sure the answer is out there and quite simple, but I haven't been
able to find it.
Suppose I have the following classes with polymorphic associations:
class Comment ActiveRecord::Base
belongs_to :commentable, :polymorphic = true
end
class Camera ActiveRecord::Base
Just in case this wasn't clear, I would like every comment to belong
to a user and only be editable by that user, but be associated with a
product type (Camera, Book, etc.). This is why I doubt the simple
class definition I outlined below would suffice.
Best,
Mike
On Feb 3, 4:26 pm, Mike Kim
Sounds like you could just add a belongs_to :user to the Comment class.
But since you already have comments on the user, you'll need to give the
reverse association another name. Perhaps comments_owned
So add has_many :comments_owned, :class_name = Comment to User.
--
You received this
Thanks, Tim
Actually, and I haven't fully tested this out yet, I think it's
simpler than that. Currently, I hvae the following:
class Comment ActiveRecord::Base
belongs_to :user
belongs_to :commentable, polymorphic = true
...
end
and that seems to be working. I have another issue now that
Hi everyone,
I have the following classes:
class User ActiveRecord::Base
devise :database_authenticatable, :registerable, :timeoutable,
:recoverable, :rememberable, :trackable, :validatable
has_many :comments, :dependent = destroy
...
end
class Comment ActiveRecord::Base
Hi all
I want a functionality of Downloading Multiple files from
site with single request without using zip concept.Please anybody help
me out 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
I don't think this is possible. A single request will have only a single
response.
On 04-Feb-2012, at 11:24 AM, Muruga murugu2...@gmail.com wrote:
Hi all
I want a functionality of Downloading Multiple files from
site with single request without using zip concept.Please anybody help
70 matches
Mail list logo