EzDevInfo.com

typus

Ruby on Rails control panel to allow trusted users edit structured content. Typus User Guide — Typus 4.0.0.beta documentation

Typus route order

It used to be that you could load Typus routes exactly where you needed them by placing

  Typus::Routes.draw(map)

at the appropriate point in your routes.rb file. It seems that this is no longer supported and that they're always loaded after all of the application routes. This causes problems with catchall routes which must be defined last. Does anyone know how to control the load order for typus now? Is there a way to get them defined before any of the app routes rather than after? Thanks!


Source: (StackOverflow)

Typus: Using another attribute that is not foreign key in edit form to set object

I've been using Typus for my rails application. I have the following models:

model List
  has_many :ListItems

  # attributes
  id   : integer
  another_id: integer

model ListItem
  belongs_to :List

When editing a ListItem, I want to be able to specify the another_id to designate the list, but it seems like you can only use id. another_id is unique to each record. Is there a way to change that? I've taken a look at the documentation and it's not very thorough.

Thanks in advance!


Source: (StackOverflow)

Advertisements

How to change admin route prefix for typus on rails3.1?

I want to change admin route path for typus on rails3.1.

[Before] localhost:3000/admin

[After] localhost:3000/example

3-1-unstable version implemented?

https://github.com/typus/typus/issues/120#issuecomment-651711

How to coding? route.rb? mountable?

Thanks.


Source: (StackOverflow)

Devise, validate current_password if any important fields have been changed

Specifically, I'm using Devise with Typus. But, I think my misunderstanding resides in my knowledge of Devise.

I'm trying to achieve the functionality of when you want to change an important model via form, you have to provide your current password to confirm you can change it, a la google.

Right now, I can log in and change any of the fields of my User model. Including the password, without having to confirm my password prior. Not good. So, I've added current_password to the form. But that didn't do anything. Then I tried to validate presence on current_password. Then it doesn't seem to accept any value for it.

Google didn't help me. All of the relevant posts were about removing current_password instead of confirming it. Which makes me think I'm misunderstanding the use of current_password.

Anyone care to share some insight? Thanks.


Source: (StackOverflow)

Using Typus with a subdomain

I'm trying to use the Typus Rails Admin with a subdomain for a project. After installing Typus, and setting config.subdomain = "admin", I noticed that the Typus-related routes get processed after the normal project routes.

When I visit admin.mysite.com, it goes to my main controller instead of Typus. I have to go to admin.mysite.com/dashboard. This is because the main application routes have higher priority over the Typus routes.

What I'd like is to have all routes with the admin subdomain processed by Typus, before processing the rest of the application routes. Is this possible with the Typus routing system?


Source: (StackOverflow)

Get error for undefined local variable or method `scopes' on rails with Typus gem

Is there any one have used typus gem with rails ? I have used this for manage my admin panel and it works really fine on my development machine, when i deploy this on server then i suddenly get error as below

undefined local variable or method 'scopes' for <#<Class:0x00000002f31630>:0x00000002d42608>

Any idea ?


Source: (StackOverflow)

rails typus routing error when creating user

i installed typus for a small rails application and i want to setup auth via mysql database and I followed the steps on the typus wiki sites. Everything works fine, but when I want to login to admin: localhost:3000/admin I have to enter an e-mail address and then I'll be routed to: http://localhost:3000/admin/account/new but I get a routing error. In my routes.rb config file I have only this line enabled: match ':controller(/:action(/:id(.:format)))'

I couldn't find any help. Thanks for any advice!


Source: (StackOverflow)

Typus with existing devise model getting 401 unauthorized error

I'm new to Ruby on Rails and I have a problem configuring typus with devise.

I have an Rails REST app (built using rails_api) and it uses devise to do the authentication stuff. Currently I'm working on a new Rails app that supposed to be the admin pages of the REST app using typus. Ultimately, my aim is to have this admin app access the same database as the REST app that have been built before while using the existing devise model of the REST app. However, I keep getting 401 Unathorized message even though the user exists in the database.

To be precise, I have a devise model, Account, in the REST app and I want to use this particular devise model as the devise model in my admin app. I copied the model Account (alongside other models) from the REST app to the new admin app, then, I followed this to configure typus to use devise for authentication but without generating a new devise model:

rails generate devise:install
rails generate typus

# config/initializers/typus.rb
Typus.setup do |config|
  config.authentication = :devise
  config.user_class_name = "Account"
end

# edit the devise model: Account
require 'typus/orm/active_record/instance_methods'
class Account < ActiveRecord::Base
  devise :database_authenticatable, :registerable,
     :recoverable, :rememberable, :trackable, :validatable,
     :omniauthable, :confirmable

  include Typus::Orm::ActiveRecord::InstanceMethods

  def locale
    ::I18n.locale
  end

  def role
    Typus.master_role
  end
end

# routes.rb
Rails.application.routes.draw do
  devise_for :accounts
end

# initializers/devise.rb
# make secret_key the same with REST app's secret_key
config.secret_key = 'identic-secret-key-with-rest-app'

When I run the server and tried to sign in using the existing user in the database (user from the REST app) it always keep saying 401 Unauthorized in the server console. Is there anything that I missed in my configuration? or even my approach is doable?

It worked well if I generate a new devise model for the admin app.


Source: (StackOverflow)

Typus static assets fail to load on Engine Yard cloud

In development, the typus gem seems to link its app/assets/vendor/ to /public/vendor to load assets (css and javascript) from the gem and this works fine for me. I just deployed my code to Engine Yard Cloud and now Typus cannot find any of its assets:

Failed to load resource: the server responded with a status of 404 (Not Found) https://staging.app.com/vendor/typus/vendor/jquery-ui-1.8.12.custom/css/ui-lightness/jquery-ui-1.8.12.custom.css Failed to load resource: the server responded with a status of 404 (Not Found) https://staging.app.com/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.cssFailed to load resource: the server responded with a status of 404 (Not Found) https://staging.app.com/vendor/typus/vendor/jquery-tokeninput/css/token-input.cssFailed to load resource: the server responded with a status of 404 (Not Found) https://staging.app.com/vendor/typus/vendor/jquery.fancybox-1.3.4/fancybox/jquery.fancybox-1.3.4.pack.js

etc, etc. I know Engine Yard stores bundled gems slightly differently than my development machine but everything else seems to work fine. Does anyone know if this is an EY problem or a Typus problem, and how I might fix it? I am using Rails 3.0.11, typus 3.012, and ruby 1.9.2-p290.

EDIT: I have worked around the solution by creating a symlink: ln -s /data/AppName/shared/bundled_gems/ruby/1.9.1/gems/typus-3.0.12/app/assets/vendor/typus/ /data/AppName/current/public/vendor/typus but this is just a band-aid and not a long term fix, so I still appreciate feedback.


Source: (StackOverflow)

Typus and Rails 3.1 - missing constant AdminsController

Gemfile:

gem 'rails', '3.1.0.rc4'
gem 'typus', :git => 'http://github.com/typus/typus', :branch => '3-1-unstable'

Obviously the name of the Git-branch suggests that it's error prone, but I think I might be missing something simple here. According to the documentation rails g typus and rails g typus:migration should be enough to get going.

My problem is that I'm missing the AdminsController, after migrating and navigating to 0.0.0.0:3000 I get greeted by

uninitialized constant AdminsController

and there is no AdminsController.rb in app/controllers. Is this a bug in the 3.1 branch or am I missing something in the documentation?


Source: (StackOverflow)