ruby-on-rails-3.2

rails callbacks not getting executed

半城伤御伤魂 提交于 2019-12-06 04:13:25
问题 For my life I trying to find out why are my callbacks are not getting executed sometimes (you heard it right sometimes as most of time it works out of the box) All I have is parent/child relations between 2 models upon creation of child record all I'm doing in after_create callback is update(accumulate all child amount in parent field to avoid heavy query at run time) the amount field in parent table/ model record Parent model( Payout ) Child model is ( Sales Transaction ) Payout has_many

undefined method `key?' for nil:NilClass

半城伤御伤魂 提交于 2019-12-06 04:03:06
问题 I'm new to Rails and was following Ryan Bate's tutorial on how to make a simple authentication system (http://railscasts.com/episodes/250-authentication-from-scratch?autoplay=true) and I was just going through it but got this error: ` NoMethodError in UsersController#new undefined method `key?' for nil:NilClass Rails.root: C:/Sites/authentication` I don't really know what this means since I'm just a beginner, but these are my files: users controller: class UsersController <

PrivatePub is not defined error Rails 3.2 private pub

那年仲夏 提交于 2019-12-06 03:57:46
问题 I want to use private pub gem in my rails application. I implement with railscast 316 After rails g private_pub:install my private_pub.yml file: development: server: "http://0.0.0.0:9292/faye" secret_token: "secret" test: server: "http://0.0.0.0:9292/faye" secret_token: "secret" production: server: "http://0.0.0.0/faye" secret_token: "98ec77eb7077c9899dc53f003abc4d6a0170512a57feab126ed5a32b114e3613" signature_expiration: 3600 # one hour my private_pub.ru file # Run with: rackup private_pub.ru

HABTM checkbox in a nested form

眉间皱痕 提交于 2019-12-06 03:56:01
问题 I am trying to implement a HABTM checkbox in a nested form. Currently, I have 3 models. Subject, lesson and groups. The associations are as follows: Each subject has many lessons. Each lesson has and belongs to many groups. Right now, I am trying to implement them all on a single creation and edit form. Such that a lesson is nested in the subject and for each lesson there is a list of group check boxes to implement the HABTM relationship. I am facing trouble implementing the HABTM

Devise render sign => up/in form partials elsewhere in code

邮差的信 提交于 2019-12-06 03:52:22
问题 I'm just starting with Devise and Rails3. I have the Authenetication down and working and understand the basics. As of now in my Home Controller that represents my Home/Front Page i have two links one that links to Register => sign_up and one that changes depending on login/logout => sign_in/sign_out. However i dont want to redirect my user to login page. Instead i want to display my login form on my front page. So i have seperated the devise/session/new template int to a view and a _form

Helper methods to be used in Controllers AND Views in Rails

久未见 提交于 2019-12-06 03:50:51
I understand I can put a helper method in a Helper class inside the helper folder in Rails. Then that method can be used in any view. And I understand I can put methods in the ApplicationController class and that method can be used in any controller. Where's the proper place to put a method that is frequently used in both controllers and views? You can put it in the controller and call: helper_method :my_method from the controller. You can put a method in a controller and then call helper_method in the controller to indicate that this method is available as if it were in a helper too. For

migrate error: undefined method `cache' for Gem:Module

孤者浪人 提交于 2019-12-06 03:38:09
while migrating by rails app am getting this error undefined method `cache' for Gem:Module Am using Rails 3.2.9 Ruby 1.8.7 Ubuntu 12.04 rake db:migrate --trace /home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/object.rb:138: warning: method redefined; discarding old try_dup /home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/symbol.rb:3: warning: method redefined; discarding old try_dup /home/rajendran/.rvm/gems/ruby-1.8.7-p374/gems/extlib-0.9.15/lib/extlib/time.rb:41: warning: method redefined; discarding old to_datetime /home/rajendran/.rvm/gems/ruby

Rails Blog engine [closed]

一笑奈何 提交于 2019-12-06 03:37:28
Looking for a simple blog engine that will support article management. I have standalone rails3.2x application and authentication system and I have to add blogging engine for site registered users. megas Check out ruby-toolbox , here you can find appropriate tool for your goals. Blog engines are here Just discovered this: https://github.com/jipiboily/monologue . Simple blogging engine with few dependencies, which makes it easy to integrate into existing Rails application. 来源: https://stackoverflow.com/questions/14374399/rails-blog-engine

Strong parameters and multidimensional arrays

馋奶兔 提交于 2019-12-06 00:34:14
问题 I'm using Rails 3.2.6 with strong parameters gem. So, I' have a controller with the typical update action: # PUT /api/resources/:id def update @resource.update_attributes! permited_params respond_with_json @resource, action: :show end Then, I have the permited_params method def permited_params params.permit(:attr1, :attr2, :attr3) end The problem is that :attr3 is a multidimensional array like this: [[1, 2], [2, 5, 7]] Following the documentation, I need to specify :attr3 as an array. But...

Editing RefineryCMS 2.1 Menu Presenter to manipulate dom_id css and other attributes

北慕城南 提交于 2019-12-06 00:24:45
I am currently trying to update an existing RefineryCMS app from gem version so I can be up to date add bootstrap 3 at the same time. gem "refinerycms", "~> 2.0.10" to gem "refinerycms", "~> 2.1.0" After removing outdated blocks and deleting a couple overridden views from the site's past I have got the site successfully functioning again with its current database's content. Now that Refinery has switched over to the Menu Presenter in exchange of the old partials. How can I add, remove and edit the classes of all elements within the new Menu Presenter system? I would like to have control of the