Re: [Rails] case study

2013-01-29 Thread oto iashvili
Hi, thanks for answer. My pb with polymorphic is that I would have to create first in db a ligne for ad_real_estate_details and then create my ad, what is non sense for me, in terms of logic. and it might brings some pb as I read there

Re: [Rails] case study

2013-01-29 Thread Jim Ruther Nill
On Tue, Jan 29, 2013 at 7:41 PM, oto iashvili optimum.dulo...@laposte.netwrote: Hi, thanks for answer. My pb with polymorphic is that I would have to create first in db a ligne for ad_real_estate_details and then create my ad, what is non sense for me, in terms of logic. and it might brings

[Rails] Capybara installed but not functioning correctly

2013-01-29 Thread Osifo Anosike
Hi, Please i need assistance. I installed capybara (as directed by the book i'm reading - rails 3 in action). According to the book, running rake cucumber:install should install web_steps.rb in ./ features/step)definitions, however when i ran it, but the file wasn't created. please did i get

[Rails] rails 3 - nested model - jquery file upload

2013-01-29 Thread Petr Bobek
I have a Post model which has_many :photos. While User creating a new post, user should be also able to select photos (multiple) for given post. I am using RAILS 3.2.9, nested_form, carrierwave and jquery-fileupload-rails gem and ryan bates

[Rails] Re: cancan breaks scoped mass assignment

2013-01-29 Thread joshua
I'm having that issue as well; I just told it to authorize_resource and left off the load_resource.. But somehow I don't think that's actually a fix, or even a secure way of handling things.. Almost a year since you posted this.. Did you figure it out? I wonder if this is a bug in CanCan On

[Rails] Re: Capybara installed but not functioning correctly

2013-01-29 Thread Frederick Cheung
On Tuesday, January 29, 2013 12:00:04 PM UTC, Osifo Anosike wrote: Hi, Please i need assistance. I installed capybara (as directed by the book i'm reading - rails 3 in action). According to the book, running rake cucumber:install should install web_steps.rb in ./

[Rails] Cucumber and Capybara not working as expected. Asssistance needed

2013-01-29 Thread Osifo Anosike
Please i need help. According to the book i'm studying on ruby-on-rails(rails 3 in action), i learnt that upon running rake cucumber:install, that cucumber would create a web_steps.rb file in /features/step_definitions, as well as a features/support/path.rb file. However i ran this and neither of

Re: [Rails] Cucumber and Capybara not working as expected. Asssistance needed

2013-01-29 Thread Colin Law
On 29 January 2013 15:02, Osifo Anosike li...@ruby-forum.com wrote: Please i need help. According to the book i'm studying on ruby-on-rails(rails 3 in action), i learnt that upon running rake cucumber:install, that cucumber would create a web_steps.rb file in /features/step_definitions, as

[Rails] Filter Index Page

2013-01-29 Thread Ryo Saeba
Hi, I'm new here and started working with rails only a month ago. I'm trying to develop a VideoGame Database that is supposed to contain many many entries. Here's my problem. Currently any new gameentry is listed in my index-page like this [code] % @games.each do |game| % tr td%=

Re: [Rails] Filter Index Page

2013-01-29 Thread Walter Lee Davis
On Jan 29, 2013, at 10:56 AM, Ryo Saeba wrote: Hi, I'm new here and started working with rails only a month ago. I'm trying to develop a VideoGame Database that is supposed to contain many many entries. Here's my problem. Currently any new gameentry is listed in my index-page like this

[Rails] Count entries in postgresql grouped by date

2013-01-29 Thread Linus Pettersson
Hi! I have a table with visits with a visited_at: attribute which is a datetime field. They seem to be stored as UTC. Now I want to count all visits each day and return something like: { 2013-01-01: 8, 2013-01-02: 4, 2013-01-07: 9, ... } So, I did it like this which kind of works...:

[Rails] Re: Count entries in postgresql grouped by date

2013-01-29 Thread Linus Pettersson
I'll just don't do the group and count in the database for now. I do it like this instead: def self.total_grouped_by_day(start_date, end_date) visits = where(visited_at: start_date..end_date) visits = visits.order(visited_at ASC) visits.group_by { |v| v.visited_at.to_date } end

[Rails] Re: Filter Index Page

2013-01-29 Thread Ryo Saeba
Thanks for responding? I watched a Kaminari Tutorial video on railscast and like what it does, I sure will use it too when I want my search results to be displayed in small pieces, but it is actually not what I was looking for. I'm not trying to have my results seperated in pages, but I want

Re: [Rails] Filter Index Page

2013-01-29 Thread Walter Lee Davis
Okay, then you should set that up in your index method. Decide what you do want to show (maybe a partial with How to Search instructions) and show that instead of ModelName.all. def index if(params[:q]) #do your search thing else render :partial = 'search/instructions' end end

[Rails] Re: Filter Index Page

2013-01-29 Thread Rolando Garro
def self.search(params) self.where(params['search']).page(params[:page]) end On Tuesday, January 29, 2013 9:56:54 AM UTC-6, Ruby-Forum.com User wrote: Hi, I'm new here and started working with rails only a month ago. I'm trying to develop a VideoGame Database that is supposed to contain

[Rails] Re: Filter Index Page

2013-01-29 Thread Ryo Saeba
I tried Walters suggestion and put my display-table in a partial; this is what the method looked like def index if(params[:q]) @games = Game.search(params[:search]) else render :partial = 'search_results' end end But it would cause me a NoMethod Error... it says that the each

Re: [Rails] Re: Filter Index Page

2013-01-29 Thread Walter Lee Davis
On Jan 29, 2013, at 1:58 PM, Ryo Saeba wrote: I tried Walters suggestion and put my display-table in a partial; this is what the method looked like def index if(params[:q]) @games = Game.search(params[:search]) else render :partial = 'search_results' end end But it would

[Rails] Rails server not starting

2013-01-29 Thread Tristin G.
Hello, Im currently having troubles getting my rails server to start. I was working on it fine yesterday, but now it seems like it isn't working at all. These are the errors i get when i try and start the server up, C:\Users\Tristin\treebookrails server C:/Program Files

Re: [Rails] Rails server not starting

2013-01-29 Thread Tom Meinlschmidt
Aren't you using rvm? is your rails installed? try gem list rails and check result, it should print something like gem list rails *** LOCAL GEMS *** rails (3.0.0, 2.3.8, 2.3.2, 2.2.2) if not, do gem install rails tom On Jan 29, 2013, at 20:56 , Tristin G. li...@ruby-forum.com wrote:

[Rails] Re: Rails server not starting

2013-01-29 Thread Tristin G.
Okay this is what happened after typing the above, C:\Users\Tristin\treebookgem list rails *** LOCAL GEMS *** C:\Users\Tristin\treebookgem install rails ERROR: While executing gem ... (Errno::EACCES) Permission denied - C:/Program Files (x86)/ruby-1.9.2/lib/ruby/gems/1.9.1/ge

[Rails] Re: Pass data to javascript

2013-01-29 Thread Robert Walker
Linus Pettersson wrote in post #1093722: I created a class method in my model that fetches all records, groups by date and count the occurrences. This method is called by a helper method from my view. The helper method loops over the date range and checks the number of occurrences for that

[Rails] Re: Pass data to javascript

2013-01-29 Thread Robert Walker
Robert Walker wrote in post #1094237: What are the benefits/drawbacks of the different approaches? Generally speaking try to avoid pre-mature optimization. 1. Go with the simplest solution that could possibly work. 2. Gather some metrics. 3. Try a different approach that you think might