Re: [Rails] How to get around a reserved word

2014-03-04 Thread Dheeraj Kumar
Namespace it? Product::Action for the model, and product_action_path(@instance_var) in the routes. On Wed, Mar 5, 2014 at 12:32 PM, Walter Lee Davis wrote: > I need to use the model name 'Action' (which will not work in Rails 4.0.3) > for business reasons (it's a product name). If I name the act

[Rails] How to get around a reserved word

2014-03-04 Thread Walter Lee Davis
I need to use the model name 'Action' (which will not work in Rails 4.0.3) for business reasons (it's a product name). If I name the actual model something else, is there any way to (maybe with mod_rewrite) make the URL appear the way I need it to while keeping everything working in Rails? I've

Re: [Rails] Testing strong parameters

2014-03-04 Thread Dheeraj Kumar
Use permitters instead. Easily testable. On Mar 5, 2014 3:26 AM, "bertly_the_coder" wrote: > LOL! Thx Dave. > > Anyone else figured/figuring this out or found some documentation about it? > > On Tuesday, March 4, 2014 10:02:50 PM UTC+3, Dave Aronson wrote: >> >> On Tue, Mar 4, 2014 at 1:13 PM, be

[Rails] find_by_sql query running incredibly slow

2014-03-04 Thread John Merlino
Initially, I was using this query: report_ids = [] if units.size > 0 units.map(&:id).uniq.each do |id| report_id = Report.select(:id).where(unit_id: id).order("time desc").first unless report_id.nil? report_ids << report_id end end end

[Rails] Re: navigation list order by

2014-03-04 Thread Rick
On Tuesday, March 4, 2014 12:04:46 PM UTC-5, Steven Cahill wrote: > > Thanks Rick > > on the actual categories page the categories are listed in category_id > order correctly, I have the following code in my controller > > # GET /categories > # GET /categories.json > def index > @cate

Re: [Rails] Testing strong parameters

2014-03-04 Thread bertly_the_coder
LOL! Thx Dave. Anyone else figured/figuring this out or found some documentation about it? On Tuesday, March 4, 2014 10:02:50 PM UTC+3, Dave Aronson wrote: > > On Tue, Mar 4, 2014 at 1:13 PM, bertly_the_coder > > > wrote: > > > They all pass. That's the problem. Mass-assignment > > doesn't se

[Rails] Re: Making sure the Admin of a website is not deleted

2014-03-04 Thread mike
On Tuesday, March 4, 2014 2:54:38 PM UTC-5, Ruby-Forum.com User wrote: > > Hi, > > Thank you for your reply. I only have one admin on the website as shown > below (code taken from seeds.rb). > > User.create(:name => "weds4u", :password => "w", :password_confirmation > => "w", :role => 'admin'

[Rails] Re: Making sure the Admin of a website is not deleted

2014-03-04 Thread Zainab Mohamed
Hi, Thank you for your reply. I only have one admin on the website as shown below (code taken from seeds.rb). User.create(:name => "weds4u", :password => "w", :password_confirmation => "w", :role => 'admin') User.create(:name => "Afsheen", :password => "a", :password_confirmation => "a", :role =

[Rails] Re: Making sure the Admin of a website is not deleted

2014-03-04 Thread Zainab Mohamed
Ganesh Ranganathan wrote in post #1138798: > You can use a before_action filter in the controller to check both the > current user's permissions and the user he is about to delete. > > And if it is another admin user or himself, then redirect them to > another > page with a flash error message. Mor

Re: [Rails] Making sure the Admin of a website is not deleted

2014-03-04 Thread Ganesh Ranganathan
You can use a before_action filter in the controller to check both the current user's permissions and the user he is about to delete. And if it is another admin user or himself, then redirect them to another page with a flash error message. More details at the filter link below http://guides.ruby

[Rails] Making sure the Admin of a website is not deleted

2014-03-04 Thread Zainab Mohamed
Hello, I am a second year undergrad designing a ruby on rail program for wedding. I am struggling so much with lots of code but one main thing which I don't understand how to do is to make sure that if the administrator has the rights to delete any registered users, then they don't delete their o

Re: [Rails] Testing strong parameters

2014-03-04 Thread Dave Aronson
On Tue, Mar 4, 2014 at 1:13 PM, bertly_the_coder wrote: > They all pass. That's the problem. Mass-assignment > doesn't seem to get caught by the testing environment. Ah, yes, that is odd. Maybe you could check out the tests from that part of Rails, or of the strong_parameters gem, and see how t

[Rails] Group_by for inbox

2014-03-04 Thread Andrew Kelley
How an I make the code below only show "no new messages" once rather than multiple times when there are multiple tickets? %tbody - @users_tickets.each do |t| - unless t.ticket_replies.empty? %tr %td= t.business.name %td= link_to "#{t.c

Re: [Rails] Testing strong parameters

2014-03-04 Thread bertly_the_coder
They all pass. That's the problem. Mass-assignment doesn't seem to get caught by the testing environment. On Tuesday, March 4, 2014 8:13:03 PM UTC+3, Dave Aronson wrote: > > On Tue, Mar 4, 2014 at 8:49 AM, bertly_the_coder > > > wrote: > > > Has anyone figured out how to test strong parameters

[Rails] Mysql2::Error: Lost connection to MySQL server during query: SELECT

2014-03-04 Thread David Webster
I keep getting this type of error, and have researched this for weeks on the internet. tried every suggestion and it still persists.. An ActiveRecord::StatementInvalid occurred in customer#go_to_consultation: Mysql2::Error: Lost connection to MySQL server during query: SELECT `users`.* FRO

Re: [Rails] navigation list order by

2014-03-04 Thread Scott Ribe
On Mar 4, 2014, at 10:04 AM, Steven Cahill wrote: > def index > @categories = Category.order('id asc') > end > > The only problem is the navigation list that I have put into the application > layout page seems to have a mind of its own, here is the code for So why are you using Catego

Re: [Rails] Re: navigation list order by

2014-03-04 Thread Donald Ziesig
Hi Steve: Try the following: <% Category.order("id DESC).each do |category| %> rather than Category.all ... See http://guides.rubyonrails.org/active_record_querying.html#ordering Don Ziesig On 03/04/2014 12:04 PM, Steven Cahill wrote: Thanks Rick on the actual categories page the categorie

Re: [Rails] Testing strong parameters

2014-03-04 Thread Dave Aronson
On Tue, Mar 4, 2014 at 8:49 AM, bertly_the_coder wrote: > Has anyone figured out how to test strong parameters? You mean test the concept itself, or test that your usage of it does what you intend? I haven't done so, but offhand, I would guess you could do that by testing a few requests with go

Re: [Rails] Rails controller problems

2014-03-04 Thread Dave Aronson
On Mon, Mar 3, 2014 at 4:01 PM, Brandon wrote: > This is what my User/Create looks like after rethinking my controller. Does > it need more work to make it slimmer? I've seen (and even made) much worse, but this can be slimmed down fairly easily. The sign_in and that big if-statement, have noth

[Rails] Re: navigation list order by

2014-03-04 Thread Steven Cahill
Thanks Rick on the actual categories page the categories are listed in category_id order correctly, I have the following code in my controller # GET /categories # GET /categories.json def index @categories = Category.order('id asc') end The only problem is the navigation list that

Re: [Rails] Calling function from html.erb

2014-03-04 Thread Carlos Figueiredo
Put your code on github. It could be a good oportunity to you train git, and for us, is an easier way to know what the context of your problem... First, I recommend to read that: http://guides.rubyonrails.org/routing.html Second... try plan better your routes. It's not related with your currently

Re: [Rails] multiple files upload

2014-03-04 Thread Walter Lee Davis
The simplest multiple file upload I have seen is using the browser-native method of applying multiple: true to the file field. (This does exclude older versions of IE, but they will simply be able to upload a single file.) To make this work, the form must be on the parent of the association --

[Rails] Testing strong parameters

2014-03-04 Thread bertly_the_coder
Hi guys, Has anyone figured out how to test strong parameters? -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.

Re: [Rails] What are the best strategies/practices for Rails upgradation from 2.3.11 to 4.0.0?

2014-03-04 Thread Rick
Step zero point one is to review your 6/7 plugins and 5/6 gems and ensure they've been moved forward to your final target. On Tuesday, March 4, 2014 4:05:51 AM UTC-5, Colin Law wrote: > > On 4 March 2014 05:09, Raju Ay > > wrote: > > I would like to upgrade one of my application from rails -2.3

[Rails] Re: navigation list order by

2014-03-04 Thread Rick
Not sure from your question, you seem to be asking "How do I sort the Categories index?" but you've provided a link_to that deals with a single Category. Typically, you'ld order your Categories in the controller index method and the ordered list would be available in the index.html.erb view as

[Rails] Re: Is it possible to backup Solr

2014-03-04 Thread Karthikeyan A K
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 unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscr...@googlegroups.com. To po

[Rails] multiple files upload

2014-03-04 Thread Subbu Edimbeta
Hi, I am newbie to Ruby on Rails.I am trying to develop multiple files upload sample app using any plugin with Rails 4.0 version, but I haven't find much information on that over the web. So,Please suggest me or provide any info to develop it. Thanks, Subbu -- Posted via http://www.ruby-for

[Rails] navigation list order by

2014-03-04 Thread Steven Cahill
Hello Everybody I have a navigation that draws data from a category table, I would like to display the navigation by category ID order, this is the code I have so far <%= link_to category.title, category_path(category) %> in the view not sure where to go next to get order by category id Steven

[Rails] Dependency drop down list

2014-03-04 Thread Praveen BK
Hello, I am trying load a drop down list based on selection from first drop down list. Based on first drop down list selection, I am able to fetch data for second drop down list but I am not able to refresh second dropdown list contents. How Can I refresh second drop list on selection of fir

Re: [Rails] What are the best strategies/practices for Rails upgradation from 2.3.11 to 4.0.0?

2014-03-04 Thread Colin Law
On 4 March 2014 05:09, Raju Ay wrote: > I would like to upgrade one of my application from rails -2.3.11 to 4.0.0. > Before going to do anything, I just need plan for it and my application not > that much of big size but got some 6/7 plugins and 5/6 gems. > > Existed: Ruby 1.8.7 + Rails 2.3.11

Re: [Rails] Calling function from html.erb

2014-03-04 Thread Colin Law
On 3 March 2014 19:57, Alfredo Barrero wrote: > Good night everyone, > > My name is Alfredo Barrero and I'm getting started with RoR. I have been > learning with "Agile Web Development". > > Now I'm trying to do my own web application. I have a problem and I don't > know what I'm doing wrong, coul