ruby-on-rails-plugins

Filter chain halted as [:login_required] rendered_or_redirected

我是研究僧i 提交于 2019-12-04 18:11:34
问题 Hopefully I can explain this well enough, but please let me know if more information is needed! I'm building a form where a user can create an "incident". This incident has the following relationships: belongs_to: customer (customer has_many incidents) belongs_to: user (user has_many incidents) has_one: incident_status (incident_status belongs to incident) The form allows the user to assign the incident to a user (select form) and then select an incident status. The incident is nested in

Server won't start on using authlogic-oauth2

纵然是瞬间 提交于 2019-12-04 16:58:55
I have included oauth2 and authlogic-oauth2 in the gemfile as I want to use them and am trying to start the server. It doesn't start and gives me the error: /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails.rb:44:in `configuration': undefined method `config' for nil:NilClass (NoMethodError) from /Library/Ruby/Gems/1.8/gems/authlogic_oauth2-1.1.2/lib/authlogic_oauth2.rb:14 from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib/bundler/runtime.rb:64:in `require' from /Library/Ruby/Gems/1.8/gems/bundler-1.0.7/lib

Warning while installing the rails plugin

好久不见. 提交于 2019-12-04 16:35:49
问题 I am getting the following warning while installing any plugin in my rails application. /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.5/lib/active_support/core_ext/kernel/agnostics.rb:7: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777 Can someone please tell me how to solve this problem? Thanks 回答1: Ruby (on all Unixes, including Cygwin) warns if you try to run an external program and your $PATH contains a world-writable directory. It doesn't just check the

Heroku Gem doesn't work after installing it

柔情痞子 提交于 2019-12-04 16:20:10
I am trying to get heroku running on Ubuntu 9.10 I typed sudo gem install heroku and everything works fine but then when I go to run: heroku list I get heroku: command not found run gem enviroment and look where is the EXECUTABLE DIRECTORY and add it to your PATH In my case: $ gem environment RubyGems Environment: - RUBYGEMS VERSION: 1.3.5 - RUBY VERSION: 1.8.7 (2009-06-12 patchlevel 174) [i486-linux] - INSTALLATION DIRECTORY: /var/lib/gems/1.8 - RUBY EXECUTABLE: /usr/bin/ruby1.8 - EXECUTABLE DIRECTORY: /var/lib/gems/1.8/bin - RUBYGEMS PLATFORMS: - ruby - x86-linux - GEM PATHS: - /var/lib/gems

Multiple Paperclip default_urls

大城市里の小女人 提交于 2019-12-04 15:58:05
问题 I am using Paperclip to upload an image to my Project model and I want to have an array of default images (not depending on the style, but different images) is that posible? To pass an array instead of just one URL to the :default_url option? Thank you, Nicolás Hock Isaza 回答1: So close: If you want the images to change randomly, and not just on first load of the model: :default_url => lambda { "path/to/images/#{rand(5)}.jpg" } 回答2: Putting rand(5) in the default_url proc will assign a random

Rails Dynamic Role-Based Authorization plugin?

血红的双手。 提交于 2019-12-04 15:49:05
There are a lot of role-based authorization plugins out there. They work great when you know in advance what the roles are going to be. For example, if I know I'm going to have administrators, super_users, and not_so_super_users. What I really want is to be able to create custom roles and assign that role to a user. At this point, I am simply wanting to block access to controllers / actions based on a user's custom role. Roles will consist of permissions. For example, Jane Doe can add and view widgets, but she can't delete or edit them. John Doe can add, view, and edit. The Boss can add, view,

Dependency included in gemspec not added to asset pipeline in rails engine

白昼怎懂夜的黑 提交于 2019-12-04 15:48:25
问题 I'm writing a rails engine that has some dependencies. I've specified the dependencies in the gemspec and the engine is finding them when I run bundle install (i.e. Gemfile.lock looks correct). When I want to use the plugin in a Ruby file, I can do so but need to explicitly require dependency-name at the top of the file. However, when I want to use the dependency's asset pipeline, sprockets can't find it. The app I'm using (for now) is the dummy app that comes in a rails plugin's test folder.

can you pass self to lambda in rails?

霸气de小男生 提交于 2019-12-04 15:46:51
I want to define a class method that has access to a local variable. So this would be different for each instance of the class. I know you can make a class method dynamic with lambda like when you use it with named_scope. But can this be done for values that are specific to an instance? In detail it is the has_attached_file method for the paperclip plugin in rails. I want to pass a lambda for the styles hash so that the image styles can be based off of attributes of the object stored in the DB. Is this possible? Disclaimer: First, the question ( Can you pass self to lambda? ) and the problem

How can I export a rails model to json schema?

六眼飞鱼酱① 提交于 2019-12-04 14:01:24
问题 I am looking to optimize how we build forms for some of our models and ideally I would like to build them from json-schema. Is there a gem or the like which would allow me to export a model definition to json-schema? Bonus: With validations. Bonus: While modelling association relationships. 回答1: Formtastic: http://github.com/justinfrench/formtastic has a mechanism for building forms from the models. Maybe you could base your code on theirs. Check in lib/formtastic.rb line 474 or so. Railscast

How to override Rails app routes from an engine?

孤街醉人 提交于 2019-12-04 08:30:01
I have a Rails app that I am trying to integrate a Rails engine in to. The host app has some catch all routes: # magic urls match '/' => 'admin/rendering#show' match '*path/edit' => 'admin/rendering#show', :defaults => { :editing => true } match '*path' => 'admin/rendering#show' It looks like the engine routes are loaded after the application catches all routes. /sitemap.xml(.:format) {:format=>"xml", :controller=>"admin/sitemaps", :action=>"show"} /(.:format) {:controller=>"admin/rendering", :action=>"show"} /*path/edit(.:format) {:controller=>"admin/rendering", :action=>"show"} /*path {