Hi! I have to move a complete model and its migration into a plugin. I know how can I do that for a model but what about the migration??? Regards, Mohsin --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
restful_authentication does something similar using a rake task and an erb template. If you''re not already using it, you might want to install it just to see how they''ve solved the problem. On Apr 28, 9:44 am, MohsinHijazee <mohsinhija...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> Hi! > I have to move a complete model and its migration into a plugin. I > know how can I do that for a model but what about the migration??? > > Regards, > Mohsin--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 28, 8:22 pm, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> restful_authentication does something similar using a rake task and an > erb template. If you''re not already using it, you might want to > install it just to see how they''ve solved the problem.I''ve looked into it and its not yet clear to me. Actually, I only need to create a single table when my plugin is installed. No more. Should I do it manually in install.rb and uninstall.rb?> > On Apr 28, 9:44 am, MohsinHijazee <mohsinhija...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > > Hi! > > I have to move a complete model and its migration into a plugin. I > > know how can I do that for a model but what about the migration??? > > > Regards, > > Mohsin--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
MohsinHijazee wrote:> On Apr 28, 8:22 pm, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: >> restful_authentication does something similar using a rake task and an >> erb template. If you''re not already using it, you might want to >> install it just to see how they''ve solved the problem. > I''ve looked into it and its not yet clear to me. Actually, I only need > to create a single table when my plugin is installed. No more. Should > I do it manually in install.rb and uninstall.rb?It seems the Rails generator library has a migration method. The relevant code in restful authentication can be found at line 179 of "authenticated_generator.rb": unless options[:skip_migration] m.migration_template ''migration.rb'', ''db/migrate'', :assigns => { :migration_name => "Create#{class_name.pluralize.gsub(/::/, '''')}" }, :migration_file_name => "create_#{file_path.gsub(/\//, ''_'').pluralize}" end There is obviously a lot here you won''t need. You will also find a file called migration.rb in the templates directory, which get interpreted and copied across. Mind you - I have never built a template for a migration before, so don''t follow me :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
On Apr 29, 11:14 am, Andrew Skegg <rails-mailing-l...-ARtvInVfO7ksV2N9l4h3zg@public.gmane.org> wrote:> MohsinHijazee wrote: > > On Apr 28, 8:22 pm, AndyV <AndyVana...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > >> restful_authentication does something similar using a rake task and an > >> erb template. If you''re not already using it, you might want to > >> install it just to see how they''ve solved the problem. > > I''ve looked into it and its not yet clear to me. Actually, I only need > > to create a single table when my plugin is installed. No more. Should > > I do it manually in install.rb and uninstall.rb? > > It seems the Rails generator library has a migration method. The > relevant code in restful authentication can be found at line 179 of > "authenticated_generator.rb": > > unless options[:skip_migration] > m.migration_template ''migration.rb'', ''db/migrate'', :assigns => { > :migration_name => "Create#{class_name.pluralize.gsub(/::/, > '''')}" > }, :migration_file_name => "create_#{file_path.gsub(/\//, > ''_'').pluralize}" > end > > There is obviously a lot here you won''t need. You will also find a file > called migration.rb in the templates directory, which get interpreted > and copied across. > > Mind you - I have never built a template for a migration before, so > don''t follow me :)So in a nutshell, there is no smart way of packing a migration with an application. Like if its a zip code plugin, the it would require to create a table called zipcodes and would need to populate it. What if we do it in install.rb and uninstall.rb? How do we do that?> > -- > Posted viahttp://www.ruby-forum.com/.--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---
engines does some ''engines migrations''> So in a nutshell, there is no smart way of packing a migration with an > application. Like if its a zip code plugin, the it would require to > create a table called zipcodes and would need to populate it. > What if we do it in install.rb and uninstall.rb? How do we do that?--~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---