Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-settings.php on line 399

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-settings.php on line 414

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-settings.php on line 421

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-settings.php on line 456

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 576

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 593

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 687

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el(&$output) in /home/mangar.com.br/blogv3/wp-includes/classes.php on line 710

Strict Standards: Redefining already defined constructor for class wpdb in /home/mangar.com.br/blogv3/wp-includes/wp-db.php on line 58

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-includes/cache.php on line 99

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/mangar.com.br/blogv3/wp-includes/cache.php on line 404

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/mangar.com.br/blogv3/wp-includes/theme.php on line 576

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method Add_to_Any_Subscribe_Widget::init() should not be called statically in /home/mangar.com.br/blogv3/wp-includes/plugin.php on line 311

Strict Standards: call_user_func_array() expects parameter 1 to be a valid callback, non-static method GoogleSitemapGeneratorLoader::Enable() should not be called statically in /home/mangar.com.br/blogv3/wp-includes/plugin.php on line 311

Deprecated: Function eregi() is deprecated in /home/mangar.com.br/blogv3/wp-content/plugins/wp-statpress/statpress.php on line 1139

Deprecated: Function eregi() is deprecated in /home/mangar.com.br/blogv3/wp-content/plugins/wp-statpress/statpress.php on line 1140

Deprecated: Function eregi() is deprecated in /home/mangar.com.br/blogv3/wp-content/plugins/wp-statpress/statpress.php on line 1141

Deprecated: Function eregi() is deprecated in /home/mangar.com.br/blogv3/wp-content/plugins/wp-statpress/statpress.php on line 1142

Deprecated: Function ereg() is deprecated in /home/mangar.com.br/blogv3/wp-content/plugins/wp-statpress/statpress.php on line 979
RoR at Marcio Garcia

Marcio Garcia

Software Empowerment²

Archive for the ‘RoR’ tag

Ubuntu + Ruby on Rails + Apache + Passenger

without comments

Guia expresso para instalação de um ambiente de produção RoR/Apache/Passenger no Ubuntu

sudo apt-get install rubygems
 
sudo gem install rails
 
sudo apt-get install ruby
 
sudo apt-get install ruby rdoc irb libyaml-ruby libzlib-ruby ri libopenssl-ruby
 
wget http://rubyforge.rubyuser.de/rubygems/rubygems-1.3.1.tgz
 
tar xzvf rubygems-1.3.1.tgz 
 
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
 
sudo mv /usr/bin/gem /usr/bin/gem-old
 
sudo gem update --system
 
sudo gem install rails
 
sudo apt-get install build-essential ruby1.8-dev
 
sudo gem install mongrel
 
sudo gem install capistrano
 
sudo apt-get install mysql-client mysql-admin mysql-query-browser libmysqlclient15-dev
 
sudo apt-get install sqlite3 swig libsqlite3-ruby libsqlite3-dev
 
sudo gem install sqlite3-ruby
 
echo "export RUBYOPT=rubygems" >> ~/.profile
 
sudo apt-get install build-essential apache2-mpm-prefork apache2-prefork-dev libapr1-dev
 
sudo gem install passenger
 
sudo passenger-install-apache2-module
 

Written by Marcio

January 16th, 2009 at 12:17 am

Posted in Apache, RubyOnRails, Ubuntu

Tagged with , , ,

Screencast - restful_authentication

with 3 comments


restful_authentication - Screencast (pt-br) from Marcio Garcia on Vimeo.

Instalação do restful_authentication

URL do plugin:

http://svn.techno-weenie.net/projects/plugins/restful_authentication/

./scrpt/plugin source http://svn.techno-weenie.net/projects/plugins/restful_authentication/
 
./script/plugin install restful_authentication

Criação dos controllers e model padrão
./script/generate authenticated user sessions

Alterações de código

routes.rb
#novas rotas....
map.signup '/', :controller => 'sessions', :action => 'new'
map.signup '/signup', :controller => 'users', :action => 'new'
map.login  '/login',  :controller => 'sessions', :action => 'new'
map.logout '/logout', :controller => 'sessions', :action => 'destroy'

app/views/layouts/application.html.erb
<html>
<head>
  <meta http-equiv="content-type" content="text/html;charset=UTF-8" />
  <%= stylesheet_link_tag 'scaffold' %>
</head>
<body bgcolor="#1471B7">
<center>
<p>&nbsp;</p>
<table width="90%"  bgcolor="#FFFFFF">
	<tr>
		<td align="center">
		<%= yield%>			
		</td>
	</tr>
</table>
</center>
</body>
</html>





app/controllers/application.rb
include AuthenticatedSystem

app/controllers/sessions_controller.rb
def new
  #alterado....................
  flash[:notice] = "Usuario logado!" if logged_in?
  flash[:notice] = "Usuario NÃO logado!" unless logged_in?
end

app/controllers/users_controller.rb
#alterado......................
before_filter :authentication
def authentication
  redirect_back_or_default('/') unless logged_in?
end

Código fonte

rademo.zip

Written by Marcio

November 7th, 2008 at 12:13 am