I''m fairly new to RoR so go easy on me. I''ve worked through
the depot
application and now I''m just trying to do some hacking so I can
understand it all a little more.
First question: I want to add a column to my database schema. Do I have
to reinstantiate the scaffold ( $> ruby script/generate scaffold Admin
) in order to have the fields show up on the site? I''m trying to add an
address column.
Second question: In an authenticate method, I want to view only admins
who have not been activated. This is not part of the depot application.
I created a scaffold of Admin which has a column in the admins table
that is either set to 1 or 0. 1 means active, 0 means inactive. I want
to be able to use the authorize.rhtml to view only admins who have
active = 0. Where do I do that?
here is the code for reference (it''s the list.rhtml code from a
scaffold generation):
<%
for admin in @admins %>
<tr>
<% for column in Admin.content_columns %>
<td><%=h admin.send(column.name) %></td>
<% end %>
<td><%= link_to ''Show'', :action =>
''show'', :id => admin %></td>
<td><%= link_to ''Edit'', :action =>
''edit'', :id => admin %></td>
<td><%= link_to ''Destroy'', { :action =>
''destroy'', :id => admin },
:confirm => ''Are you sure?'', :post => true
%></td>
</tr>
<% end %>
</table>
<%= link_to ''Previous page'', { :page =>
@admin_pages.current.previous }
if @admin_pages.current.previous %>
<%= link_to ''Next page'', { :page =>
@admin_pages.current.next } if
@admin_pages.current.next %>
<br />
<%= link_to ''New admin'', :action =>
''new'' %>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk
-~----------~----~----~----~------~----~------~--~---