Note that there are some explanatory texts on larger screens.

plurals
  1. POHelper column override in ruby-on-rails
    primarykey
    data
    text
    <p>I have ruby-on-rails app with activescaffold to build GUI based on database structure. Users have roles, each role is a set of rights. Each right is a combination of controller and action which user is permitted to perform in this controller or not.</p> <pre><code># DATABASE! create_table :rights do |t| t.column :controller, :string, :limit =&gt; 32, :null =&gt; false t.column :action, :string, :limit =&gt; 32, :null =&gt; false end create_table :rights_roles, :id =&gt; false do |t| t.column :right_id, :integer t.column :role_id, :integer end create_table :roles do |t| t.column :name, :string, :limit =&gt; 32, :null =&gt; false end #MODELS! class Role &lt; ActiveRecord::Base has_and_belongs_to_many :rights class Right &lt; ActiveRecord::Base has_and_belongs_to_many :roles # ROLE CONTROLLER! class RoleController &lt; ApplicationController active_scaffold :role do |config| config.columns = Array[:name, :rights] config.columns[:rights].form_ui = :select </code></pre> <p>I currently have following edit window for roles which is inconvenient (options are not structured. There will be much more actions, so it would be dreadful):</p> <p><a href="http://postimage.org/image/4e8ukk2px/" rel="nofollow">http://postimage.org/image/4e8ukk2px/</a></p> <p>I want to create a helper method like this:</p> <pre><code>module RoleHelper def rights_form_column (record, input_name) ... end end </code></pre> <p>This is needed to define the form which will specify input method for "rights" column. But I don't know how to write it. Desirable form would be following:</p> <pre><code> administration action1(checkbox) action2(checkbox) configuration action1(checkbox) ... </code></pre> <p>I know that activescaffold is old, but I have to use it... Please help!</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload