[Rails] Why I get the error: Ident authentication failed for user 'abelard' under Cent OS 6, PostgreSQL 9.4

2015-06-29 Thread Dillon Peng
All config files described here are the same as my Mac OS's and all works fine in Mac OS. I got the same error in CentOS 6 x86_64: Ident authentication failed for user 'abelard' When running the following two commands: 1. rake db:create 2. psql -d testforabelard2 -U abelard -h loc

Re: [Rails] Newbie code review

2015-06-29 Thread Colin Law
On 29 June 2015 at 21:27, Federicko wrote: >> Hi All, > > > I have moved everything over to the model as suggested. Check it out :p > > In the model, I created a Class method as well as the previous instance > methods: > > class Article < ActiveRecord::Base > > def self.rank(id, rank) > @this_ar

Re: [Rails] Newbie code review

2015-06-29 Thread Federicko
> > Hi All, I have moved everything over to the model as suggested. Check it out :p In the model, I created a Class method as well as the previous instance methods: class Article < ActiveRecord::Base def self.rank(id, rank) @this_article = find(id) if (rank == "up") @next_article =

Re: [Rails] undefined method `name' for nil:NilClass

2015-06-29 Thread Colin Law
On 29 June 2015 at 18:54, William de Lima wrote: > .. > ActionView::Template::Error (undefined method `name' for nil:NilClass): > 9: .pull-right > 10: = submit_tag t('news.comment'), class: 'btn btn-primary' > 11: .clearfix > 12: - unless @item.comments.any? > 13: #comment-comp

Re: [Rails] Newbie code review

2015-06-29 Thread Colin Law
On 29 June 2015 at 19:42, Federicko wrote: >> Hi Fred, > > > I took your advice and tried to move the ranking logic over to the model. > I've also consolidated the 2 actions. > > Here's what I got: > > In the controller: > > def rank > @this_article = Article.find(params[:id]) > > if (params[:

[Rails] undefined method `name' for nil:NilClass

2015-06-29 Thread William de Lima
Hi, i'm pretty new to the Rail and Ruby and today I have a problem that I have to solve (tl;dr: the expert ruby/rails has left our company and now the newbies like me have to work on the projects that he left). So, let's go straight: I have an app running "normally", login function OK, but then

Re: [Rails] Newbie code review

2015-06-29 Thread Federicko
> > Hi Fred, I took your advice and tried to move the ranking logic over to the model. I've also consolidated the 2 actions. Here's what I got: In the controller: def rank @this_article = Article.find(params[:id]) if (params[:rank] == 'up') @next_article = Article.find_by(rank: @this_

Re: [Rails] Overriding association getters

2015-06-29 Thread Мурыгин Антон
My rails version is 4.2.2. понедельник, 29 июня 2015 г., 20:00:27 UTC+3 пользователь Frederick Cheung написал: > > > > On Monday, June 29, 2015, Мурыгин Антон > > wrote: >> >> Now this is my model >> class Business < ActiveRecord::Base >> belongs_to :category, class_name: 'BusinessCategory', f

Re: [Rails] Overriding association getters

2015-06-29 Thread Frederick Cheung
On Monday, June 29, 2015, Мурыгин Антон wrote: > > Now this is my model > class Business < ActiveRecord::Base > belongs_to :category, class_name: 'BusinessCategory', foreign_key: > 'business_category_id' > > def category > super || BusinessCategory.new(name: 'other') > end > end > > Why

[Rails] Re: Newbie code review

2015-06-29 Thread Federicko
Hi All, Thank for the feedback. Yeah, my next step is to consolidate the two actions together. Good point on using POST instead of GET. I will change the link_to helper. As to using generators, I followed the tutorial and used generators for creating the model and controllers for Articles and

Re: [Rails] Overriding association getters

2015-06-29 Thread Мурыгин Антон
Hey, but i did not rename it. My model hasn't methods called busyness_category! I though AR generates them according to first argument to 'belongs_to' method, rather than from foreign key name понедельник, 29 июня 2015 г., 17:05:42 UTC+3 пользователь Dave Aronson написал: > > On Monday, June 29

Re: [Rails] Send parameters while rendering partial (_show.html.erb, which contains modal) from index.html.erb

2015-06-29 Thread Walter Lee Davis
On Jun 29, 2015, at 8:18 AM, Padmahas Bn wrote: > Hello Elizabeth McGurty that worked!!! (with little modification) > > Unique id for each modal generated fine but when calling that modal the the > link_to didn't worked for me. > > I had to change this > <%= link_to 'Show', "data-toggle" =>

Re: [Rails] Overriding association getters

2015-06-29 Thread Dave Aronson
On Monday, June 29, 2015, Мурыгин Антон wrote: > > class Business < ActiveRecord::Base > belongs_to :category, class_name: 'BusinessCategory', foreign_key: > 'business_category_id' > > def category > super || BusinessCategory.new(name: 'other') > end > end > > Why it keeps throwing > >

[Rails] Overriding association getters

2015-06-29 Thread Мурыгин Антон
Hi! I saw that i documentation here - http://api.rubyonrails.org/classes/ActiveRecord/Associations/ClassMethods.html > Overriding generated methods > > Association methods are generated in a module that is included into the > model class, which allows you to easily override with your own methods

Re: [Rails] Re: Send parameters while rendering partial (_show.html.erb, which contains modal) from index.html.erb

2015-06-29 Thread Padmahas Bn
Hello Elizabeth McGurty that worked!!! (with little modification) Unique id for each modal generated fine but when calling that modal the the link_to didn't worked for me. I had to change this <%= link_to 'Show', "data-toggle" => "modal", :class => 'btn btn-default', :id => designation_dict.dd_id

Re: [Rails] Help getting started

2015-06-29 Thread Colin Law
On 29 June 2015 at 02:35, Katrina Swales wrote: > Except even the one you linked pointed out, they WERE using the appropriate > version, no one answered there either. Having the same problem myself Don't understand your comment, the link I posted (http://stackoverflow.com/questions/15537191/why-