ruby-on-rails-3

ruby on rails server command

旧街凉风 提交于 2019-12-25 02:31:54
问题 I've started to learn ruby on rails , I've got a problem with server, in the tutorial when they use "rails server" it shows port number and some other information about server, but when I use "rails server" in windows , it shows me the options of "rails" command have any ideas where's the problem? thanks 回答1: Before start the rails server, you have to create your project rails new projectname and then you have to go your project's folder and try to start server cd projectname/ rails server 来源

Stack level too deep trying to update from 3.0 to 3.1

为君一笑 提交于 2019-12-25 02:28:45
问题 I'm getting this error while trying to run 'rails s' after upgrading update from rails 3.0.10 to 3.1.0 ~/.rvm/gems/ruby-2.0.0-p353/gems/rack-1.3.10/lib/rack/builder.rb:40: stack level too deep (SystemStackError) Has anyone else run into this and solved the problem? Google search yields nothing except that it might involve gem dependencies. 来源: https://stackoverflow.com/questions/20725283/stack-level-too-deep-trying-to-update-from-3-0-to-3-1

With the route generated by the Vanity gem, what is the Rails route helper I can use?

久未见 提交于 2019-12-25 02:25:41
问题 This is the route the Vanity gem generates: controller :vanities do match ':vname' => :show, :via => :get, :constraints => {:vname => /[A-Za-z0-9\-\+]+/} end This is the rake routes: GET /:vname(.:format) {:vname=>/[A-Za-z0-9\-\+]+/, :controller=>"vanities", :action=>"show"} How do I use the Rails link helper to link directly to URL mydomain.com/vname ? 回答1: From the top of my head (sorry, I don't really have the time to test it right now): controller :vanities do match ':vname' => :show,

Rails 3.2 jQuery sortable list 500 error with nested resources

拥有回忆 提交于 2019-12-25 02:24:18
问题 Following the Railscasts episode about sortable lists (http://railscasts.com/episodes/147-sortable-lists-revised?view=asciicast), I've got everything in place, however instead of doing sorting on the model whose #show action is displaying the list, it's a nested model. My site is for managing a very complex fantasy football league. One of the aspects of the league is that GMs have a yearly salary cap amount, players have a value, and players can be signed to multi-year contracts. Anyway, I'm

Rake error: 'rake' is not recognized

百般思念 提交于 2019-12-25 02:24:06
问题 When I write: rake db:migrate I get this error: C: \ Rails \ myapp> rake db: migrate 'rake' is not recognized as an internal or external command, a program or batch file. I am using rails v. 3.0.9 and gem 'rake', '0.8.7' 回答1: Make sure rake is in your path. 回答2: As tob and Brian noted this kind of problem is commonly caused by PATH issues. Basically your PATH tells your computer where to find the commands you want to execute. Try following the steps here making sure that you have an entry for

How to open new page without refresh

时光怂恿深爱的人放手 提交于 2019-12-25 02:23:13
问题 I am using a rails application, in which I am trying to open a new page, all the static page, https://www.mazzey.com/ is the link, if you click on the header buttons, it opens new page with fade in and fade out effect with the header and footer without refreshing in Mozilla Firefox but in Google Chrome the header also refreshes. I also found that that header and footer refreshes in Firefox as well but it does not that unlike Google Chrome. So can I use to Ajax or any plugin to do that to

Javascript is not working in rails app

不想你离开。 提交于 2019-12-25 02:22:58
问题 I have this code in my store.html.erb file <%= link_to t('.add_html'), 'javascript:void(0);', :class => "line-item", :product => product.id %> <script type="text/javascript"> $('document').ready(function(){ $(".line-item").click(function(){ var prod = $(this).attr('product'); $.ajax({ url:'<%= line_items_url %>', data: {product_id: prod}, type: 'POST', dataType: 'script' }); }); }); </script> my line_items_controller.rb has this code def create @cart = current_cart product = Product.find

jQuery validate date field for seperate year, month, date

谁都会走 提交于 2019-12-25 02:22:57
问题 I have 3 separate fields separatly for from and two date. Year, month, Date have the drop down lists for the options to select. I would like to validate the form so that To > From . How can I implement it?? From Year: Month: Date: To Year: Month: Date: 回答1: You can get value from that 6 fields and arrange them shown below: date_from=new Date('FROM_YEAR','FROM_MONTH','FROM_DAY'); date_from = date_from.getTime(); date_to=new Date('TO_YEAR','TO_MONTH','TO_DAY'); date_to = date_to.getTime(); if

autogenerate paths in rails 3?

你。 提交于 2019-12-25 02:21:15
问题 From the looks of some railscasts (this one in particular), it seems like there is some autogeneration of "*_path" variables that not happening for me. in this rails cast, the edit_mutliple_products_path seems to be generated automagically (i don't normally like using that word). When I follow through the same steps and try to access a similar path, i get this: undefined local variable or method `edit_multiple_distributions_workflows_path' for #<#<Class:0x132b18a68>:0x132af3290> 回答1: This is

Nested attributes for one-to-one relation

≡放荡痞女 提交于 2019-12-25 02:18:51
问题 I have a Company which has one Subscription. Now I want a form to add or edit the company and the subscription, so I use "accepts_nested_attributes_for". This is (part of) the Company model: has_one :subscription, :dependent => :destroy accepts_nested_attributes_for :subscription This is (part of) the Subscription model: belongs_to :company In the controller I have this: def new @company = Company.new(:subscription => [Subscription.new]) end def create @company = Company.new(params[:company])