[Rails] Re: Newbie Rails developer, can't get my database back to how it was before

2014-02-01 Thread Frederick Cheung
On Sunday, February 2, 2014 2:41:48 AM UTC, Bizt wrote: > > Is this normal? I don't know where it's getting the schema from but it can't > be reading only from my db:migrate files. Does it get them from log files > when recreating the db, or does it look directly at the db and rebuild. I > wan

[Rails] Best practise for setting default URL parameters in the controller

2014-02-01 Thread Bizt
I've been trying to set default URL parameters in the controller, which will also be used within the view. This is what I've got: @params = params defaults = { :date_from => '21/1/21014', :date_to => '21/2/21014', :data=>"Expense" } if @params.any? @params = defaults.merge(@params) else @pa

Re: [Rails] removed show method from controller yet show page is still present. why?

2014-02-01 Thread Hassan Schroeder
On Sat, Feb 1, 2014 at 6:30 PM, Bizt wrote: > In the documentation it seems I can specify which methods I want to allow: > > resources :accounts, only: [:index, :new, :create, :edit, :update, :destroy] > # no show > > is this the correct/ best way to restrict access? You can also use resource

[Rails] Newbie Rails developer, can't get my database back to how it was before

2014-02-01 Thread Bizt
Hi, I accidentally created a model with "rails generate model Category" (also creating migrate file) where I didn't specify any fields. Then I run rake db:migrate to create the new table. Upon realising what I'd done, I run "rails destroy model Category". Then I run "rails generate model Catego

Re: [Rails] removed show method from controller yet show page is still present. why?

2014-02-01 Thread Bizt
Yes, it must be in routes. I forgot. In config/routes.rb it seems to be handle with: resources :accounts In the documentation it seems I can specify which methods I want to allow: resources :accounts, only: [:index, :new, :create, :edit, :update, :destroy]# no show is this the correct/ best w

Re: [Rails] removed show method from controller yet show page is still present. why?

2014-02-01 Thread Hassan Schroeder
On Sat, Feb 1, 2014 at 5:18 PM, Bizt wrote: > I used "rails generate scaffold ..." to build my model, views and > controllers. However for this particular MVC I don't want to have a show > template. So, I removed the show method from the controller. But, show still > appears. Why is this. What do

[Rails] removed show method from controller yet show page is still present. why?

2014-02-01 Thread Bizt
I used "rails generate scaffold ..." to build my model, views and controllers. However for this particular MVC I don't want to have a show template. So, I removed the show method from the controller. But, show still appears. Why is this. Does ApplicationController have a show method? Is the onl

Re: [Rails] Re: Run "generator destroy", now git is telling me I have missing files. How do I best deal with this?

2014-02-01 Thread Bizt
Thank you. Sorry I didn't see -u there before, I see it now. Great On Saturday, 1 February 2014 18:31:21 UTC+9, Colin Law wrote: > > On 1 February 2014 00:06, Bizt > wrote: > > Thanks for your reply. Can you tell me what "git add -u" does, I can't > find > > documentation for that specific opt

Re: [Rails] Re: Problem with my associations Users -> Accounts -> Transactions

2014-02-01 Thread Bizt
> > Consider, though, that if for whatever reason an invalid id is passed > in, @account will be nil and so @account.transactions will give you > a NoMethod error. > > What do you want to happen at that point? > > Good point. Thanks, I'll put some checking to see if account is valid or not a

Re: [Rails] Can two Rails versions use one database?

2014-02-01 Thread Timothy Mukaibo
Just found this site too: http://www.rails-upgrade-checklist.com/ That could be invaluable! Thank you Jesse Wolgamott! On 2 February 2014 10:51, Timothy Mukaibo wrote: > The approach you have mentioned sounds incredibly risky, and a debugging / > support nightmare! Assuming you have good tests

Re: [Rails] Can two Rails versions use one database?

2014-02-01 Thread Timothy Mukaibo
The approach you have mentioned sounds incredibly risky, and a debugging / support nightmare! Assuming you have good tests in place, I think you're better off to upgrade from 1 -> 2, 2 -> 3 and then 3 -> 4. Start by reading the release notes and the upgrade instructions from each of the major rele

Re: [Rails] How can I customize this render json output?

2014-02-01 Thread Walter Lee Davis
On Feb 1, 2014, at 2:35 PM, Frederick Cheung wrote: > > > On Thursday, January 30, 2014 9:49:41 PM UTC, Ruby-Forum.com User wrote: > > [{"id":2, "name":"foo"}, {"id":3, "name":"bar"... > > no root elements. Using the active record serializers I've gotten some > flexibility in specifying th

[Rails] Re: How can I customize this render json output?

2014-02-01 Thread Frederick Cheung
On Thursday, January 30, 2014 9:49:41 PM UTC, Ruby-Forum.com User wrote: > > > [{"id":2, "name":"foo"}, {"id":3, "name":"bar"... > > no root elements. Using the active record serializers I've gotten some > flexibility in specifying the root element, but now I either end up with > the above (n

Re: [Rails] Re: Problem with my associations Users -> Accounts -> Transactions

2014-02-01 Thread Hassan Schroeder
On Fri, Jan 31, 2014 at 9:47 PM, Bizt wrote: > def index > @account = current_user.accounts.find_by_id(params[:account]) > @transactions = @account.transactions; > end > > .. works fine Consider, though, that if for whatever reason an invalid id is passed in, @account will be nil and so @acc

[Rails] Re: twitter-bootstrap-rails Gem adds a LOT of .js files to the page, doesn't it?

2014-02-01 Thread Frederick Cheung
On Saturday, February 1, 2014 6:33:07 AM UTC, Bizt wrote: > > Oh, I think I see. In production ONLY it condenses them all down to a > single file? Just realized now. > That is the default. If my memory is correct it's the config.assets.debug setting which controls this. Fred -- You receive

Re: [Rails] Re: Problem with my associations Users -> Accounts -> Transactions

2014-02-01 Thread Colin Law
On 1 February 2014 05:47, Bizt wrote: > Actually I've changed the whole thing to: > > def index > > @account = current_user.accounts.find_by_id(params[:account]) > @transactions = @account.transactions; > end > @account = Account.find(params[:account]) should also work. A possible disadvanta

Re: [Rails] Re: Run "generator destroy", now git is telling me I have missing files. How do I best deal with this?

2014-02-01 Thread Colin Law
On 1 February 2014 00:06, Bizt wrote: > Thanks for your reply. Can you tell me what "git add -u" does, I can't find > documentation for that specific option. Thanks https://www.kernel.org/pub/software/scm/git/docs/git-add.html -- You received this message because you are subscribed to the Googl