rails-admin

Rails: Wrong number of arguments (given 2, expected 1) MongoID

蓝咒 提交于 2020-03-23 12:01:50
问题 I'm trying to open my MongoDB models, however, I'm getting the following error: MONGODB | xxx.xx.x.xxx:27017 | db.find | FAILED | wrong number of arguments (given 2, expected 1) | 0.013306s My Mongo credentials are correct, and I can connect to the database's collections outside of Rails. The first few lines of the error are: Started GET "/admin/xsl_sheet" for xxx.xxx.xxx.xxx at 2020-03-03 13:49:54 UTC Processing by RailsAdmin::MainController#index as HTML Parameters: {"model_name"=>"xsl

serialize ActiveRecord::Coders::Hstore crashes RailsAdmin

霸气de小男生 提交于 2020-01-24 00:35:33
问题 As suggested in http://railscasts.com/episodes/345-hstore, I added: serialize :properties, ActiveRecord::Coders::Hstore to my model. This allows me to iterate over key / value pairs in the view (without it, I get a undefined method `each' for String error): <% @item.properties.try(:each) do |key, value| %> <%= key %>: <%= value %><br /> <% end %> I managed to get the hstore field in RailsAdmin working by explicitly declaring it as a text field: class Item < ActiveRecord::Base attr_accessible

rails_admin gem filter with has_many_through association

会有一股神秘感。 提交于 2020-01-17 08:30:49
问题 In my application Product has many categories though category_has_products Category has many products though category_has_products Initially I used at product.rb default_scope { includes(:brand, :categories) } and in rails_admin config set it as field :categories, :string do searchable [{Category => :name}] end This works like a charm. This got in to performance issue due to has_many_through(other pages using product details got affected) So I removed the default_scope from product. After

How can I display the name instead of an ID without the name column

点点圈 提交于 2020-01-17 08:20:13
问题 I have 3 tables, Activity, Activity_type and Itineraries. In activity type, I insert a new entry name => Testing => Example. In my activity, I can use the activity type I created earlier in my dropdown and type a location. In creating a new itinerary there's a dropdown activity and user(who created the new itinerary and choose what activity for the specific itinerary) but it only shows the activity #1 and user #1. In my list and i think this is the reason why it only display the Activity #1

Rails Admin: add javascript library to custom action

早过忘川 提交于 2020-01-15 15:31:02
问题 I'm building a custom action for rails admin that includes a custom view. I want to include a local copy of sparkline.js but I can't figure out a way to do this. I tried to add the sparkline.js to the /vendor/assets/javascripts/actions/action_name directory but it is not loaded by rails admin Is there any other way to get this file loaded 回答1: I did this by putting the external library into the app/assets/javascripts/rails_admin/custom directory and adding a 'require' statement to the rails

How to keep DRY with a ActiveAdmin or RailsAdmin, separate from the main application

戏子无情 提交于 2020-01-12 03:30:12
问题 I am building a JSON-only application, it is basically a leaner Rails, with fewer middleware and fewer modules. This is an application being built in Rails 4. I want to to develop a simple app that can administrate the data in the database for the main-app. For this I would like to use Active Admin or Rails Admin. But both options somehow use the underlying models and their validations, requirements and such to build on top of. This means that I need to share at least the models between the

Installed rails_admin and everything stops working

六月ゝ 毕业季﹏ 提交于 2020-01-03 19:42:29
问题 So i wanted to create an app, where people can view art. The problem is, only the admin should be able to create, edit and delete data. So i wanted to add an admin interface. I went with the rails_admin gem. I've installed everything as it said on the git documentation, but everything stopped working when I installed it. I can't generate scaffolds, models or controllers and I can't start my server. It gives me this message whenever I try something. /Users/Max/.rvm/gems/ruby-1.9.3-p194/gems

Routing Error for a model with a join_table and has_many :through in RailsAdmin

白昼怎懂夜的黑 提交于 2020-01-02 05:26:24
问题 So I have 3 models: category , product , category_products . This is my category.rb attr_accessible :name has_many :category_products do def with_products includes(:product) end end has_many :products, :through => :category_products This is my product.rb attr_accessible :name, :description, :price, :vendor_id, :image, :category_ids belongs_to :vendor has_many :category_products do def with_categories includes(:category) end end has_many :categories, :through => :category_products This is my

Rails Admin NoMethodError in RailsAdmin::Main#delete

老子叫甜甜 提交于 2019-12-25 08:48:42
问题 I have model Order: class Order < ActiveRecord::Base has_one :shipping_address has_and_belongs_to_many :books validates :first_name, :surename, :email, :street1, :country, :zipcode, presence: true validates_format_of :email, :with => /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i validates :zipcode, numericality: true accepts_nested_attributes_for :shipping_address end and model Book: class Book < ActiveRecord::Base DEFAULT_PRICE = 55.15 NEXT_BOOK_PERCENT = 5 has_and_belongs_to_many :pages has

Rails 3.1.1 deploy to Heroku failing

送分小仙女□ 提交于 2019-12-25 01:48:24
问题 After upgrading my Rails 3.0.9 app to 3.1.1, I'm getting the following bundler error when pushing to Heroku-cedar stack: -----> Heroku receiving push -----> Ruby/Rails app detected -----> Installing dependencies using Bundler version 1.1.rc Running: bundle install --without development:test --path vendor/bundle Updating git://github.com/sferik/rails_admin.git Fetching gem metadata from http://rubygems.org/........ Bundler could not find compatible versions for gem "rails": In Gemfile: rails